seyfert 2.0.0 → 2.1.1-dev-11310514874.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/lib/api/Router.d.ts +2 -2
- package/lib/api/Router.js +2 -1
- package/lib/api/Routes/applications.d.ts +29 -30
- package/lib/api/Routes/cdn.d.ts +6 -1
- package/lib/api/Routes/channels.d.ts +44 -45
- package/lib/api/Routes/gateway.d.ts +3 -4
- package/lib/api/Routes/guilds.d.ts +81 -80
- package/lib/api/Routes/index.d.ts +3 -1
- package/lib/api/Routes/interactions.d.ts +9 -3
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +10 -0
- package/lib/api/Routes/skus.js +2 -0
- package/lib/api/Routes/soundboard.d.ts +23 -0
- package/lib/api/Routes/soundboard.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +5 -6
- package/lib/api/Routes/stickers.d.ts +3 -4
- package/lib/api/Routes/users.d.ts +11 -12
- package/lib/api/Routes/voice.d.ts +2 -3
- package/lib/api/Routes/webhooks.d.ts +16 -15
- package/lib/api/api.d.ts +17 -11
- package/lib/api/api.js +26 -22
- package/lib/api/shared.d.ts +2 -2
- package/lib/api/utils/constants.d.ts +3 -1
- package/lib/api/utils/constants.js +3 -2
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +3 -3
- package/lib/builders/Attachment.js +13 -13
- package/lib/builders/Button.d.ts +1 -1
- package/lib/builders/Button.js +1 -1
- package/lib/builders/Embed.d.ts +1 -1
- package/lib/builders/Embed.js +2 -2
- package/lib/builders/Modal.d.ts +1 -1
- package/lib/builders/Poll.d.ts +1 -1
- package/lib/builders/Poll.js +1 -1
- package/lib/builders/SelectMenu.d.ts +1 -1
- package/lib/builders/SelectMenu.js +1 -1
- package/lib/builders/types.d.ts +2 -1
- package/lib/cache/adapters/default.js +5 -3
- package/lib/cache/adapters/limited.d.ts +1 -2
- package/lib/cache/adapters/limited.js +34 -30
- package/lib/cache/adapters/workeradapter.js +3 -1
- package/lib/cache/index.d.ts +12 -12
- package/lib/cache/index.js +48 -39
- package/lib/cache/resources/bans.d.ts +2 -2
- package/lib/cache/resources/bans.js +1 -1
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -2
- package/lib/cache/resources/emojis.d.ts +2 -2
- package/lib/cache/resources/emojis.js +1 -1
- package/lib/cache/resources/guilds.d.ts +2 -2
- package/lib/cache/resources/guilds.js +7 -11
- package/lib/cache/resources/members.d.ts +2 -2
- package/lib/cache/resources/members.js +1 -1
- package/lib/cache/resources/messages.d.ts +2 -2
- package/lib/cache/resources/messages.js +3 -3
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/roles.d.ts +2 -2
- package/lib/cache/resources/roles.js +1 -1
- package/lib/cache/resources/stickers.d.ts +2 -2
- package/lib/cache/resources/stickers.js +1 -1
- package/lib/cache/resources/users.d.ts +2 -2
- package/lib/cache/resources/users.js +1 -1
- package/lib/cache/resources/voice-states.d.ts +2 -2
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/client/base.d.ts +10 -15
- package/lib/client/base.js +48 -44
- package/lib/client/client.d.ts +4 -4
- package/lib/client/client.js +37 -38
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/httpclient.js +2 -2
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +13 -13
- package/lib/client/workerclient.js +182 -65
- package/lib/collection.d.ts +3 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +5 -6
- package/lib/commands/applications/chatcontext.d.ts +6 -6
- package/lib/commands/applications/chatcontext.js +16 -8
- package/lib/commands/applications/entryPoint.d.ts +46 -0
- package/lib/commands/applications/entryPoint.js +56 -0
- package/lib/commands/applications/entrycontext.d.ts +40 -0
- package/lib/commands/applications/entrycontext.js +85 -0
- package/lib/commands/applications/menu.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +5 -5
- package/lib/commands/applications/menucontext.js +6 -6
- package/lib/commands/applications/options.d.ts +7 -6
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +20 -26
- package/lib/commands/decorators.js +8 -4
- package/lib/commands/handle.d.ts +13 -12
- package/lib/commands/handle.js +133 -65
- package/lib/commands/handler.d.ts +9 -7
- package/lib/commands/handler.js +27 -18
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js +2 -0
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +4 -4
- package/lib/common/bot/watcher.d.ts +1 -1
- package/lib/common/it/formatter.d.ts +21 -21
- package/lib/common/it/formatter.js +40 -41
- package/lib/common/it/logger.js +1 -1
- package/lib/common/it/utils.d.ts +14 -6
- package/lib/common/it/utils.js +62 -27
- package/lib/common/shorters/application.d.ts +2 -3
- package/lib/common/shorters/application.js +3 -3
- package/lib/common/shorters/bans.js +1 -1
- package/lib/common/shorters/channels.d.ts +3 -3
- package/lib/common/shorters/channels.js +3 -3
- package/lib/common/shorters/emojis.js +4 -4
- package/lib/common/shorters/guilds.d.ts +3 -3
- package/lib/common/shorters/guilds.js +5 -9
- package/lib/common/shorters/interaction.d.ts +3 -3
- package/lib/common/shorters/interaction.js +6 -5
- package/lib/common/shorters/members.d.ts +4 -5
- package/lib/common/shorters/members.js +6 -7
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +4 -4
- package/lib/common/shorters/reactions.d.ts +1 -1
- package/lib/common/shorters/reactions.js +1 -1
- package/lib/common/shorters/roles.js +1 -1
- package/lib/common/shorters/templates.js +2 -2
- package/lib/common/shorters/threads.d.ts +1 -1
- package/lib/common/shorters/threads.js +17 -11
- package/lib/common/shorters/webhook.d.ts +1 -1
- package/lib/common/shorters/webhook.js +4 -4
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +1 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +3 -3
- package/lib/components/BaseComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +1 -1
- package/lib/components/componentcontext.d.ts +4 -4
- package/lib/components/componentcontext.js +1 -1
- package/lib/components/handler.d.ts +10 -8
- package/lib/components/handler.js +16 -13
- package/lib/components/index.js +2 -1
- package/lib/components/modalcontext.d.ts +2 -2
- package/lib/components/modalcontext.js +1 -1
- package/lib/deps/mixer.d.ts +1 -1
- package/lib/deps/mixer.js +6 -1
- package/lib/events/handler.d.ts +5 -5
- package/lib/events/handler.js +69 -19
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.js +1 -1
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/custom.d.ts +1 -0
- package/lib/events/hooks/custom.js +5 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -5
- package/lib/events/hooks/entitlement.js +4 -4
- package/lib/events/hooks/guild.d.ts +3 -3
- package/lib/events/hooks/guild.js +1 -1
- package/lib/events/hooks/index.d.ts +1 -0
- package/lib/events/hooks/index.js +1 -0
- package/lib/events/hooks/integration.d.ts +1 -1
- package/lib/events/hooks/integration.js +1 -1
- package/lib/events/hooks/interactions.d.ts +3 -3
- package/lib/events/hooks/invite.d.ts +1 -1
- package/lib/events/hooks/message.d.ts +3 -3
- package/lib/events/hooks/message.js +1 -1
- package/lib/events/hooks/presence.d.ts +2 -2
- package/lib/events/hooks/soundboard.d.ts +155 -0
- package/lib/events/hooks/soundboard.js +28 -0
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/subscriptions.d.ts +35 -0
- package/lib/events/hooks/subscriptions.js +16 -0
- package/lib/events/hooks/thread.d.ts +2 -2
- package/lib/events/hooks/thread.js +2 -2
- package/lib/events/hooks/typing.d.ts +1 -1
- package/lib/events/hooks/typing.js +1 -1
- package/lib/events/hooks/user.d.ts +2 -2
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/voice.js +1 -1
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -5
- package/lib/langs/handler.d.ts +2 -2
- package/lib/structures/Guild.d.ts +7 -4
- package/lib/structures/Guild.js +1 -1
- package/lib/structures/GuildBan.d.ts +1 -1
- package/lib/structures/GuildMember.d.ts +7 -5
- package/lib/structures/GuildMember.js +5 -3
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildTemplate.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +39 -16
- package/lib/structures/Interaction.js +82 -26
- package/lib/structures/Message.d.ts +4 -10
- package/lib/structures/Message.js +5 -8
- package/lib/structures/Poll.d.ts +3 -3
- package/lib/structures/Sticker.d.ts +2 -2
- package/lib/structures/Sticker.js +1 -1
- package/lib/structures/VoiceState.d.ts +2 -1
- package/lib/structures/VoiceState.js +1 -1
- package/lib/structures/Webhook.d.ts +3 -3
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/channels.js +8 -7
- package/lib/structures/extra/BaseGuild.d.ts +11 -1
- package/lib/structures/extra/BaseGuild.js +27 -0
- package/lib/structures/extra/BitField.d.ts +3 -3
- package/lib/structures/extra/BitField.js +34 -33
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -0
- package/lib/structures/extra/Permissions.js +21 -0
- package/lib/types/gateway.d.ts +71 -6
- package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
- package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
- package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/_interactions/responses.d.ts +74 -2
- package/lib/types/payloads/_interactions/responses.js +4 -0
- package/lib/types/payloads/channel.d.ts +46 -6
- package/lib/types/payloads/channel.js +5 -1
- package/lib/types/payloads/guild.d.ts +9 -1
- package/lib/types/payloads/guild.js +8 -0
- package/lib/types/payloads/index.d.ts +1 -0
- package/lib/types/payloads/index.js +1 -0
- package/lib/types/payloads/monetization.d.ts +29 -1
- package/lib/types/payloads/monetization.js +10 -1
- package/lib/types/payloads/soundboard.d.ts +23 -0
- package/lib/types/payloads/soundboard.js +5 -0
- package/lib/types/payloads/user.js +0 -1
- package/lib/types/rest/application.d.ts +3 -3
- package/lib/types/rest/auditLog.d.ts +1 -1
- package/lib/types/rest/channel.d.ts +5 -18
- package/lib/types/rest/guild.d.ts +2 -2
- package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
- package/lib/types/rest/index.d.ts +1 -0
- package/lib/types/rest/index.js +1 -0
- package/lib/types/rest/interactions.d.ts +30 -8
- package/lib/types/rest/monetization.d.ts +22 -1
- package/lib/types/rest/oauth2.d.ts +1 -1
- package/lib/types/rest/poll.d.ts +1 -1
- package/lib/types/rest/soundboard.d.ts +64 -0
- package/lib/types/rest/soundboard.js +2 -0
- package/lib/types/rest/stageInstance.d.ts +1 -1
- package/lib/types/rest/template.d.ts +1 -1
- package/lib/types/rest/user.d.ts +1 -1
- package/lib/types/rest/webhook.d.ts +3 -3
- package/lib/types/utils/index.d.ts +27 -7
- package/lib/types/utils/index.js +25 -6
- package/lib/websocket/SharedTypes.d.ts +18 -3
- package/lib/websocket/constants/index.d.ts +3 -2
- package/lib/websocket/constants/index.js +4 -4
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +4 -3
- package/lib/websocket/discord/shard.js +47 -24
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +92 -17
- package/lib/websocket/discord/shared.d.ts +12 -3
- package/lib/websocket/discord/socket/custom.d.ts +1 -1
- package/lib/websocket/discord/socket/custom.js +70 -40
- package/lib/websocket/discord/worker.d.ts +9 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -16
- package/lib/websocket/discord/workermanager.js +170 -46
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -65
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseGuild = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
4
5
|
const types_1 = require("../../types");
|
|
5
6
|
const DiscordBase_1 = require("./DiscordBase");
|
|
6
7
|
/**
|
|
@@ -64,6 +65,32 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
64
65
|
}
|
|
65
66
|
return this.rest.cdn.banners(this.id).get(this.banner, options);
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Shard ID of the guild.
|
|
70
|
+
* @returns Shard ID or -1 if the client is not gateway based.
|
|
71
|
+
*/
|
|
72
|
+
get shardId() {
|
|
73
|
+
if ('gateway' in this.client) {
|
|
74
|
+
return this.client.gateway.calculateShardId(this.id);
|
|
75
|
+
}
|
|
76
|
+
if ('shards' in this.client) {
|
|
77
|
+
return (0, common_1.calculateShardId)(this.id, this.client.workerData.totalShards);
|
|
78
|
+
}
|
|
79
|
+
return -1;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Shard of the guild.
|
|
83
|
+
* @returns Shard or undefined, if the client is not gateway based always undefined.
|
|
84
|
+
*/
|
|
85
|
+
get shard() {
|
|
86
|
+
if ('gateway' in this.client) {
|
|
87
|
+
return this.client.gateway.get(this.shardId);
|
|
88
|
+
}
|
|
89
|
+
if ('shards' in this.client) {
|
|
90
|
+
return this.client.shards.get(this.shardId);
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
67
94
|
toString() {
|
|
68
95
|
return this.name;
|
|
69
96
|
}
|
|
@@ -6,12 +6,12 @@ export declare class BitField<T extends object> {
|
|
|
6
6
|
constructor(bitfields?: BitFieldResolvable<T>);
|
|
7
7
|
set bits(bits: BitFieldResolvable<T>);
|
|
8
8
|
get bits(): bigint;
|
|
9
|
-
add(...bits: BitFieldResolvable<T>[]): bigint;
|
|
10
|
-
remove(...bits: BitFieldResolvable<T>[]): bigint;
|
|
11
9
|
has(...bits: BitFieldResolvable<T>[]): boolean;
|
|
12
10
|
missings(...bits: BitFieldResolvable<T>[]): bigint[];
|
|
13
11
|
equals(other: BitFieldResolvable<T>): boolean;
|
|
14
|
-
resolve(bits?: BitFieldResolvable<T>): bigint;
|
|
15
12
|
keys(bits?: BitFieldResolvable<T>[]): string[];
|
|
16
13
|
values(bits?: BitFieldResolvable<T>[]): bigint[];
|
|
14
|
+
add(...bits: (BitFieldResolvable<T> | undefined)[]): bigint;
|
|
15
|
+
remove(...bits: BitFieldResolvable<T>[]): bigint;
|
|
16
|
+
resolve(bits: BitFieldResolvable<T>): bigint;
|
|
17
17
|
}
|
|
@@ -15,20 +15,6 @@ class BitField {
|
|
|
15
15
|
get bits() {
|
|
16
16
|
return this.bit;
|
|
17
17
|
}
|
|
18
|
-
add(...bits) {
|
|
19
|
-
let reduced = BitField.None;
|
|
20
|
-
for (const bit of bits) {
|
|
21
|
-
reduced |= this.resolve(bit);
|
|
22
|
-
}
|
|
23
|
-
return (this.bit |= reduced);
|
|
24
|
-
}
|
|
25
|
-
remove(...bits) {
|
|
26
|
-
let reduced = BitField.None;
|
|
27
|
-
for (const bit of bits) {
|
|
28
|
-
reduced |= this.resolve(bit);
|
|
29
|
-
}
|
|
30
|
-
return (this.bit &= ~reduced);
|
|
31
|
-
}
|
|
32
18
|
has(...bits) {
|
|
33
19
|
const bitsResolved = bits.map(bit => this.resolve(bit));
|
|
34
20
|
return bitsResolved.every(bit => (this.bits & bit) === bit);
|
|
@@ -40,25 +26,8 @@ class BitField {
|
|
|
40
26
|
equals(other) {
|
|
41
27
|
return this.bits === this.resolve(other);
|
|
42
28
|
}
|
|
43
|
-
resolve(bits) {
|
|
44
|
-
switch (typeof bits) {
|
|
45
|
-
case 'number':
|
|
46
|
-
return BigInt(bits);
|
|
47
|
-
case 'string':
|
|
48
|
-
return this.resolve(this.Flags[bits]);
|
|
49
|
-
case 'bigint':
|
|
50
|
-
return bits;
|
|
51
|
-
case 'object':
|
|
52
|
-
if (!Array.isArray(bits)) {
|
|
53
|
-
throw new TypeError(`Cannot resolve permission: ${bits}`);
|
|
54
|
-
}
|
|
55
|
-
return bits.map(x => this.resolve(x)).reduce((acc, cur) => acc | cur, BitField.None);
|
|
56
|
-
default:
|
|
57
|
-
throw new TypeError(`Cannot resolve permission: ${typeof bits === 'symbol' ? String(bits) : bits}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
29
|
keys(bits = [this.bits]) {
|
|
61
|
-
const bitsResolved = bits.map(bit =>
|
|
30
|
+
const bitsResolved = bits.map(bit => this.resolve(bit));
|
|
62
31
|
return Object.entries(this.Flags).reduce((acc, value) => {
|
|
63
32
|
if (bitsResolved.some(bit => (bit & value[1]) === value[1])) {
|
|
64
33
|
acc.push(value[0]);
|
|
@@ -68,7 +37,7 @@ class BitField {
|
|
|
68
37
|
}, []);
|
|
69
38
|
}
|
|
70
39
|
values(bits = [this.bits]) {
|
|
71
|
-
const bitsResolved = bits.map(bit =>
|
|
40
|
+
const bitsResolved = bits.map(bit => this.resolve(bit));
|
|
72
41
|
return Object.entries(this.Flags).reduce((acc, value) => {
|
|
73
42
|
if (bitsResolved.some(bit => (bit & value[1]) === value[1])) {
|
|
74
43
|
acc.push(value[1]);
|
|
@@ -77,5 +46,37 @@ class BitField {
|
|
|
77
46
|
return acc;
|
|
78
47
|
}, []);
|
|
79
48
|
}
|
|
49
|
+
add(...bits) {
|
|
50
|
+
for (const bit of bits) {
|
|
51
|
+
if (!bit)
|
|
52
|
+
continue;
|
|
53
|
+
this.bits |= this.resolve(bit);
|
|
54
|
+
}
|
|
55
|
+
return this.bits;
|
|
56
|
+
}
|
|
57
|
+
remove(...bits) {
|
|
58
|
+
for (const bit of bits) {
|
|
59
|
+
this.bits &= ~this.resolve(bit);
|
|
60
|
+
}
|
|
61
|
+
return this.bits;
|
|
62
|
+
}
|
|
63
|
+
resolve(bits) {
|
|
64
|
+
switch (typeof bits) {
|
|
65
|
+
case 'string':
|
|
66
|
+
return this.resolve(this.Flags[bits]);
|
|
67
|
+
case 'number':
|
|
68
|
+
return BigInt(bits);
|
|
69
|
+
case 'bigint':
|
|
70
|
+
return bits;
|
|
71
|
+
case 'object': {
|
|
72
|
+
if (!Array.isArray(bits)) {
|
|
73
|
+
throw new TypeError(`Cannot resolve permission: ${bits}`);
|
|
74
|
+
}
|
|
75
|
+
return bits.map(x => this.resolve(x)).reduce((acc, cur) => acc | cur, BitField.None);
|
|
76
|
+
}
|
|
77
|
+
default:
|
|
78
|
+
throw new TypeError(`Cannot resolve permission: ${typeof bits === 'symbol' ? String(bits) : bits}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
80
81
|
}
|
|
81
82
|
exports.BitField = BitField;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DiscordBase = void 0;
|
|
4
|
-
const Base_1 = require("./Base");
|
|
5
4
|
const utils_1 = require("../../common/it/utils");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
6
|
class DiscordBase extends Base_1.Base {
|
|
7
7
|
id;
|
|
8
8
|
constructor(client,
|
|
@@ -59,4 +59,6 @@ export declare class PermissionsBitField extends BitField<typeof PermissionFlags
|
|
|
59
59
|
keys: (bits?: BitFieldResolvable<typeof PermissionFlagsBits>[]) => PermissionStrings;
|
|
60
60
|
has(...bits: BitFieldResolvable<typeof PermissionFlagsBits>[]): boolean;
|
|
61
61
|
strictHas(...bits: BitFieldResolvable<typeof PermissionFlagsBits>[]): boolean;
|
|
62
|
+
resolve<T extends typeof PermissionFlagsBits>(bits: BitFieldResolvable<T>): bigint;
|
|
63
|
+
static resolve<T extends typeof PermissionFlagsBits>(bits: BitFieldResolvable<T>): bigint;
|
|
62
64
|
}
|
|
@@ -17,5 +17,26 @@ class PermissionsBitField extends BitField_1.BitField {
|
|
|
17
17
|
strictHas(...bits) {
|
|
18
18
|
return super.has(...bits);
|
|
19
19
|
}
|
|
20
|
+
resolve(bits) {
|
|
21
|
+
return PermissionsBitField.resolve(bits);
|
|
22
|
+
}
|
|
23
|
+
static resolve(bits) {
|
|
24
|
+
switch (typeof bits) {
|
|
25
|
+
case 'string':
|
|
26
|
+
return PermissionsBitField.resolve(types_1.PermissionFlagsBits[bits]);
|
|
27
|
+
case 'number':
|
|
28
|
+
return BigInt(bits);
|
|
29
|
+
case 'bigint':
|
|
30
|
+
return bits;
|
|
31
|
+
case 'object': {
|
|
32
|
+
if (!Array.isArray(bits)) {
|
|
33
|
+
throw new TypeError(`Cannot resolve permission: ${bits}`);
|
|
34
|
+
}
|
|
35
|
+
return bits.map(x => PermissionsBitField.resolve(x)).reduce((acc, cur) => acc | cur, BitField_1.BitField.None);
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
throw new TypeError(`Cannot resolve permission: ${typeof bits === 'symbol' ? String(bits) : bits}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
20
41
|
}
|
|
21
42
|
exports.PermissionsBitField = PermissionsBitField;
|
package/lib/types/gateway.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChannelType, GatewayDispatchEvents, GatewayOpcodes, Snowflake } from './index';
|
|
2
2
|
import type { GatewayPresenceUpdate } from './payloads/gateway';
|
|
3
|
-
import type { APIApplication, APIApplicationCommandPermission,
|
|
3
|
+
import type { APIApplication, APIApplicationCommandPermission, APIAuditLogEntry, APIAutoModerationAction, APIAutoModerationRule, APIChannel, APIEmoji, APIEntitlement, APIGuild, APIGuildIntegration, APIGuildMember, APIGuildScheduledEvent, APIInteraction, APIMessage, APIPartialEmoji, APIRole, APIStageInstance, APISticker, APISubscription, APIThreadChannel, APIThreadMember, APIUnavailableGuild, APIUser, APIVoiceState, AutoModerationRuleTriggerType, GatewayActivity, InviteTargetType, PresenceUpdateStatus, GatewayPresenceUpdate as RawGatewayPresenceUpdate, GatewayThreadListSync as RawGatewayThreadListSync, GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate } from './payloads/index';
|
|
4
|
+
import type { APISoundBoard } from './payloads/soundboard';
|
|
4
5
|
import type { ReactionType } from './rest/index';
|
|
5
6
|
import type { AnimationTypes, Nullable } from './utils';
|
|
6
7
|
/**
|
|
@@ -14,9 +15,9 @@ export interface GatewayURLQuery {
|
|
|
14
15
|
/**
|
|
15
16
|
* Types extracted from https://discord.com/developers/docs/topics/gateway
|
|
16
17
|
*/
|
|
17
|
-
export type GatewaySendPayload = GatewayHeartbeat | GatewayIdentify | GatewayRequestGuildMembers | GatewayResume | GatewayUpdatePresence | GatewayVoiceStateUpdate;
|
|
18
|
+
export type GatewaySendPayload = GatewayHeartbeat | GatewayIdentify | GatewayRequestGuildMembers | GatewayResume | GatewayUpdatePresence | GatewayVoiceStateUpdate | GatewayRequestSoundboardSounds;
|
|
18
19
|
export type GatewayReceivePayload = GatewayDispatchPayload | GatewayHeartbeatAck | GatewayHeartbeatRequest | GatewayHello | GatewayInvalidSession | GatewayReconnect;
|
|
19
|
-
export type GatewayDispatchPayload = GatewayApplicationCommandPermissionsUpdateDispatch | GatewayAutoModerationActionExecutionDispatch | GatewayAutoModerationRuleCreateDispatch | GatewayAutoModerationRuleDeleteDispatch | GatewayAutoModerationRuleModifyDispatch | GatewayChannelModifyDispatch | GatewayChannelPinsUpdateDispatch | GatewayEntitlementModifyDispatch | GatewayGuildAuditLogEntryCreateDispatch | GatewayGuildBanModifyDispatch | GatewayGuildCreateDispatch | GatewayGuildDeleteDispatch | GatewayGuildEmojisUpdateDispatch | GatewayGuildIntegrationsUpdateDispatch | GatewayGuildMemberAddDispatch | GatewayGuildMemberRemoveDispatch | GatewayGuildMembersChunkDispatch | GatewayGuildMemberUpdateDispatch | GatewayGuildModifyDispatch | GatewayGuildRoleDeleteDispatch | GatewayGuildRoleModifyDispatch | GatewayGuildScheduledEventCreateDispatch | GatewayGuildScheduledEventDeleteDispatch | GatewayGuildScheduledEventUpdateDispatch | GatewayGuildScheduledEventUserAddDispatch | GatewayGuildScheduledEventUserRemoveDispatch | GatewayGuildStickersUpdateDispatch | GatewayIntegrationCreateDispatch | GatewayIntegrationDeleteDispatch | GatewayIntegrationUpdateDispatch | GatewayInteractionCreateDispatch | GatewayInviteCreateDispatch | GatewayInviteDeleteDispatch | GatewayMessageCreateDispatch | GatewayMessageDeleteBulkDispatch | GatewayMessageDeleteDispatch | GatewayMessagePollVoteAddDispatch | GatewayMessagePollVoteRemoveDispatch | GatewayMessageReactionAddDispatch | GatewayMessageReactionRemoveAllDispatch | GatewayMessageReactionRemoveDispatch | GatewayMessageReactionRemoveEmojiDispatch | GatewayMessageUpdateDispatch | GatewayPresenceUpdateDispatch | GatewayReadyDispatch | GatewayResumedDispatch | GatewayStageInstanceCreateDispatch | GatewayStageInstanceDeleteDispatch | GatewayStageInstanceUpdateDispatch | GatewayThreadCreateDispatch | GatewayThreadDeleteDispatch | GatewayThreadListSyncDispatch | GatewayThreadMembersUpdateDispatch | GatewayThreadMemberUpdateDispatch | GatewayThreadUpdateDispatch | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch;
|
|
20
|
+
export type GatewayDispatchPayload = GatewayApplicationCommandPermissionsUpdateDispatch | GatewayAutoModerationActionExecutionDispatch | GatewayAutoModerationRuleCreateDispatch | GatewayAutoModerationRuleDeleteDispatch | GatewayAutoModerationRuleModifyDispatch | GatewayChannelModifyDispatch | GatewayChannelPinsUpdateDispatch | GatewayEntitlementModifyDispatch | GatewayGuildAuditLogEntryCreateDispatch | GatewayGuildBanModifyDispatch | GatewayGuildCreateDispatch | GatewayGuildDeleteDispatch | GatewayGuildEmojisUpdateDispatch | GatewayGuildIntegrationsUpdateDispatch | GatewayGuildMemberAddDispatch | GatewayGuildMemberRemoveDispatch | GatewayGuildMembersChunkDispatch | GatewayGuildMemberUpdateDispatch | GatewayGuildModifyDispatch | GatewayGuildRoleDeleteDispatch | GatewayGuildRoleModifyDispatch | GatewayGuildScheduledEventCreateDispatch | GatewayGuildScheduledEventDeleteDispatch | GatewayGuildScheduledEventUpdateDispatch | GatewayGuildScheduledEventUserAddDispatch | GatewayGuildScheduledEventUserRemoveDispatch | GatewayGuildStickersUpdateDispatch | GatewayIntegrationCreateDispatch | GatewayIntegrationDeleteDispatch | GatewayIntegrationUpdateDispatch | GatewayInteractionCreateDispatch | GatewayInviteCreateDispatch | GatewayInviteDeleteDispatch | GatewayMessageCreateDispatch | GatewayMessageDeleteBulkDispatch | GatewayMessageDeleteDispatch | GatewayMessagePollVoteAddDispatch | GatewayMessagePollVoteRemoveDispatch | GatewayMessageReactionAddDispatch | GatewayMessageReactionRemoveAllDispatch | GatewayMessageReactionRemoveDispatch | GatewayMessageReactionRemoveEmojiDispatch | GatewayMessageUpdateDispatch | GatewayPresenceUpdateDispatch | GatewayReadyDispatch | GatewayResumedDispatch | GatewayStageInstanceCreateDispatch | GatewayStageInstanceDeleteDispatch | GatewayStageInstanceUpdateDispatch | GatewayThreadCreateDispatch | GatewayThreadDeleteDispatch | GatewayThreadListSyncDispatch | GatewayThreadMembersUpdateDispatch | GatewayThreadMemberUpdateDispatch | GatewayThreadUpdateDispatch | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch | GatewayGuildSoundboardSoundCreateDispatch | GatewayGuildSoundboardSoundDeleteDispatch | GatewayGuildSoundboardSoundUpdateDispatch | GatewayGuildSoundboardSoundsUpdateDispatch | GatewaySoundboardSoundsDispatch;
|
|
20
21
|
/**
|
|
21
22
|
* https://discord.com/developers/docs/topics/gateway-events#hello
|
|
22
23
|
*/
|
|
@@ -310,7 +311,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload<GatewayDispatchEvents
|
|
|
310
311
|
/**
|
|
311
312
|
* https://discord.com/developers/docs/topics/gateway-events#entitlement-create
|
|
312
313
|
*/
|
|
313
|
-
export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData
|
|
314
|
+
export type GatewayEntitlementCreateDispatchData = Omit<GatewayEntitlementModifyDispatchData, 'ends_at'> & {
|
|
315
|
+
ends_at: null;
|
|
316
|
+
};
|
|
314
317
|
/**
|
|
315
318
|
* https://discord.com/developers/docs/topics/gateway-events#entitlement-create
|
|
316
319
|
*/
|
|
@@ -401,7 +404,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
|
|
|
401
404
|
*
|
|
402
405
|
* See https://discord.com/developers/docs/resources/channel#channel-object
|
|
403
406
|
*/
|
|
404
|
-
threads:
|
|
407
|
+
threads: APIThreadChannel[];
|
|
405
408
|
/**
|
|
406
409
|
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
|
|
407
410
|
*
|
|
@@ -426,6 +429,14 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
|
|
|
426
429
|
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
|
|
427
430
|
*/
|
|
428
431
|
guild_scheduled_events: APIGuildScheduledEvent[];
|
|
432
|
+
/**
|
|
433
|
+
* Soundboard sounds in the guild
|
|
434
|
+
*
|
|
435
|
+
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway-events#guild-create) event**
|
|
436
|
+
*
|
|
437
|
+
* https://discord.com/developers/docs/resources/soundboard
|
|
438
|
+
*/
|
|
439
|
+
soundboard_sounds: APISoundBoard[];
|
|
429
440
|
}
|
|
430
441
|
/**
|
|
431
442
|
* https://discord.com/developers/docs/topics/gateway-events#guild-update
|
|
@@ -695,6 +706,31 @@ export interface GatewayGuildScheduledEventUserRemoveDispatchData {
|
|
|
695
706
|
user_id: Snowflake;
|
|
696
707
|
guild_id: Snowflake;
|
|
697
708
|
}
|
|
709
|
+
export type GatewayGuildSoundboardSoundCreateDispatchData = APISoundBoard;
|
|
710
|
+
export type GatewayGuildSoundboardSoundCreateDispatch = DataPayload<GatewayDispatchEvents.GuildSoundboardSoundCreate, GatewayGuildSoundboardSoundCreateDispatchData>;
|
|
711
|
+
export type GatewayGuildSoundboardSoundUpdateDispatchData = APISoundBoard;
|
|
712
|
+
export type GatewayGuildSoundboardSoundUpdateDispatch = DataPayload<GatewayDispatchEvents.GuildSoundboardSoundUpdate, GatewayGuildSoundboardSoundUpdateDispatchData>;
|
|
713
|
+
export interface GatewayGuildSoundboardSoundDeleteDispatchData {
|
|
714
|
+
/** ID of the sound that was deleted */
|
|
715
|
+
sound_id: string;
|
|
716
|
+
/** ID of the guild the sound was in */
|
|
717
|
+
guild_id: string;
|
|
718
|
+
}
|
|
719
|
+
export type GatewayGuildSoundboardSoundDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildSoundboardSoundDelete, GatewayGuildSoundboardSoundDeleteDispatchData>;
|
|
720
|
+
export interface GatewayGuildSoundboardSoundsUpdateDispatchData {
|
|
721
|
+
/** The guild's soundboard sound */
|
|
722
|
+
soundboard_sounds: APISoundBoard[];
|
|
723
|
+
/** ID of the guild */
|
|
724
|
+
guild_id: string;
|
|
725
|
+
}
|
|
726
|
+
export type GatewayGuildSoundboardSoundsUpdateDispatch = DataPayload<GatewayDispatchEvents.GuildSoundboardSoundsUpdate, GatewayGuildSoundboardSoundsUpdateDispatchData>;
|
|
727
|
+
export interface GatewaySoundboardSoundsDispatchData {
|
|
728
|
+
/** The guild's soundboard sounds */
|
|
729
|
+
soundboard_sounds: APISoundBoard[];
|
|
730
|
+
/** ID of the guild */
|
|
731
|
+
guild_id: string;
|
|
732
|
+
}
|
|
733
|
+
export type GatewaySoundboardSoundsDispatch = DataPayload<GatewayDispatchEvents.SoundboardSounds, GatewaySoundboardSoundsDispatchData>;
|
|
698
734
|
/**
|
|
699
735
|
* https://discord.com/developers/docs/topics/gateway-events#integration-create
|
|
700
736
|
*/
|
|
@@ -988,6 +1024,21 @@ export type GatewayStageInstanceUpdateDispatch = DataPayload<GatewayDispatchEven
|
|
|
988
1024
|
* https://discord.com/developers/docs/topics/gateway-events#stage-instance-update
|
|
989
1025
|
*/
|
|
990
1026
|
export type GatewayStageInstanceUpdateDispatchData = APIStageInstance;
|
|
1027
|
+
/**
|
|
1028
|
+
* https://canary.discord.com/developers/docs/topics/gateway-events#subscription-create
|
|
1029
|
+
*/
|
|
1030
|
+
export type GatewaySubscriptionCreateDispatch = DataPayload<GatewayDispatchEvents.SubscriptionCreate, GatewaySubscriptionCreateDispatchData>;
|
|
1031
|
+
export type GatewaySubscriptionCreateDispatchData = APISubscription;
|
|
1032
|
+
/**
|
|
1033
|
+
* https://canary.discord.com/developers/docs/topics/gateway-events#subscription-update
|
|
1034
|
+
*/
|
|
1035
|
+
export type GatewaySubscriptionUpdateDispatch = DataPayload<GatewayDispatchEvents.SubscriptionUpdate, GatewaySubscriptionUpdateDispatchData>;
|
|
1036
|
+
export type GatewaySubscriptionUpdateDispatchData = APISubscription;
|
|
1037
|
+
/**
|
|
1038
|
+
* https://canary.discord.com/developers/docs/topics/gateway-events#subscription-delete
|
|
1039
|
+
*/
|
|
1040
|
+
export type GatewaySubscriptionDeleteDispatch = DataPayload<GatewayDispatchEvents.SubscriptionDelete, GatewaySubscriptionDeleteDispatchData>;
|
|
1041
|
+
export type GatewaySubscriptionDeleteDispatchData = APISubscription;
|
|
991
1042
|
/**
|
|
992
1043
|
* https://discord.com/developers/docs/topics/gateway-events#thread-list-sync
|
|
993
1044
|
*/
|
|
@@ -1383,6 +1434,20 @@ export interface GatewayRequestGuildMembersDataWithQuery extends GatewayRequestG
|
|
|
1383
1434
|
* https://discord.com/developers/docs/topics/gateway-events#request-guild-members
|
|
1384
1435
|
*/
|
|
1385
1436
|
export type GatewayRequestGuildMembersData = GatewayRequestGuildMembersDataWithQuery | GatewayRequestGuildMembersDataWithUserIds;
|
|
1437
|
+
/**
|
|
1438
|
+
* https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds
|
|
1439
|
+
*/
|
|
1440
|
+
export interface GatewayRequestSoundboardSounds {
|
|
1441
|
+
op: GatewayOpcodes.RequestSoundboardSounds;
|
|
1442
|
+
d: GatewayRequestSoundboardSoundsData;
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds-request-soundboard-sounds-structure
|
|
1446
|
+
*/
|
|
1447
|
+
export interface GatewayRequestSoundboardSoundsData {
|
|
1448
|
+
/** IDs of the guilds to get soundboard sounds for */
|
|
1449
|
+
guild_ids: string[];
|
|
1450
|
+
}
|
|
1386
1451
|
/**
|
|
1387
1452
|
* https://discord.com/developers/docs/topics/gateway-events#update-voice-state
|
|
1388
1453
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { APIInteractionDataResolved } from '../../index';
|
|
2
|
-
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
|
|
2
|
+
import type { APIApplicationCommandInteractionWrapper, APIEntryPointInteractionData, ApplicationCommandType } from '../applicationCommands';
|
|
3
3
|
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
|
|
4
4
|
import type { APIApplicationCommandAttachmentOption, APIApplicationCommandInteractionDataAttachmentOption } from './_chatInput/attachment';
|
|
5
5
|
import type { APIApplicationCommandBooleanOption, APIApplicationCommandInteractionDataBooleanOption } from './_chatInput/boolean';
|
|
@@ -58,3 +58,8 @@ export type APIChatInputApplicationCommandDMInteraction = APIDMInteractionWrappe
|
|
|
58
58
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
|
59
59
|
*/
|
|
60
60
|
export type APIChatInputApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
|
61
|
+
/**
|
|
62
|
+
* Documentation goes brrrrrr
|
|
63
|
+
* @unstable
|
|
64
|
+
*/
|
|
65
|
+
export type APIEntryPointCommandInteraction = APIApplicationCommandInteractionWrapper<APIEntryPointInteractionData>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LocalizationMap, Permissions, Snowflake } from '../..';
|
|
2
|
-
import type { APIApplicationCommandOption, APIChatInputApplicationCommandDMInteraction, APIChatInputApplicationCommandGuildInteraction, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData } from './_applicationCommands/chatInput';
|
|
2
|
+
import type { APIApplicationCommandOption, APIChatInputApplicationCommandDMInteraction, APIChatInputApplicationCommandGuildInteraction, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData, APIEntryPointCommandInteraction } from './_applicationCommands/chatInput';
|
|
3
3
|
import type { APIContextMenuDMInteraction, APIContextMenuGuildInteraction, APIContextMenuInteraction, APIContextMenuInteractionData } from './_applicationCommands/contextMenu';
|
|
4
|
+
import type { APIBaseApplicationCommandInteractionData } from './_applicationCommands/internals';
|
|
4
5
|
import type { APIBaseInteraction } from './base';
|
|
5
6
|
import type { InteractionType } from './responses';
|
|
6
7
|
export * from './_applicationCommands/chatInput';
|
|
@@ -79,27 +80,55 @@ export interface APIApplicationCommand {
|
|
|
79
80
|
/**
|
|
80
81
|
* Installation context(s) where the command is available, only for globally-scoped commands. Defaults to `GUILD_INSTALL ([0])`
|
|
81
82
|
*
|
|
82
|
-
* @unstable
|
|
83
83
|
*/
|
|
84
84
|
integration_types?: ApplicationIntegrationType[];
|
|
85
85
|
/**
|
|
86
86
|
* Interaction context(s) where the command can be used, only for globally-scoped commands. By default, all interaction context types included for new commands `[0,1,2]`.
|
|
87
87
|
*
|
|
88
|
-
* @unstable
|
|
89
88
|
*/
|
|
90
89
|
contexts?: InteractionContextType[] | null;
|
|
91
90
|
/**
|
|
92
91
|
* Autoincrementing version identifier updated during substantial record changes
|
|
93
92
|
*/
|
|
94
93
|
version: Snowflake;
|
|
94
|
+
/**
|
|
95
|
+
* Determines whether the interaction is handled by the app's interactions handler or by Discord
|
|
96
|
+
*/
|
|
97
|
+
handler?: EntryPointCommandHandlerType;
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
100
|
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
|
|
98
101
|
*/
|
|
99
102
|
export declare enum ApplicationCommandType {
|
|
103
|
+
/**
|
|
104
|
+
* Slash commands; a text-based command that shows up when a user types /
|
|
105
|
+
*/
|
|
100
106
|
ChatInput = 1,
|
|
107
|
+
/**
|
|
108
|
+
* A UI-based command that shows up when you right click or tap on a user
|
|
109
|
+
*/
|
|
101
110
|
User = 2,
|
|
102
|
-
|
|
111
|
+
/**
|
|
112
|
+
* A UI-based command that shows up when you right click or tap on a message
|
|
113
|
+
*/
|
|
114
|
+
Message = 3,
|
|
115
|
+
/**
|
|
116
|
+
* A UI-based command that represents the primary way to invoke an app's Activity
|
|
117
|
+
*/
|
|
118
|
+
PrimaryEntryPoint = 4
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
|
|
122
|
+
*/
|
|
123
|
+
export declare enum EntryPointCommandHandlerType {
|
|
124
|
+
/**
|
|
125
|
+
* The app handles the interaction using an interaction token
|
|
126
|
+
*/
|
|
127
|
+
AppHandler = 1,
|
|
128
|
+
/**
|
|
129
|
+
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
|
|
130
|
+
*/
|
|
131
|
+
DiscordLaunchActivity = 2
|
|
103
132
|
}
|
|
104
133
|
/**
|
|
105
134
|
* https://discord.com/developers/docs/resources/application#application-object-application-integration-types
|
|
@@ -131,10 +160,16 @@ export declare enum InteractionContextType {
|
|
|
131
160
|
*/
|
|
132
161
|
PrivateChannel = 2
|
|
133
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Documentation goes brrrrrr
|
|
165
|
+
* @unstable
|
|
166
|
+
*/
|
|
167
|
+
export interface APIEntryPointInteractionData extends Omit<APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>, 'guild_id'> {
|
|
168
|
+
}
|
|
134
169
|
/**
|
|
135
170
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
|
|
136
171
|
*/
|
|
137
|
-
export type APIApplicationCommandInteractionData = APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData;
|
|
172
|
+
export type APIApplicationCommandInteractionData = APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData | APIEntryPointInteractionData;
|
|
138
173
|
/**
|
|
139
174
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
|
140
175
|
*/
|
|
@@ -142,7 +177,7 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
|
|
|
142
177
|
/**
|
|
143
178
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
|
144
179
|
*/
|
|
145
|
-
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
|
|
180
|
+
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction | APIEntryPointCommandInteraction;
|
|
146
181
|
/**
|
|
147
182
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
|
148
183
|
*/
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.InteractionContextType = exports.ApplicationIntegrationType = exports.ApplicationCommandType = void 0;
|
|
17
|
+
exports.InteractionContextType = exports.ApplicationIntegrationType = exports.EntryPointCommandHandlerType = exports.ApplicationCommandType = void 0;
|
|
18
18
|
__exportStar(require("./_applicationCommands/chatInput"), exports);
|
|
19
19
|
__exportStar(require("./_applicationCommands/contextMenu"), exports);
|
|
20
20
|
__exportStar(require("./_applicationCommands/permissions"), exports);
|
|
@@ -23,10 +23,37 @@ __exportStar(require("./_applicationCommands/permissions"), exports);
|
|
|
23
23
|
*/
|
|
24
24
|
var ApplicationCommandType;
|
|
25
25
|
(function (ApplicationCommandType) {
|
|
26
|
+
/**
|
|
27
|
+
* Slash commands; a text-based command that shows up when a user types /
|
|
28
|
+
*/
|
|
26
29
|
ApplicationCommandType[ApplicationCommandType["ChatInput"] = 1] = "ChatInput";
|
|
30
|
+
/**
|
|
31
|
+
* A UI-based command that shows up when you right click or tap on a user
|
|
32
|
+
*/
|
|
27
33
|
ApplicationCommandType[ApplicationCommandType["User"] = 2] = "User";
|
|
34
|
+
/**
|
|
35
|
+
* A UI-based command that shows up when you right click or tap on a message
|
|
36
|
+
*/
|
|
28
37
|
ApplicationCommandType[ApplicationCommandType["Message"] = 3] = "Message";
|
|
38
|
+
/**
|
|
39
|
+
* A UI-based command that represents the primary way to invoke an app's Activity
|
|
40
|
+
*/
|
|
41
|
+
ApplicationCommandType[ApplicationCommandType["PrimaryEntryPoint"] = 4] = "PrimaryEntryPoint";
|
|
29
42
|
})(ApplicationCommandType || (exports.ApplicationCommandType = ApplicationCommandType = {}));
|
|
43
|
+
/**
|
|
44
|
+
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
|
|
45
|
+
*/
|
|
46
|
+
var EntryPointCommandHandlerType;
|
|
47
|
+
(function (EntryPointCommandHandlerType) {
|
|
48
|
+
/**
|
|
49
|
+
* The app handles the interaction using an interaction token
|
|
50
|
+
*/
|
|
51
|
+
EntryPointCommandHandlerType[EntryPointCommandHandlerType["AppHandler"] = 1] = "AppHandler";
|
|
52
|
+
/**
|
|
53
|
+
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
|
|
54
|
+
*/
|
|
55
|
+
EntryPointCommandHandlerType[EntryPointCommandHandlerType["DiscordLaunchActivity"] = 2] = "DiscordLaunchActivity";
|
|
56
|
+
})(EntryPointCommandHandlerType || (exports.EntryPointCommandHandlerType = EntryPointCommandHandlerType = {}));
|
|
30
57
|
/**
|
|
31
58
|
* https://discord.com/developers/docs/resources/application#application-object-application-integration-types
|
|
32
59
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApplicationIntegrationType, InteractionContextType } from '..';
|
|
2
2
|
import type { ChannelType, Snowflake } from '../..';
|
|
3
3
|
import type { LocaleString } from '../../rest';
|
|
4
4
|
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadChannel, ThreadChannelType } from '../channel';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MakeRequired } from '../../../common';
|
|
1
2
|
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../index';
|
|
2
3
|
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
|
3
4
|
import type { MessageFlags } from '../index';
|
|
@@ -15,7 +16,7 @@ export declare enum InteractionType {
|
|
|
15
16
|
/**
|
|
16
17
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
|
|
17
18
|
*/
|
|
18
|
-
export type APIInteractionResponse = APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponsePong | APIInteractionResponseUpdateMessage | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse;
|
|
19
|
+
export type APIInteractionResponse = APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponsePong | APIInteractionResponseUpdateMessage | APIModalInteractionResponse | APIInteractionResponseLaunchActivity | APIPremiumRequiredInteractionResponse;
|
|
19
20
|
export interface APIInteractionResponsePong {
|
|
20
21
|
type: InteractionResponseType.Pong;
|
|
21
22
|
}
|
|
@@ -45,6 +46,9 @@ export interface APIInteractionResponseUpdateMessage {
|
|
|
45
46
|
type: InteractionResponseType.UpdateMessage;
|
|
46
47
|
data?: APIInteractionResponseCallbackData;
|
|
47
48
|
}
|
|
49
|
+
export interface APIInteractionResponseLaunchActivity {
|
|
50
|
+
type: InteractionResponseType.LaunchActivity;
|
|
51
|
+
}
|
|
48
52
|
/**
|
|
49
53
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
|
50
54
|
*/
|
|
@@ -82,7 +86,11 @@ export declare enum InteractionResponseType {
|
|
|
82
86
|
*
|
|
83
87
|
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
|
|
84
88
|
*/
|
|
85
|
-
PremiumRequired = 10
|
|
89
|
+
PremiumRequired = 10,
|
|
90
|
+
/**
|
|
91
|
+
* Launch the Activity associated with the app. Only available for apps with Activities enabled
|
|
92
|
+
*/
|
|
93
|
+
LaunchActivity = 12
|
|
86
94
|
}
|
|
87
95
|
/**
|
|
88
96
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
|
|
@@ -110,3 +118,67 @@ export interface APIModalInteractionResponseCallbackData {
|
|
|
110
118
|
*/
|
|
111
119
|
components: APIActionRowComponent<APIModalActionRowComponent>[];
|
|
112
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
|
|
123
|
+
*/
|
|
124
|
+
export interface InteractionCallbackData<T extends InteractionType = InteractionType> {
|
|
125
|
+
id: string;
|
|
126
|
+
type: T;
|
|
127
|
+
/**
|
|
128
|
+
* Instance ID of the Activity if one was launched or joined
|
|
129
|
+
*/
|
|
130
|
+
activity_instance_id?: string;
|
|
131
|
+
/**
|
|
132
|
+
* ID of the message that was created by the interaction
|
|
133
|
+
*/
|
|
134
|
+
response_message_id?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Whether or not the message is in a loading state
|
|
137
|
+
*/
|
|
138
|
+
response_message_loading?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether or not the response message was ephemeral
|
|
141
|
+
*/
|
|
142
|
+
response_message_ephemeral?: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
|
|
146
|
+
*/
|
|
147
|
+
export interface InteractionCallbackResourceActivity {
|
|
148
|
+
/**
|
|
149
|
+
* Instance ID of the Activity if one was launched or joined.
|
|
150
|
+
*/
|
|
151
|
+
id: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
|
|
155
|
+
*/
|
|
156
|
+
export interface InteractionCallbackResource<T extends InteractionResponseType = InteractionResponseType> {
|
|
157
|
+
type: T;
|
|
158
|
+
/**
|
|
159
|
+
* Represents the Activity launched by this interaction.
|
|
160
|
+
*/
|
|
161
|
+
activity_instance?: InteractionCallbackResourceActivity;
|
|
162
|
+
/**
|
|
163
|
+
* Message created by the interaction.
|
|
164
|
+
*/
|
|
165
|
+
message?: Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'> & {
|
|
166
|
+
flags?: MessageFlags;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
|
|
171
|
+
*/
|
|
172
|
+
export interface InteractionCallbackResponse {
|
|
173
|
+
interaction: InteractionCallbackData;
|
|
174
|
+
resource?: InteractionCallbackResource;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
|
|
178
|
+
*/
|
|
179
|
+
export type APIInteractionCallbackLaunchActivity = InteractionCallbackResponse & {
|
|
180
|
+
resource?: Omit<MakeRequired<InteractionCallbackResource, 'activity_instance'>, 'message'>;
|
|
181
|
+
};
|
|
182
|
+
export type APIInteractionCallbackMessage = InteractionCallbackResponse & {
|
|
183
|
+
resource?: Omit<MakeRequired<InteractionCallbackResource, 'message'>, 'activity_instance'>;
|
|
184
|
+
};
|
|
@@ -51,4 +51,8 @@ var InteractionResponseType;
|
|
|
51
51
|
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
|
|
52
52
|
*/
|
|
53
53
|
InteractionResponseType[InteractionResponseType["PremiumRequired"] = 10] = "PremiumRequired";
|
|
54
|
+
/**
|
|
55
|
+
* Launch the Activity associated with the app. Only available for apps with Activities enabled
|
|
56
|
+
*/
|
|
57
|
+
InteractionResponseType[InteractionResponseType["LaunchActivity"] = 12] = "LaunchActivity";
|
|
54
58
|
})(InteractionResponseType || (exports.InteractionResponseType = InteractionResponseType = {}));
|