Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snowtransfer

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snowtransfer - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

17

dist/methods/Guilds.d.ts

@@ -272,4 +272,19 @@ /**

*/
getGuildBans(guildId: string): Promise<Array<any>>;
getGuildBans(guildId: string, options?: {
limit?: number;
before?: string;
after?: string;
}): Promise<Array<import("discord-typings").Ban>>;
/**
* Get a specific ban of a guild member
* @param guildId Id of the guild
* @param memberId Id of the member
* @returns [ban](https://discord.com/developers/docs/resources/guild#ban-object-ban-structure) object
*
* | Permissions needed | Condition |
* |--------------------|-----------|
* | BAN_MEMBERS | always |
*/
getGuildBan(guildId: string, memberId: string): Promise<import("discord-typings").Ban>;
/**
* Ban a guild member

@@ -276,0 +291,0 @@ * @param guildId Id of the guild

@@ -293,6 +293,19 @@ "use strict";

*/
async getGuildBans(guildId) {
return this.requestHandler.request(Endpoints_1.default.GUILD_BANS(guildId), "get", "json");
async getGuildBans(guildId, options) {
return this.requestHandler.request(`${Endpoints_1.default.GUILD_BANS(guildId)}${options ? Object.keys(options).map((v, index) => `${index === 0 ? "?" : "&"}${v}=${options[v]}`) : ""}`, "get", "json");
}
/**
* Get a specific ban of a guild member
* @param guildId Id of the guild
* @param memberId Id of the member
* @returns [ban](https://discord.com/developers/docs/resources/guild#ban-object-ban-structure) object
*
* | Permissions needed | Condition |
* |--------------------|-----------|
* | BAN_MEMBERS | always |
*/
async getGuildBan(guildId, memberId) {
return this.requestHandler.request(Endpoints_1.default.GUILD_BAN(guildId, memberId), "get", "json");
}
/**
* Ban a guild member

@@ -299,0 +312,0 @@ * @param guildId Id of the guild

3

dist/methods/GuildScheduledEvent.js

@@ -118,6 +118,5 @@ "use strict";

throw new Error(`The maximum amount of users that may be requested is ${Constants_1.default.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS}`);
const qs = Object.keys(options).map(key => `${key}=${options[key]}`).join("&");
return this.requestHandler.request(Endpoints_1.default.GUILD_SCHEDULED_EVENT_USERS(guildId, eventId) + (qs ? `?${qs}` : ""), "get", "json");
return this.requestHandler.request(`${Endpoints_1.default.GUILD_SCHEDULED_EVENT_USERS(guildId, eventId)}${options ? Object.keys(options).map((v, index) => `${index === 0 ? "?" : "&"}${v}=${options[v]}`) : ""}`, "get", "json");
}
}
module.exports = GuildScheduledEventMethods;

@@ -155,3 +155,3 @@ /// <reference types="node" />

thread_id?: string;
}): Promise<void>;
} | undefined): Promise<void>;
/**

@@ -158,0 +158,0 @@ * Executes a github style Webhook

@@ -137,3 +137,3 @@ "use strict";

}
async executeWebhook(webhookId, token, data, options = { wait: false, disableEveryone: this.disableEveryone }) {
async executeWebhook(webhookId, token, data, options = { disableEveryone: this.disableEveryone }) {
if (typeof data !== "string" && !(data === null || data === void 0 ? void 0 : data.content) && !(data === null || data === void 0 ? void 0 : data.embeds) && !(data === null || data === void 0 ? void 0 : data.files))

@@ -146,6 +146,8 @@ throw new Error("Missing content or embeds or files");

data.content = data.content.replace(/@([^<>@ ]*)/gsmu, replaceEveryone);
if (data.files)
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN(webhookId, token) + ((options === null || options === void 0 ? void 0 : options.wait) ? "?wait=true" : "") + ((options === null || options === void 0 ? void 0 : options.thread_id) ? `${(options === null || options === void 0 ? void 0 : options.wait) ? "&" : "?"}thread_id=${options.thread_id}` : ""), "post", "multipart", data);
else
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN(webhookId, token) + ((options === null || options === void 0 ? void 0 : options.wait) ? "?wait=true" : "") + ((options === null || options === void 0 ? void 0 : options.thread_id) ? `${(options === null || options === void 0 ? void 0 : options.wait) ? "&" : "?"}thread_id=${options.thread_id}` : ""), "post", "json", data);
if (options) {
delete options.disableEveryone;
if (Object.keys(options).length === 0)
options = undefined;
}
return this.requestHandler.request(`${Endpoints_1.default.WEBHOOK_TOKEN(webhookId, token)}${options ? Object.keys(options).map((v, index) => `${index === 0 ? "?" : "&"}${v}=${options[v]}`) : ""}`, "post", data.files ? "multipart" : "json", data);
}

@@ -160,7 +162,12 @@ /**

*/
async executeWebhookSlack(webhookId, token, data, options = { wait: false, disableEveryone: this.disableEveryone }) {
async executeWebhookSlack(webhookId, token, data, options = { disableEveryone: this.disableEveryone }) {
// Sanitize the message
if (data.text && ((options === null || options === void 0 ? void 0 : options.disableEveryone) !== undefined ? options.disableEveryone : this.disableEveryone))
data.text = data.text.replace(/@([^<>@ ]*)/gsmu, replaceEveryone);
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN_SLACK(webhookId, token) + ((options === null || options === void 0 ? void 0 : options.wait) ? "?wait=true" : "") + ((options === null || options === void 0 ? void 0 : options.thread_id) ? `${(options === null || options === void 0 ? void 0 : options.wait) ? "&" : "?"}thread_id=${options.thread_id}` : ""), "post", "json", data);
if (options) {
delete options.disableEveryone;
if (Object.keys(options).length === 0)
options = undefined;
}
return this.requestHandler.request(`${Endpoints_1.default.WEBHOOK_TOKEN_SLACK(webhookId, token)}${options ? Object.keys(options).map((v, index) => `${index === 0 ? "?" : "&"}${v}=${options[v]}`) : ""}`, "post", "json", data);
}

@@ -175,4 +182,4 @@ /**

*/
async executeWebhookGitHub(webhookId, token, data, options = { wait: false }) {
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN_GITHUB(webhookId, token) + ((options === null || options === void 0 ? void 0 : options.wait) ? "?wait=true" : "") + ((options === null || options === void 0 ? void 0 : options.thread_id) ? `${(options === null || options === void 0 ? void 0 : options.wait) ? "&" : "?"}thread_id=${options.thread_id}` : ""), "post", "json", data);
async executeWebhookGitHub(webhookId, token, data, options) {
return this.requestHandler.request(`${Endpoints_1.default.WEBHOOK_TOKEN_GITHUB(webhookId, token)}${options ? Object.keys(options).map((v, index) => `${index === 0 ? "?" : "&"}${v}=${options[v]}`) : ""}`, "post", "json", data);
}

@@ -202,6 +209,3 @@ /**

delete data.thread_id;
if (data.files)
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN_MESSAGE(webhookId, token, messageId) + (threadID ? `?thread_id=${threadID}` : ""), "patch", "multipart", data);
else
return this.requestHandler.request(Endpoints_1.default.WEBHOOK_TOKEN_MESSAGE(webhookId, token, messageId) + (threadID ? `?thread_id=${threadID}` : ""), "patch", "json", data);
return this.requestHandler.request(`${Endpoints_1.default.WEBHOOK_TOKEN_MESSAGE(webhookId, token, messageId)}${threadID ? `?thread_id=${threadID}` : ""}`, "patch", data.files ? "multipart" : "json", data);
}

@@ -208,0 +212,0 @@ /**

@@ -54,3 +54,3 @@ /// <reference types="node" />

headers: {
Authorization: string;
Authorization?: string;
"User-Agent": string;

@@ -68,3 +68,3 @@ };

constructor(ratelimiter: import("./Ratelimiter"), options: {
token: string;
token?: string;
baseHost: string;

@@ -71,0 +71,0 @@ });

@@ -59,7 +59,8 @@ "use strict";

headers: {
Authorization: options.token,
"User-Agent": `Discordbot (https://github.com/DasWolke/SnowTransfer, ${version}) Node.js/${process.version}`
}
};
Object.assign(this.options, options);
if (options.token)
this.options.headers.Authorization = options.token;
this.options.baseHost = options.baseHost;
this.apiURL = this.options.baseHost + Endpoints_1.default.BASE_URL;

@@ -66,0 +67,0 @@ this.latency = 500;

@@ -27,3 +27,3 @@ import Ratelimiter from "./Ratelimiter";

};
token: string;
token: string | undefined;
channel: ChannelMethods;

@@ -49,3 +49,3 @@ requestHandler: RequestHandler;

*/
constructor(token: string, options?: {
constructor(token?: string, options?: {
baseHost?: string;

@@ -52,0 +52,0 @@ disableEveryone?: boolean;

@@ -29,5 +29,5 @@ "use strict";

constructor(token, options) {
if (!token || token === "")
if (typeof token === "string" && token === "")
throw new Error("Missing token");
if (!token.startsWith("Bot"))
if (token && !token.startsWith("Bot"))
token = `Bot ${token}`;

@@ -34,0 +34,0 @@ this.options = { baseHost: Endpoints_1.default.BASE_HOST, disableEveryone: false, sentryOptions: { extra: { snowtransferVersion: version } }, useRedis: false };

{
"name": "snowtransfer",
"version": "0.4.1",
"version": "0.4.2",
"description": "Minimalistic Rest client for the Discord Api",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc