snowtransfer 0.18.0 → 0.19.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/CHANGELOG.md +33 -0
- package/dist/Constants.d.ts +59 -0
- package/dist/Constants.js +123 -0
- package/dist/Endpoints.d.ts +120 -0
- package/dist/Endpoints.js +121 -0
- package/dist/RequestHandler.d.ts +258 -0
- package/dist/RequestHandler.js +629 -0
- package/dist/SnowTransfer.d.ts +70 -0
- package/dist/SnowTransfer.js +105 -0
- package/dist/StateMachine.d.ts +104 -0
- package/dist/StateMachine.js +238 -0
- package/dist/StateMachineGraph.d.ts +3 -0
- package/dist/StateMachineGraph.js +23 -0
- package/dist/Types.d.ts +76 -0
- package/dist/Types.js +2 -0
- package/dist/index.d.ts +25 -718
- package/dist/index.js +63 -44
- package/dist/methods/Assets.d.ts +290 -0
- package/dist/methods/Assets.js +326 -0
- package/dist/methods/AuditLog.d.ts +40 -0
- package/dist/methods/AuditLog.js +44 -0
- package/dist/methods/AutoModeration.d.ts +122 -0
- package/dist/methods/AutoModeration.js +135 -0
- package/dist/methods/Bot.d.ts +65 -0
- package/dist/methods/Bot.js +75 -0
- package/dist/methods/Channel.d.ts +866 -0
- package/dist/methods/Channel.js +982 -0
- package/dist/methods/Entitlements.d.ts +87 -0
- package/dist/methods/Entitlements.js +99 -0
- package/dist/methods/Guild.d.ts +722 -0
- package/dist/methods/Guild.js +785 -0
- package/dist/methods/GuildScheduledEvent.d.ts +138 -0
- package/dist/methods/GuildScheduledEvent.js +155 -0
- package/dist/methods/GuildTemplate.d.ts +110 -0
- package/dist/methods/GuildTemplate.js +124 -0
- package/dist/methods/Interaction.d.ts +339 -0
- package/dist/methods/Interaction.js +359 -0
- package/dist/methods/Invite.d.ts +81 -0
- package/dist/methods/Invite.js +107 -0
- package/dist/methods/Sku.d.ts +58 -0
- package/dist/methods/Sku.js +66 -0
- package/dist/methods/StageInstance.d.ts +86 -0
- package/dist/methods/StageInstance.js +97 -0
- package/dist/methods/User.d.ts +167 -0
- package/dist/methods/User.js +184 -0
- package/dist/methods/Voice.d.ts +44 -0
- package/dist/methods/Voice.js +52 -0
- package/dist/methods/Webhook.d.ts +265 -0
- package/dist/methods/Webhook.js +256 -0
- package/dist/tokenless.d.ts +19 -0
- package/dist/tokenless.js +31 -0
- package/package.json +9 -9
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { RequestHandler } from "../RequestHandler";
|
|
2
|
+
import type { RESTGetAPIGatewayBotResult, RESTGetAPIGatewayResult, APIApplication, RESTPatchCurrentApplicationJSONBody } from "discord-api-types/v10";
|
|
3
|
+
/**
|
|
4
|
+
* Methods for interacting with bot specific endpoints
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*/
|
|
7
|
+
declare class BotMethods {
|
|
8
|
+
readonly requestHandler: RequestHandler;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new Bot Method Handler
|
|
11
|
+
*
|
|
12
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
13
|
+
*
|
|
14
|
+
* You can access the methods listed via `client.bot.method`, where `client` is an initialized SnowTransfer instance
|
|
15
|
+
* @param requestHandler request handler that calls the rest api
|
|
16
|
+
*/
|
|
17
|
+
constructor(requestHandler: RequestHandler);
|
|
18
|
+
/**
|
|
19
|
+
* Get the gateway url to connect to
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
* @returns [Gateway data](https://discord.com/developers/docs/topics/gateway#get-gateway-example-response)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const client = new SnowTransfer("TOKEN")
|
|
25
|
+
* const result = await client.bot.getGateway()
|
|
26
|
+
* // result should be something like { url: "wss://gateway.discord.gg" }
|
|
27
|
+
*/
|
|
28
|
+
getGateway(): Promise<RESTGetAPIGatewayResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the gateway url to connect to and a recommended amount of shards to use
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
* @returns [Gateway data](https://discord.com/developers/docs/topics/gateway#get-gateway-example-response)
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const client = new SnowTransfer("TOKEN")
|
|
36
|
+
* const result = await client.bot.getGatewayBot()
|
|
37
|
+
* // result should be something like { url: "wss://gateway.discord.gg", shards: 1, session_start_limit: { total: 1000, remaining: 999, reset_after: 14400000, max_concurrency: 1 } }
|
|
38
|
+
*/
|
|
39
|
+
getGatewayBot(): Promise<RESTGetAPIGatewayBotResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the Application Object for the Current User
|
|
42
|
+
* @since 0.11.0
|
|
43
|
+
* @returns An [Application object](https://discord.com/developers/docs/resources/application#application-object-application-structure)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const client = new SnowTransfer("TOKEN")
|
|
47
|
+
* const result = await client.bot.getApplicationInfo()
|
|
48
|
+
*/
|
|
49
|
+
getApplicationInfo(): Promise<APIApplication>;
|
|
50
|
+
/**
|
|
51
|
+
* Update the Application Object for the Current User
|
|
52
|
+
* @since 0.18.0
|
|
53
|
+
* @returns An [Application object](https://discord.com/developers/docs/resources/application#application-object-application-structure)
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const client = new SnowTransfer("TOKEN")
|
|
57
|
+
* const appData = {
|
|
58
|
+
* description: "My new bot description",
|
|
59
|
+
* interactions_endpoint_url: "https://mycoolbot.example/api/interactions"
|
|
60
|
+
* };
|
|
61
|
+
* client.bot.editApplicationInfo(appData)
|
|
62
|
+
*/
|
|
63
|
+
editApplicationInfo(data: RESTPatchCurrentApplicationJSONBody): Promise<APIApplication>;
|
|
64
|
+
}
|
|
65
|
+
export = BotMethods;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Endpoints = require("../Endpoints");
|
|
3
|
+
/**
|
|
4
|
+
* Methods for interacting with bot specific endpoints
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*/
|
|
7
|
+
class BotMethods {
|
|
8
|
+
requestHandler;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new Bot Method Handler
|
|
11
|
+
*
|
|
12
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
13
|
+
*
|
|
14
|
+
* You can access the methods listed via `client.bot.method`, where `client` is an initialized SnowTransfer instance
|
|
15
|
+
* @param requestHandler request handler that calls the rest api
|
|
16
|
+
*/
|
|
17
|
+
constructor(requestHandler) {
|
|
18
|
+
this.requestHandler = requestHandler;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the gateway url to connect to
|
|
22
|
+
* @since 0.1.0
|
|
23
|
+
* @returns [Gateway data](https://discord.com/developers/docs/topics/gateway#get-gateway-example-response)
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const client = new SnowTransfer("TOKEN")
|
|
27
|
+
* const result = await client.bot.getGateway()
|
|
28
|
+
* // result should be something like { url: "wss://gateway.discord.gg" }
|
|
29
|
+
*/
|
|
30
|
+
async getGateway() {
|
|
31
|
+
return this.requestHandler.request(Endpoints.GATEWAY, {}, "get", "json");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the gateway url to connect to and a recommended amount of shards to use
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
* @returns [Gateway data](https://discord.com/developers/docs/topics/gateway#get-gateway-example-response)
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const client = new SnowTransfer("TOKEN")
|
|
40
|
+
* const result = await client.bot.getGatewayBot()
|
|
41
|
+
* // result should be something like { url: "wss://gateway.discord.gg", shards: 1, session_start_limit: { total: 1000, remaining: 999, reset_after: 14400000, max_concurrency: 1 } }
|
|
42
|
+
*/
|
|
43
|
+
async getGatewayBot() {
|
|
44
|
+
return this.requestHandler.request(Endpoints.GATEWAY_BOT, {}, "get", "json");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the Application Object for the Current User
|
|
48
|
+
* @since 0.11.0
|
|
49
|
+
* @returns An [Application object](https://discord.com/developers/docs/resources/application#application-object-application-structure)
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const client = new SnowTransfer("TOKEN")
|
|
53
|
+
* const result = await client.bot.getApplicationInfo()
|
|
54
|
+
*/
|
|
55
|
+
async getApplicationInfo() {
|
|
56
|
+
return this.requestHandler.request(Endpoints.OAUTH2_APPLICATION("@me"), {}, "get", "json");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Update the Application Object for the Current User
|
|
60
|
+
* @since 0.18.0
|
|
61
|
+
* @returns An [Application object](https://discord.com/developers/docs/resources/application#application-object-application-structure)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const client = new SnowTransfer("TOKEN")
|
|
65
|
+
* const appData = {
|
|
66
|
+
* description: "My new bot description",
|
|
67
|
+
* interactions_endpoint_url: "https://mycoolbot.example/api/interactions"
|
|
68
|
+
* };
|
|
69
|
+
* client.bot.editApplicationInfo(appData)
|
|
70
|
+
*/
|
|
71
|
+
async editApplicationInfo(data) {
|
|
72
|
+
return this.requestHandler.request(Endpoints.OAUTH2_APPLICATION("@me"), {}, "patch", "json", data);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
module.exports = BotMethods;
|