snowtransfer 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +46 -0
- package/dist/Constants.d.ts +8 -0
- package/dist/Constants.js +8 -0
- package/dist/Endpoints.d.ts +89 -0
- package/dist/Endpoints.js +99 -0
- package/dist/Ratelimiter.d.ts +39 -0
- package/dist/Ratelimiter.js +69 -0
- package/dist/RequestHandler.d.ts +112 -0
- package/dist/RequestHandler.js +238 -0
- package/dist/SnowTransfer.d.ts +51 -0
- package/dist/SnowTransfer.js +56 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -0
- package/dist/methods/AuditLog.d.ts +45 -0
- package/dist/methods/AuditLog.js +35 -0
- package/dist/methods/Bots.d.ts +40 -0
- package/dist/methods/Bots.js +46 -0
- package/dist/methods/Channels.d.ts +749 -0
- package/dist/methods/Channels.js +685 -0
- package/dist/methods/GuildAssets.d.ts +191 -0
- package/dist/methods/GuildAssets.js +172 -0
- package/dist/methods/GuildTemplate.d.ts +57 -0
- package/dist/methods/GuildTemplate.js +68 -0
- package/dist/methods/Guilds.d.ts +733 -0
- package/dist/methods/Guilds.js +598 -0
- package/dist/methods/Interactions.d.ts +221 -0
- package/dist/methods/Interactions.js +262 -0
- package/dist/methods/Invites.d.ts +37 -0
- package/dist/methods/Invites.js +44 -0
- package/dist/methods/StageInstance.d.ts +64 -0
- package/dist/methods/StageInstance.js +73 -0
- package/dist/methods/Users.d.ts +76 -0
- package/dist/methods/Users.js +93 -0
- package/dist/methods/Voices.d.ts +21 -0
- package/dist/methods/Voices.js +29 -0
- package/dist/methods/Webhooks.d.ts +288 -0
- package/dist/methods/Webhooks.js +222 -0
- package/dist/ratelimitBuckets/LocalBucket.d.ts +58 -0
- package/dist/ratelimitBuckets/LocalBucket.js +77 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
declare type WebhookMethods = import("./Webhooks");
|
|
2
|
+
/**
|
|
3
|
+
* Methods for interacting with slash command specific endpoints
|
|
4
|
+
*/
|
|
5
|
+
declare class InteractionMethods {
|
|
6
|
+
requestHandler: import("../RequestHandler");
|
|
7
|
+
webhooks: import("./Webhooks");
|
|
8
|
+
/**
|
|
9
|
+
* Create a new Interaction Method Handler
|
|
10
|
+
*
|
|
11
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
12
|
+
*
|
|
13
|
+
* You can access the methods listed via `client.interaction.method`, where `client` is an initialized SnowTransfer instance
|
|
14
|
+
* @param requestHandler request handler that calls the rest api
|
|
15
|
+
*/
|
|
16
|
+
constructor(requestHandler: import("../RequestHandler"), webhooks: import("./Webhooks"));
|
|
17
|
+
/**
|
|
18
|
+
* Fetch all global commands for your application
|
|
19
|
+
* @param appId The Id of the application
|
|
20
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
21
|
+
*/
|
|
22
|
+
getApplicationCommands(appId: string): Promise<Array<import("discord-typings").ApplicationCommand>>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetch a global command for your application
|
|
25
|
+
* @param appId The Id of the application
|
|
26
|
+
* @param cmdId The Id of the command
|
|
27
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
28
|
+
*/
|
|
29
|
+
getApplicationCommand(appId: string, cmdId: string): Promise<import("discord-typings").ApplicationCommand>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a new global command. New global commands will be available in all guilds after 1 hour
|
|
32
|
+
* @param appId The Id of the application
|
|
33
|
+
* @param data The command data
|
|
34
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
35
|
+
*/
|
|
36
|
+
createApplicationCommand(appId: string, data: CommandData & {
|
|
37
|
+
type?: import("discord-typings").ApplicationCommandType;
|
|
38
|
+
}): Promise<import("discord-typings").ApplicationCommand>;
|
|
39
|
+
/**
|
|
40
|
+
* Edit a global command. Updates will be available in all guilds after 1 hour
|
|
41
|
+
* @param appId The Id of the application
|
|
42
|
+
* @param cmdId The Id of the command
|
|
43
|
+
* @param data The command data
|
|
44
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
45
|
+
*/
|
|
46
|
+
editApplicationCommand(appId: string, cmdId: string, data: Partial<CommandData>): Promise<import("discord-typings").ApplicationCommand>;
|
|
47
|
+
/**
|
|
48
|
+
* Takes a list of application commands, overwriting existing commands that are registered globally for this application.
|
|
49
|
+
* Updates will be available in all guilds after 1 hour
|
|
50
|
+
* @param appId The Id of the application
|
|
51
|
+
* @param data Array of commands
|
|
52
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
53
|
+
*/
|
|
54
|
+
bulkOverwriteApplicationCommands(appId: any, data: Array<CommandData & {
|
|
55
|
+
type?: import("discord-typings").ApplicationCommandType;
|
|
56
|
+
}>): Promise<Array<import("discord-typings").ApplicationCommand>>;
|
|
57
|
+
/**
|
|
58
|
+
* Deletes a global command
|
|
59
|
+
* @param appId The Id of the application
|
|
60
|
+
* @param cmdId The Id of the command
|
|
61
|
+
* @returns Resolves the Promise on successful execution
|
|
62
|
+
*/
|
|
63
|
+
deleteApplicationCommand(appId: string, cmdId: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Fetch all of the guild commands for your application for a specific guild.
|
|
66
|
+
* @param appId The Id of the application
|
|
67
|
+
* @param guildId The Id of the guild
|
|
68
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
69
|
+
*/
|
|
70
|
+
getGuildApplicationCommands(appId: string, guildId: string): Promise<Array<import("discord-typings").ApplicationCommand>>;
|
|
71
|
+
/**
|
|
72
|
+
* Fetch a guild command for your application
|
|
73
|
+
* @param appId The Id of the application
|
|
74
|
+
* @param guildId The Id of the guild
|
|
75
|
+
* @param cmdId The Id of the command
|
|
76
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
77
|
+
*/
|
|
78
|
+
getGuildApplicationCommand(appId: string, guildId: string, cmdId: string): Promise<import("discord-typings").ApplicationCommand>;
|
|
79
|
+
/**
|
|
80
|
+
* Create a new guild command. New guild commands will be available in the guild immediately.
|
|
81
|
+
* @param appId The Id of the application
|
|
82
|
+
* @param guildId The Id of the guild
|
|
83
|
+
* @param data Command data
|
|
84
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
85
|
+
*/
|
|
86
|
+
createGuildApplicationCommand(appId: string, guildId: string, data: CommandData & {
|
|
87
|
+
type?: import("discord-typings").ApplicationCommandType;
|
|
88
|
+
}): Promise<import("discord-typings").ApplicationCommand>;
|
|
89
|
+
/**
|
|
90
|
+
* Edit a guild command. Updates for guild commands will be available immediately.
|
|
91
|
+
* @param appId The Id of the application
|
|
92
|
+
* @param guildId The Id of the guild
|
|
93
|
+
* @param cmdId The Id of the command
|
|
94
|
+
* @param data New command data
|
|
95
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
96
|
+
*/
|
|
97
|
+
editGuildApplicationCommand(appId: string, guildId: string, cmdId: string, data: Partial<CommandData>): Promise<import("discord-typings").ApplicationCommand>;
|
|
98
|
+
/**
|
|
99
|
+
* Takes a list of application commands, overwriting existing commands for the guild
|
|
100
|
+
* @param appId The Id of the application
|
|
101
|
+
* @param guildId The Id of the guild
|
|
102
|
+
* @param data Array of commands
|
|
103
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
104
|
+
*/
|
|
105
|
+
bulkOverwriteGuildApplicationCommand(appId: string, guildId: string, data: Array<CommandData & {
|
|
106
|
+
type?: import("discord-typings").ApplicationCommandType;
|
|
107
|
+
}>): Promise<Array<import("discord-typings").ApplicationCommand>>;
|
|
108
|
+
/**
|
|
109
|
+
* Delete a guild command
|
|
110
|
+
* @param appId The Id of the application
|
|
111
|
+
* @param guildId The Id of the guild
|
|
112
|
+
* @param cmdId The Id of the command
|
|
113
|
+
* @returns Resolves the Promise on successful execution
|
|
114
|
+
*/
|
|
115
|
+
deleteGuildApplicationCommand(appId: string, guildId: string, cmdId: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the initial Interaction response
|
|
118
|
+
* @param appId The Id of the application
|
|
119
|
+
* @param token The token of the interaction
|
|
120
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
121
|
+
*/
|
|
122
|
+
getOriginalInteractionResponse(appId: string, token: string): Promise<import("discord-typings").MessageData>;
|
|
123
|
+
/**
|
|
124
|
+
* Create a response to an Interaction
|
|
125
|
+
* @param interactionId The Id of the interaction
|
|
126
|
+
* @param token The token of the interaction
|
|
127
|
+
* @param data Response data
|
|
128
|
+
* @returns Resolves the Promise on successful execution
|
|
129
|
+
*/
|
|
130
|
+
createInteractionResponse(interactionId: string, token: string, data: import("discord-typings").InteractionResponseData): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Edits the initial Interaction response
|
|
133
|
+
* @param appId The Id of the application
|
|
134
|
+
* @param token The token of the interaction
|
|
135
|
+
* @param data New response data
|
|
136
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
137
|
+
*/
|
|
138
|
+
editOriginalInteractionResponse(appId: string, token: string, data: Parameters<WebhookMethods["editWebhookMessage"]>[3]): Promise<import("discord-typings").MessageData>;
|
|
139
|
+
/**
|
|
140
|
+
* Deletes the initial Interaction response
|
|
141
|
+
* @param appId The Id of the application
|
|
142
|
+
* @param token The token of the interaction
|
|
143
|
+
* @returns Resolves the Promise on successful execution
|
|
144
|
+
*/
|
|
145
|
+
deleteOriginalInteractionResponse(appId: string, token: string): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Create a followup message for an Interaction
|
|
148
|
+
* @param appId The Id of the application
|
|
149
|
+
* @param token The token of the interaction
|
|
150
|
+
* @param data Message data
|
|
151
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
152
|
+
*/
|
|
153
|
+
createFollowupMessage(appId: string, token: string, data: Parameters<WebhookMethods["executeWebhook"]>[2] & {
|
|
154
|
+
flags?: number;
|
|
155
|
+
}): Promise<import("discord-typings").MessageData>;
|
|
156
|
+
/**
|
|
157
|
+
* Get a followup message for an Interaction
|
|
158
|
+
* @param appId The Id of the application
|
|
159
|
+
* @param token The token of the interaction
|
|
160
|
+
* @param messageId The Id of the message
|
|
161
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
162
|
+
*/
|
|
163
|
+
getFollowupMessage(appId: string, token: string, messageId: string): Promise<import("discord-typings").MessageData>;
|
|
164
|
+
/**
|
|
165
|
+
* Edits a followup message for an Interaction
|
|
166
|
+
* @param appId The Id of the application
|
|
167
|
+
* @param token The token of the interaction
|
|
168
|
+
* @param messageId The Id of the message
|
|
169
|
+
* @param data The new message data
|
|
170
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
171
|
+
*/
|
|
172
|
+
editFollowupMessage(appId: string, token: string, messageId: string, data: Parameters<WebhookMethods["editWebhookMessage"]>[3]): Promise<import("discord-typings").MessageData>;
|
|
173
|
+
/**
|
|
174
|
+
* Deletes a followup message for an Interaction
|
|
175
|
+
* @param appId The Id of the application
|
|
176
|
+
* @param token The token of the interaction
|
|
177
|
+
* @param messageId The Id of the message
|
|
178
|
+
* @returns Resolves the Promise on successful execution
|
|
179
|
+
*/
|
|
180
|
+
deleteFollowupMessage(appId: string, token: string, messageId: string): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Fetches command permissions for all commands for your application in a guild
|
|
183
|
+
* @param appId The Id of the application
|
|
184
|
+
* @param guildId The Id of the guild
|
|
185
|
+
* @returns An Array of [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects
|
|
186
|
+
*/
|
|
187
|
+
getGuildApplicationCommandPermissions(appId: string, guildId: string): Promise<Array<import("discord-typings").GuildApplicationCommandPermissions>>;
|
|
188
|
+
/**
|
|
189
|
+
* Fetches command permissions for a specific command for your application in a guild
|
|
190
|
+
* @param appId The Id of the application
|
|
191
|
+
* @param guildId The Id of the guild
|
|
192
|
+
* @param cmdId The Id of the command
|
|
193
|
+
* @returns A [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) object
|
|
194
|
+
*/
|
|
195
|
+
getApplicationCommandPermissions(appId: string, guildId: string, cmdId: string): Promise<import("discord-typings").GuildApplicationCommandPermissions>;
|
|
196
|
+
/**
|
|
197
|
+
* Edits command permissions for a specific command for your application in a guild. You can only add up to 10 permission overwrites for a command.
|
|
198
|
+
* @param appId The Id of the application
|
|
199
|
+
* @param guildId The Id of the guild
|
|
200
|
+
* @param cmdId The Id of the command
|
|
201
|
+
* @param permissions New application command permissions data
|
|
202
|
+
* @returns A [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) object
|
|
203
|
+
*/
|
|
204
|
+
editApplicationCommandPermissions(appId: string, guildId: string, cmdId: string, permissions: Array<Exclude<import("discord-typings").ApplicationCommandPermissions, "id">>): Promise<import("discord-typings").GuildApplicationCommandPermissions>;
|
|
205
|
+
/**
|
|
206
|
+
* Batch edits permissions for all commands in a guild. Takes an Array of partial [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects.
|
|
207
|
+
* You can only add up to 10 permission overwrites for a command
|
|
208
|
+
* @param appId The Id of the application
|
|
209
|
+
* @param guildId The Id of the guild
|
|
210
|
+
* @param permissions New application command permissions data Array
|
|
211
|
+
* @returns An Array of [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects
|
|
212
|
+
*/
|
|
213
|
+
batchEditApplicationCommandPermissions(appId: string, guildId: string, permissions: Array<Pick<import("discord-typings").GuildApplicationCommandPermissions, "id" | "permissions">>): Promise<Array<import("discord-typings").GuildApplicationCommandPermissions>>;
|
|
214
|
+
}
|
|
215
|
+
export = InteractionMethods;
|
|
216
|
+
interface CommandData {
|
|
217
|
+
name: string;
|
|
218
|
+
description: string;
|
|
219
|
+
options?: Array<import("discord-typings").ApplicationCommandOption>;
|
|
220
|
+
default_permission?: boolean;
|
|
221
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const Endpoints_1 = __importDefault(require("../Endpoints"));
|
|
6
|
+
/**
|
|
7
|
+
* Methods for interacting with slash command specific endpoints
|
|
8
|
+
*/
|
|
9
|
+
class InteractionMethods {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new Interaction Method Handler
|
|
12
|
+
*
|
|
13
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
14
|
+
*
|
|
15
|
+
* You can access the methods listed via `client.interaction.method`, where `client` is an initialized SnowTransfer instance
|
|
16
|
+
* @param requestHandler request handler that calls the rest api
|
|
17
|
+
*/
|
|
18
|
+
constructor(requestHandler, webhooks) {
|
|
19
|
+
this.requestHandler = requestHandler;
|
|
20
|
+
this.webhooks = webhooks;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fetch all global commands for your application
|
|
24
|
+
* @param appId The Id of the application
|
|
25
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
26
|
+
*/
|
|
27
|
+
getApplicationCommands(appId) {
|
|
28
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMANDS(appId), "get", "json");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetch a global command for your application
|
|
32
|
+
* @param appId The Id of the application
|
|
33
|
+
* @param cmdId The Id of the command
|
|
34
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
35
|
+
*/
|
|
36
|
+
getApplicationCommand(appId, cmdId) {
|
|
37
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMAND(appId, cmdId), "get", "json");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a new global command. New global commands will be available in all guilds after 1 hour
|
|
41
|
+
* @param appId The Id of the application
|
|
42
|
+
* @param data The command data
|
|
43
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
44
|
+
*/
|
|
45
|
+
createApplicationCommand(appId, data) {
|
|
46
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMANDS(appId), "post", "json", data);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Edit a global command. Updates will be available in all guilds after 1 hour
|
|
50
|
+
* @param appId The Id of the application
|
|
51
|
+
* @param cmdId The Id of the command
|
|
52
|
+
* @param data The command data
|
|
53
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
54
|
+
*/
|
|
55
|
+
editApplicationCommand(appId, cmdId, data) {
|
|
56
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMAND(appId, cmdId), "patch", "json", data);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Takes a list of application commands, overwriting existing commands that are registered globally for this application.
|
|
60
|
+
* Updates will be available in all guilds after 1 hour
|
|
61
|
+
* @param appId The Id of the application
|
|
62
|
+
* @param data Array of commands
|
|
63
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
64
|
+
*/
|
|
65
|
+
bulkOverwriteApplicationCommands(appId, data) {
|
|
66
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMANDS(appId), "put", "json", data);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Deletes a global command
|
|
70
|
+
* @param appId The Id of the application
|
|
71
|
+
* @param cmdId The Id of the command
|
|
72
|
+
* @returns Resolves the Promise on successful execution
|
|
73
|
+
*/
|
|
74
|
+
deleteApplicationCommand(appId, cmdId) {
|
|
75
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMAND(appId, cmdId), "delete", "json");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Fetch all of the guild commands for your application for a specific guild.
|
|
79
|
+
* @param appId The Id of the application
|
|
80
|
+
* @param guildId The Id of the guild
|
|
81
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
82
|
+
*/
|
|
83
|
+
getGuildApplicationCommands(appId, guildId) {
|
|
84
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMANDS(appId, guildId), "get", "json");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Fetch a guild command for your application
|
|
88
|
+
* @param appId The Id of the application
|
|
89
|
+
* @param guildId The Id of the guild
|
|
90
|
+
* @param cmdId The Id of the command
|
|
91
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
92
|
+
*/
|
|
93
|
+
getGuildApplicationCommand(appId, guildId, cmdId) {
|
|
94
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMAND(appId, guildId, cmdId), "get", "json");
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a new guild command. New guild commands will be available in the guild immediately.
|
|
98
|
+
* @param appId The Id of the application
|
|
99
|
+
* @param guildId The Id of the guild
|
|
100
|
+
* @param data Command data
|
|
101
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
102
|
+
*/
|
|
103
|
+
createGuildApplicationCommand(appId, guildId, data) {
|
|
104
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMANDS(appId, guildId), "post", "json", data);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Edit a guild command. Updates for guild commands will be available immediately.
|
|
108
|
+
* @param appId The Id of the application
|
|
109
|
+
* @param guildId The Id of the guild
|
|
110
|
+
* @param cmdId The Id of the command
|
|
111
|
+
* @param data New command data
|
|
112
|
+
* @returns An [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) object
|
|
113
|
+
*/
|
|
114
|
+
editGuildApplicationCommand(appId, guildId, cmdId, data) {
|
|
115
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMAND(appId, guildId, cmdId), "patch", "json", data);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Takes a list of application commands, overwriting existing commands for the guild
|
|
119
|
+
* @param appId The Id of the application
|
|
120
|
+
* @param guildId The Id of the guild
|
|
121
|
+
* @param data Array of commands
|
|
122
|
+
* @returns An Array of [application command](https://discord.com/developers/docs/interactions/slash-commands#application-command-object) objects
|
|
123
|
+
*/
|
|
124
|
+
bulkOverwriteGuildApplicationCommand(appId, guildId, data) {
|
|
125
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMANDS(appId, guildId), "put", "json", data);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Delete a guild command
|
|
129
|
+
* @param appId The Id of the application
|
|
130
|
+
* @param guildId The Id of the guild
|
|
131
|
+
* @param cmdId The Id of the command
|
|
132
|
+
* @returns Resolves the Promise on successful execution
|
|
133
|
+
*/
|
|
134
|
+
deleteGuildApplicationCommand(appId, guildId, cmdId) {
|
|
135
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_GUILD_COMMAND(appId, guildId, cmdId), "delete", "json");
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the initial Interaction response
|
|
139
|
+
* @param appId The Id of the application
|
|
140
|
+
* @param token The token of the interaction
|
|
141
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
142
|
+
*/
|
|
143
|
+
getOriginalInteractionResponse(appId, token) {
|
|
144
|
+
return this.webhooks.getWebhookMessage(appId, token, "@original");
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Create a response to an Interaction
|
|
148
|
+
* @param interactionId The Id of the interaction
|
|
149
|
+
* @param token The token of the interaction
|
|
150
|
+
* @param data Response data
|
|
151
|
+
* @returns Resolves the Promise on successful execution
|
|
152
|
+
*/
|
|
153
|
+
createInteractionResponse(interactionId, token, data) {
|
|
154
|
+
return this.requestHandler.request(Endpoints_1.default.INTERACTION_CALLBACK(interactionId, token), "post", "json", data);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Edits the initial Interaction response
|
|
158
|
+
* @param appId The Id of the application
|
|
159
|
+
* @param token The token of the interaction
|
|
160
|
+
* @param data New response data
|
|
161
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
162
|
+
*/
|
|
163
|
+
editOriginalInteractionResponse(appId, token, data) {
|
|
164
|
+
return this.webhooks.editWebhookMessage(appId, token, "@original", data);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Deletes the initial Interaction response
|
|
168
|
+
* @param appId The Id of the application
|
|
169
|
+
* @param token The token of the interaction
|
|
170
|
+
* @returns Resolves the Promise on successful execution
|
|
171
|
+
*/
|
|
172
|
+
deleteOriginalInteractionResponse(appId, token) {
|
|
173
|
+
return this.webhooks.deleteWebhookMessage(appId, token, "@original");
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Create a followup message for an Interaction
|
|
177
|
+
* @param appId The Id of the application
|
|
178
|
+
* @param token The token of the interaction
|
|
179
|
+
* @param data Message data
|
|
180
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
181
|
+
*/
|
|
182
|
+
createFollowupMessage(appId, token, data) {
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
return this.webhooks.executeWebhook(appId, token, data);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get a followup message for an Interaction
|
|
188
|
+
* @param appId The Id of the application
|
|
189
|
+
* @param token The token of the interaction
|
|
190
|
+
* @param messageId The Id of the message
|
|
191
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
192
|
+
*/
|
|
193
|
+
getFollowupMessage(appId, token, messageId) {
|
|
194
|
+
return this.webhooks.getWebhookMessage(appId, token, messageId);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Edits a followup message for an Interaction
|
|
198
|
+
* @param appId The Id of the application
|
|
199
|
+
* @param token The token of the interaction
|
|
200
|
+
* @param messageId The Id of the message
|
|
201
|
+
* @param data The new message data
|
|
202
|
+
* @returns A [message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
203
|
+
*/
|
|
204
|
+
editFollowupMessage(appId, token, messageId, data) {
|
|
205
|
+
return this.webhooks.editWebhookMessage(appId, token, messageId, data);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Deletes a followup message for an Interaction
|
|
209
|
+
* @param appId The Id of the application
|
|
210
|
+
* @param token The token of the interaction
|
|
211
|
+
* @param messageId The Id of the message
|
|
212
|
+
* @returns Resolves the Promise on successful execution
|
|
213
|
+
*/
|
|
214
|
+
deleteFollowupMessage(appId, token, messageId) {
|
|
215
|
+
return this.webhooks.deleteWebhookMessage(appId, token, messageId);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Fetches command permissions for all commands for your application in a guild
|
|
219
|
+
* @param appId The Id of the application
|
|
220
|
+
* @param guildId The Id of the guild
|
|
221
|
+
* @returns An Array of [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects
|
|
222
|
+
*/
|
|
223
|
+
getGuildApplicationCommandPermissions(appId, guildId) {
|
|
224
|
+
return this.requestHandler.request(Endpoints_1.default.GUILD_APPLICATION_COMMAND_PERMISSIONS(appId, guildId), "get", "json");
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Fetches command permissions for a specific command for your application in a guild
|
|
228
|
+
* @param appId The Id of the application
|
|
229
|
+
* @param guildId The Id of the guild
|
|
230
|
+
* @param cmdId The Id of the command
|
|
231
|
+
* @returns A [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) object
|
|
232
|
+
*/
|
|
233
|
+
getApplicationCommandPermissions(appId, guildId, cmdId) {
|
|
234
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMAND_PERMISSIONS(appId, guildId, cmdId), "get", "json");
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Edits command permissions for a specific command for your application in a guild. You can only add up to 10 permission overwrites for a command.
|
|
238
|
+
* @param appId The Id of the application
|
|
239
|
+
* @param guildId The Id of the guild
|
|
240
|
+
* @param cmdId The Id of the command
|
|
241
|
+
* @param permissions New application command permissions data
|
|
242
|
+
* @returns A [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) object
|
|
243
|
+
*/
|
|
244
|
+
editApplicationCommandPermissions(appId, guildId, cmdId, permissions) {
|
|
245
|
+
const payload = {
|
|
246
|
+
permissions: permissions
|
|
247
|
+
};
|
|
248
|
+
return this.requestHandler.request(Endpoints_1.default.APPLICATION_COMMAND_PERMISSIONS(appId, guildId, cmdId), "put", "json", payload);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Batch edits permissions for all commands in a guild. Takes an Array of partial [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects.
|
|
252
|
+
* You can only add up to 10 permission overwrites for a command
|
|
253
|
+
* @param appId The Id of the application
|
|
254
|
+
* @param guildId The Id of the guild
|
|
255
|
+
* @param permissions New application command permissions data Array
|
|
256
|
+
* @returns An Array of [guild application command permission](https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects
|
|
257
|
+
*/
|
|
258
|
+
batchEditApplicationCommandPermissions(appId, guildId, permissions) {
|
|
259
|
+
return this.requestHandler.request(Endpoints_1.default.GUILD_APPLICATION_COMMAND_PERMISSIONS(appId, guildId), "put", "json", permissions);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
module.exports = InteractionMethods;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for interacting with invites
|
|
3
|
+
*/
|
|
4
|
+
declare class InviteMethods {
|
|
5
|
+
requestHandler: import("../RequestHandler");
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Invite Method Handler
|
|
8
|
+
*
|
|
9
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
10
|
+
*
|
|
11
|
+
* You can access the methods listed via `client.invite.method`, where `client` is an initialized SnowTransfer instance
|
|
12
|
+
* @param requestHandler request handler that calls the rest api
|
|
13
|
+
*/
|
|
14
|
+
constructor(requestHandler: import("../RequestHandler"));
|
|
15
|
+
/**
|
|
16
|
+
* Get the invite data on an invite id
|
|
17
|
+
* @param inviteId Id of the invite
|
|
18
|
+
* @param withCounts When set to true you get an invite object with additional `approximate_presence_count` and `approximate_member_count` fields
|
|
19
|
+
* @returns [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
|
|
20
|
+
*/
|
|
21
|
+
getInvite(inviteId: string, options?: {
|
|
22
|
+
with_counts?: boolean;
|
|
23
|
+
with_expiration?: boolean;
|
|
24
|
+
}): Promise<import("discord-typings").InviteData>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete an invite
|
|
27
|
+
* @param inviteId
|
|
28
|
+
* @returns [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
|
|
29
|
+
*
|
|
30
|
+
* | Permissions needed | Condition |
|
|
31
|
+
* |--------------------|-----------------------------------------------|
|
|
32
|
+
* | MANAGE_CHANNELS | for invite that belongs to a specific channel |
|
|
33
|
+
* | MANAGE_GUILD | delete any invite guild wide |
|
|
34
|
+
*/
|
|
35
|
+
deleteInvite(inviteId: string): Promise<import("discord-typings").InviteData>;
|
|
36
|
+
}
|
|
37
|
+
export = InviteMethods;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const Endpoints_1 = __importDefault(require("../Endpoints"));
|
|
6
|
+
/**
|
|
7
|
+
* Methods for interacting with invites
|
|
8
|
+
*/
|
|
9
|
+
class InviteMethods {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new Invite Method Handler
|
|
12
|
+
*
|
|
13
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
14
|
+
*
|
|
15
|
+
* You can access the methods listed via `client.invite.method`, where `client` is an initialized SnowTransfer instance
|
|
16
|
+
* @param requestHandler request handler that calls the rest api
|
|
17
|
+
*/
|
|
18
|
+
constructor(requestHandler) {
|
|
19
|
+
this.requestHandler = requestHandler;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the invite data on an invite id
|
|
23
|
+
* @param inviteId Id of the invite
|
|
24
|
+
* @param withCounts When set to true you get an invite object with additional `approximate_presence_count` and `approximate_member_count` fields
|
|
25
|
+
* @returns [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
|
|
26
|
+
*/
|
|
27
|
+
async getInvite(inviteId, options) {
|
|
28
|
+
return this.requestHandler.request(Endpoints_1.default.INVITE(inviteId), "get", "json", options);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Delete an invite
|
|
32
|
+
* @param inviteId
|
|
33
|
+
* @returns [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
|
|
34
|
+
*
|
|
35
|
+
* | Permissions needed | Condition |
|
|
36
|
+
* |--------------------|-----------------------------------------------|
|
|
37
|
+
* | MANAGE_CHANNELS | for invite that belongs to a specific channel |
|
|
38
|
+
* | MANAGE_GUILD | delete any invite guild wide |
|
|
39
|
+
*/
|
|
40
|
+
async deleteInvite(inviteId) {
|
|
41
|
+
return this.requestHandler.request(Endpoints_1.default.INVITE(inviteId), "delete", "json");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
module.exports = InviteMethods;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for interacting with Stage instances
|
|
3
|
+
*/
|
|
4
|
+
declare class StageInstanceMethods {
|
|
5
|
+
requestHandler: import("../RequestHandler");
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Stage Instance Method Handler
|
|
8
|
+
*
|
|
9
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
10
|
+
*
|
|
11
|
+
* You can access the methods listed via `client.stageInstance.method`, where `client` is an initialized SnowTransfer instance
|
|
12
|
+
* @param requestHandler request handler that calls the rest api
|
|
13
|
+
*/
|
|
14
|
+
constructor(requestHandler: import("../RequestHandler"));
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new stage instance associated to a stage channel
|
|
17
|
+
* @param data The options for creating a stage instance
|
|
18
|
+
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
19
|
+
*
|
|
20
|
+
* | Permissions needed | Condition |
|
|
21
|
+
* |--------------------|-----------|
|
|
22
|
+
* | MANAGE_CHANNELS | always |
|
|
23
|
+
* | MUTE_MEMBERS | always |
|
|
24
|
+
* | MOVE_MEMBERS | always |
|
|
25
|
+
*/
|
|
26
|
+
createStageInstance(data: {
|
|
27
|
+
channel_id: string;
|
|
28
|
+
topic: string;
|
|
29
|
+
}): Promise<import("discord-typings").StageInstanceData>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the stage instance assocuated to a stage channel if it exists
|
|
32
|
+
* @param channelId Id of the stage channel
|
|
33
|
+
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
34
|
+
*/
|
|
35
|
+
getStageInstance(channelId: string): Promise<import("discord-typings").StageInstanceData>;
|
|
36
|
+
/**
|
|
37
|
+
* Updates an existing stage instance
|
|
38
|
+
* @param channelId Id of the stage channel
|
|
39
|
+
* @param data The new data to send
|
|
40
|
+
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
41
|
+
*
|
|
42
|
+
* | Permissions needed | Condition |
|
|
43
|
+
* |--------------------|-----------|
|
|
44
|
+
* | MANAGE_CHANNELS | always |
|
|
45
|
+
* | MUTE_MEMBERS | always |
|
|
46
|
+
* | MOVE_MEMBERS | always |
|
|
47
|
+
*/
|
|
48
|
+
editStageInstance(channelId: string, data: {
|
|
49
|
+
topic: string;
|
|
50
|
+
}): Promise<import("discord-typings").StageInstanceData>;
|
|
51
|
+
/**
|
|
52
|
+
* Delete an existing stage instance
|
|
53
|
+
* @param channelId Id of the stage channel
|
|
54
|
+
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
55
|
+
*
|
|
56
|
+
* | Permissions needed | Condition |
|
|
57
|
+
* |--------------------|-----------|
|
|
58
|
+
* | MANAGE_CHANNELS | always |
|
|
59
|
+
* | MUTE_MEMBERS | always |
|
|
60
|
+
* | MOVE_MEMBERS | always |
|
|
61
|
+
*/
|
|
62
|
+
deleteStageInstance(channelId: string): Promise<import("discord-typings").StageInstanceData>;
|
|
63
|
+
}
|
|
64
|
+
export = StageInstanceMethods;
|