disgroove 1.3.3-dev.2 → 1.3.3-dev.3
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/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/lib/Client.d.ts +0 -234
- package/dist/lib/Client.js +0 -256
- package/dist/lib/Client.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -1084
- package/dist/lib/constants.js +0 -1163
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/gateway/Shard.d.ts +0 -25
- package/dist/lib/gateway/Shard.js +0 -522
- package/dist/lib/gateway/Shard.js.map +0 -1
- package/dist/lib/gateway/ShardsManager.d.ts +0 -5
- package/dist/lib/gateway/ShardsManager.js +0 -13
- package/dist/lib/gateway/ShardsManager.js.map +0 -1
- package/dist/lib/gateway/index.d.ts +0 -2
- package/dist/lib/gateway/index.js +0 -19
- package/dist/lib/gateway/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.js +0 -24
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/rest/CDN.d.ts +0 -21
- package/dist/lib/rest/CDN.js +0 -46
- package/dist/lib/rest/CDN.js.map +0 -1
- package/dist/lib/rest/Endpoints.d.ts +0 -94
- package/dist/lib/rest/Endpoints.js +0 -211
- package/dist/lib/rest/Endpoints.js.map +0 -1
- package/dist/lib/rest/REST.d.ts +0 -22
- package/dist/lib/rest/REST.js +0 -35
- package/dist/lib/rest/REST.js.map +0 -1
- package/dist/lib/rest/RequestsManager.d.ts +0 -17
- package/dist/lib/rest/RequestsManager.js +0 -124
- package/dist/lib/rest/RequestsManager.js.map +0 -1
- package/dist/lib/rest/index.d.ts +0 -4
- package/dist/lib/rest/index.js +0 -34
- package/dist/lib/rest/index.js.map +0 -1
- package/dist/lib/structures/Application.d.ts +0 -174
- package/dist/lib/structures/Application.js +0 -328
- package/dist/lib/structures/Application.js.map +0 -1
- package/dist/lib/structures/ApplicationCommand.d.ts +0 -45
- package/dist/lib/structures/ApplicationCommand.js +0 -127
- package/dist/lib/structures/ApplicationCommand.js.map +0 -1
- package/dist/lib/structures/AuditLog.d.ts +0 -20
- package/dist/lib/structures/AuditLog.js +0 -76
- package/dist/lib/structures/AuditLog.js.map +0 -1
- package/dist/lib/structures/AutoModerationRule.d.ts +0 -34
- package/dist/lib/structures/AutoModerationRule.js +0 -96
- package/dist/lib/structures/AutoModerationRule.js.map +0 -1
- package/dist/lib/structures/Base.d.ts +0 -17
- package/dist/lib/structures/Base.js +0 -31
- package/dist/lib/structures/Base.js.map +0 -1
- package/dist/lib/structures/Channel.d.ts +0 -253
- package/dist/lib/structures/Channel.js +0 -591
- package/dist/lib/structures/Channel.js.map +0 -1
- package/dist/lib/structures/ClientApplication.d.ts +0 -150
- package/dist/lib/structures/ClientApplication.js +0 -241
- package/dist/lib/structures/ClientApplication.js.map +0 -1
- package/dist/lib/structures/Emoji.d.ts +0 -28
- package/dist/lib/structures/Emoji.js +0 -79
- package/dist/lib/structures/Emoji.js.map +0 -1
- package/dist/lib/structures/Entitlement.d.ts +0 -24
- package/dist/lib/structures/Entitlement.js +0 -68
- package/dist/lib/structures/Entitlement.js.map +0 -1
- package/dist/lib/structures/Guild.d.ts +0 -462
- package/dist/lib/structures/Guild.js +0 -1095
- package/dist/lib/structures/Guild.js.map +0 -1
- package/dist/lib/structures/GuildMember.d.ts +0 -50
- package/dist/lib/structures/GuildMember.js +0 -149
- package/dist/lib/structures/GuildMember.js.map +0 -1
- package/dist/lib/structures/GuildScheduledEvent.d.ts +0 -49
- package/dist/lib/structures/GuildScheduledEvent.js +0 -118
- package/dist/lib/structures/GuildScheduledEvent.js.map +0 -1
- package/dist/lib/structures/GuildTemplate.d.ts +0 -32
- package/dist/lib/structures/GuildTemplate.js +0 -76
- package/dist/lib/structures/GuildTemplate.js.map +0 -1
- package/dist/lib/structures/Integration.d.ts +0 -30
- package/dist/lib/structures/Integration.js +0 -102
- package/dist/lib/structures/Integration.js.map +0 -1
- package/dist/lib/structures/Interaction.d.ts +0 -76
- package/dist/lib/structures/Interaction.js +0 -345
- package/dist/lib/structures/Interaction.js.map +0 -1
- package/dist/lib/structures/Invite.d.ts +0 -28
- package/dist/lib/structures/Invite.js +0 -86
- package/dist/lib/structures/Invite.js.map +0 -1
- package/dist/lib/structures/Message.d.ts +0 -84
- package/dist/lib/structures/Message.js +0 -300
- package/dist/lib/structures/Message.js.map +0 -1
- package/dist/lib/structures/Role.d.ts +0 -37
- package/dist/lib/structures/Role.js +0 -90
- package/dist/lib/structures/Role.js.map +0 -1
- package/dist/lib/structures/SKU.d.ts +0 -23
- package/dist/lib/structures/SKU.js +0 -63
- package/dist/lib/structures/SKU.js.map +0 -1
- package/dist/lib/structures/StageInstance.d.ts +0 -24
- package/dist/lib/structures/StageInstance.js +0 -57
- package/dist/lib/structures/StageInstance.js.map +0 -1
- package/dist/lib/structures/Sticker.d.ts +0 -31
- package/dist/lib/structures/Sticker.js +0 -86
- package/dist/lib/structures/Sticker.js.map +0 -1
- package/dist/lib/structures/Team.d.ts +0 -14
- package/dist/lib/structures/Team.js +0 -39
- package/dist/lib/structures/Team.js.map +0 -1
- package/dist/lib/structures/TestEntitlement.d.ts +0 -23
- package/dist/lib/structures/TestEntitlement.js +0 -61
- package/dist/lib/structures/TestEntitlement.js.map +0 -1
- package/dist/lib/structures/UnavailableGuild.d.ts +0 -11
- package/dist/lib/structures/UnavailableGuild.js +0 -25
- package/dist/lib/structures/UnavailableGuild.js.map +0 -1
- package/dist/lib/structures/User.d.ts +0 -63
- package/dist/lib/structures/User.js +0 -177
- package/dist/lib/structures/User.js.map +0 -1
- package/dist/lib/structures/VoiceState.d.ts +0 -26
- package/dist/lib/structures/VoiceState.js +0 -70
- package/dist/lib/structures/VoiceState.js.map +0 -1
- package/dist/lib/structures/Webhook.d.ts +0 -84
- package/dist/lib/structures/Webhook.js +0 -239
- package/dist/lib/structures/Webhook.js.map +0 -1
- package/dist/lib/structures/index.d.ts +0 -27
- package/dist/lib/structures/index.js +0 -44
- package/dist/lib/structures/index.js.map +0 -1
- package/dist/lib/types/application-command.d.ts +0 -102
- package/dist/lib/types/application-command.js +0 -3
- package/dist/lib/types/application-command.js.map +0 -1
- package/dist/lib/types/application-role-connection-metadata.d.ts +0 -18
- package/dist/lib/types/application-role-connection-metadata.js +0 -3
- package/dist/lib/types/application-role-connection-metadata.js.map +0 -1
- package/dist/lib/types/application.d.ts +0 -66
- package/dist/lib/types/application.js +0 -3
- package/dist/lib/types/application.js.map +0 -1
- package/dist/lib/types/audit-log.d.ts +0 -82
- package/dist/lib/types/audit-log.js +0 -3
- package/dist/lib/types/audit-log.js.map +0 -1
- package/dist/lib/types/auto-moderation.d.ts +0 -65
- package/dist/lib/types/auto-moderation.js +0 -3
- package/dist/lib/types/auto-moderation.js.map +0 -1
- package/dist/lib/types/channel.d.ts +0 -456
- package/dist/lib/types/channel.js +0 -3
- package/dist/lib/types/channel.js.map +0 -1
- package/dist/lib/types/emoji.d.ts +0 -22
- package/dist/lib/types/emoji.js +0 -3
- package/dist/lib/types/emoji.js.map +0 -1
- package/dist/lib/types/entitlements.d.ts +0 -32
- package/dist/lib/types/entitlements.js +0 -3
- package/dist/lib/types/entitlements.js.map +0 -1
- package/dist/lib/types/gateway-events.d.ts +0 -805
- package/dist/lib/types/gateway-events.js +0 -3
- package/dist/lib/types/gateway-events.js.map +0 -1
- package/dist/lib/types/guild-scheduled-event.d.ts +0 -57
- package/dist/lib/types/guild-scheduled-event.js +0 -3
- package/dist/lib/types/guild-scheduled-event.js.map +0 -1
- package/dist/lib/types/guild-template.d.ts +0 -28
- package/dist/lib/types/guild-template.js +0 -3
- package/dist/lib/types/guild-template.js.map +0 -1
- package/dist/lib/types/guild.d.ts +0 -333
- package/dist/lib/types/guild.js +0 -3
- package/dist/lib/types/guild.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -23
- package/dist/lib/types/index.js +0 -40
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/interaction.d.ts +0 -170
- package/dist/lib/types/interaction.js +0 -3
- package/dist/lib/types/interaction.js.map +0 -1
- package/dist/lib/types/invite.d.ts +0 -59
- package/dist/lib/types/invite.js +0 -3
- package/dist/lib/types/invite.js.map +0 -1
- package/dist/lib/types/message-components.d.ts +0 -100
- package/dist/lib/types/message-components.js +0 -3
- package/dist/lib/types/message-components.js.map +0 -1
- package/dist/lib/types/role.d.ts +0 -47
- package/dist/lib/types/role.js +0 -3
- package/dist/lib/types/role.js.map +0 -1
- package/dist/lib/types/sku.d.ts +0 -30
- package/dist/lib/types/sku.js +0 -3
- package/dist/lib/types/sku.js.map +0 -1
- package/dist/lib/types/stage-instance.d.ts +0 -20
- package/dist/lib/types/stage-instance.js +0 -3
- package/dist/lib/types/stage-instance.js.map +0 -1
- package/dist/lib/types/sticker.d.ts +0 -61
- package/dist/lib/types/sticker.js +0 -3
- package/dist/lib/types/sticker.js.map +0 -1
- package/dist/lib/types/team.d.ts +0 -30
- package/dist/lib/types/team.js +0 -3
- package/dist/lib/types/team.js.map +0 -1
- package/dist/lib/types/user.d.ts +0 -77
- package/dist/lib/types/user.js +0 -3
- package/dist/lib/types/user.js.map +0 -1
- package/dist/lib/types/voice.d.ts +0 -47
- package/dist/lib/types/voice.js +0 -3
- package/dist/lib/types/voice.js.map +0 -1
- package/dist/lib/types/webhook.d.ts +0 -31
- package/dist/lib/types/webhook.js +0 -3
- package/dist/lib/types/webhook.js.map +0 -1
- package/dist/lib/utils/Util.d.ts +0 -15
- package/dist/lib/utils/Util.js +0 -543
- package/dist/lib/utils/Util.js.map +0 -1
- package/dist/lib/utils/errors.d.ts +0 -12
- package/dist/lib/utils/errors.js +0 -25
- package/dist/lib/utils/errors.js.map +0 -1
- package/dist/lib/utils/index.d.ts +0 -2
- package/dist/lib/utils/index.js +0 -19
- package/dist/lib/utils/index.js.map +0 -1
- package/examples/applicationCommands.js +0 -43
- package/examples/buttons.js +0 -70
- package/examples/embeds.js +0 -36
- package/examples/ephemeralMessages.js +0 -32
- package/examples/files.js +0 -36
- package/examples/modalSubmit.js +0 -62
- package/examples/permissions.js +0 -41
- package/examples/selectMenus.js +0 -160
- package/examples/text.txt +0 -1
- package/lib/Client.ts +0 -616
- package/lib/constants.ts +0 -1173
- package/lib/gateway/Shard.ts +0 -704
- package/lib/gateway/ShardsManager.ts +0 -11
- package/lib/gateway/index.ts +0 -2
- package/lib/index.ts +0 -7
- package/lib/rest/CDN.ts +0 -56
- package/lib/rest/Endpoints.ts +0 -241
- package/lib/rest/REST.ts +0 -45
- package/lib/rest/RequestsManager.ts +0 -134
- package/lib/rest/index.ts +0 -4
- package/lib/structures/Application.ts +0 -599
- package/lib/structures/ApplicationCommand.ts +0 -187
- package/lib/structures/AuditLog.ts +0 -112
- package/lib/structures/AutoModerationRule.ts +0 -127
- package/lib/structures/Base.ts +0 -39
- package/lib/structures/Channel.ts +0 -921
- package/lib/structures/ClientApplication.ts +0 -515
- package/lib/structures/Emoji.ts +0 -95
- package/lib/structures/Entitlement.ts +0 -65
- package/lib/structures/Guild.ts +0 -1842
- package/lib/structures/GuildMember.ts +0 -193
- package/lib/structures/GuildScheduledEvent.ts +0 -164
- package/lib/structures/GuildTemplate.ts +0 -103
- package/lib/structures/Integration.ts +0 -136
- package/lib/structures/Interaction.ts +0 -506
- package/lib/structures/Invite.ts +0 -108
- package/lib/structures/Message.ts +0 -421
- package/lib/structures/Role.ts +0 -116
- package/lib/structures/SKU.ts +0 -63
- package/lib/structures/StageInstance.ts +0 -74
- package/lib/structures/Sticker.ts +0 -100
- package/lib/structures/Team.ts +0 -41
- package/lib/structures/TestEntitlement.ts +0 -78
- package/lib/structures/UnavailableGuild.ts +0 -27
- package/lib/structures/User.ts +0 -233
- package/lib/structures/VoiceState.ts +0 -72
- package/lib/structures/Webhook.ts +0 -341
- package/lib/structures/index.ts +0 -27
- package/lib/types/application-command.ts +0 -118
- package/lib/types/application-role-connection-metadata.ts +0 -23
- package/lib/types/application.ts +0 -77
- package/lib/types/audit-log.ts +0 -105
- package/lib/types/auto-moderation.ts +0 -78
- package/lib/types/channel.ts +0 -534
- package/lib/types/emoji.ts +0 -24
- package/lib/types/entitlements.ts +0 -34
- package/lib/types/gateway-events.ts +0 -970
- package/lib/types/guild-scheduled-event.ts +0 -67
- package/lib/types/guild-template.ts +0 -30
- package/lib/types/guild.ts +0 -388
- package/lib/types/index.ts +0 -23
- package/lib/types/interaction.ts +0 -224
- package/lib/types/invite.ts +0 -78
- package/lib/types/message-components.ts +0 -127
- package/lib/types/role.ts +0 -51
- package/lib/types/sku.ts +0 -32
- package/lib/types/stage-instance.ts +0 -22
- package/lib/types/sticker.ts +0 -67
- package/lib/types/team.ts +0 -34
- package/lib/types/user.ts +0 -93
- package/lib/types/voice.ts +0 -51
- package/lib/types/webhook.ts +0 -40
- package/lib/utils/Util.ts +0 -600
- package/lib/utils/errors.ts +0 -23
- package/lib/utils/index.ts +0 -2
- package/test/basic.js +0 -8
- package/tsconfig.json +0 -107
@@ -1,599 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Base,
|
3
|
-
User,
|
4
|
-
ApplicationCommand,
|
5
|
-
Team,
|
6
|
-
Guild,
|
7
|
-
TestEntitlement,
|
8
|
-
Entitlement,
|
9
|
-
SKU,
|
10
|
-
} from ".";
|
11
|
-
import type {
|
12
|
-
JSONInstallParams,
|
13
|
-
JSONGuildApplicationCommandPermissions,
|
14
|
-
RawApplication,
|
15
|
-
RawGuildApplicationCommandPermissions,
|
16
|
-
RawApplicationCommand,
|
17
|
-
JSONApplication,
|
18
|
-
JSONApplicationRoleConnectionMetadata,
|
19
|
-
RawApplicationRoleConnectionMetadata,
|
20
|
-
RawSKU,
|
21
|
-
RawEntitlement,
|
22
|
-
JSONApplicationCommandOption,
|
23
|
-
} from "../types";
|
24
|
-
import type { Client } from "../Client";
|
25
|
-
import { Endpoints } from "../rest";
|
26
|
-
import type {
|
27
|
-
ApplicationCommandTypes,
|
28
|
-
ApplicationFlags,
|
29
|
-
Locale,
|
30
|
-
} from "../constants";
|
31
|
-
|
32
|
-
/** https://discord.com/developers/docs/resources/application */
|
33
|
-
export class Application extends Base {
|
34
|
-
protected override raw: RawApplication;
|
35
|
-
name: string;
|
36
|
-
icon: string | null;
|
37
|
-
description: string;
|
38
|
-
rpcOrigins?: Array<string>;
|
39
|
-
botPublic: boolean;
|
40
|
-
botRequireCodeGrant: boolean;
|
41
|
-
termsOfServiceURL?: string;
|
42
|
-
privacyPolicyURL?: string;
|
43
|
-
owner?: User;
|
44
|
-
verifyKey: string;
|
45
|
-
team: Team | null;
|
46
|
-
guildId?: string;
|
47
|
-
guild?: Guild;
|
48
|
-
primarySKUId?: string;
|
49
|
-
slug?: string;
|
50
|
-
coverImage?: string;
|
51
|
-
flags?: ApplicationFlags;
|
52
|
-
approximateGuildCount?: number;
|
53
|
-
redirectURIs?: Array<string>;
|
54
|
-
interactionsEndpointURL?: string;
|
55
|
-
roleConnectionsVerificationURL?: string;
|
56
|
-
tags?: Array<string>;
|
57
|
-
installParams?: JSONInstallParams;
|
58
|
-
customInstallURL?: string;
|
59
|
-
|
60
|
-
constructor(data: RawApplication, client: Client) {
|
61
|
-
super(data.id, client);
|
62
|
-
|
63
|
-
this.raw = data;
|
64
|
-
this.name = data.name;
|
65
|
-
this.icon = data.icon;
|
66
|
-
this.description = data.description;
|
67
|
-
this.botPublic = data.bot_public;
|
68
|
-
this.botRequireCodeGrant = data.bot_require_code_grant;
|
69
|
-
this.verifyKey = data.verify_key;
|
70
|
-
this.team = null;
|
71
|
-
|
72
|
-
this.patch(data);
|
73
|
-
}
|
74
|
-
|
75
|
-
protected override patch(data: RawApplication) {
|
76
|
-
if (data.rpc_origins !== undefined) this.rpcOrigins = data.rpc_origins;
|
77
|
-
if (data.terms_of_service_url !== undefined)
|
78
|
-
this.termsOfServiceURL = data.terms_of_service_url;
|
79
|
-
if (data.owner !== undefined)
|
80
|
-
this.owner = new User(data.owner, this.client);
|
81
|
-
if (data.team !== undefined)
|
82
|
-
this.team = data.team !== null ? new Team(data.team, this.client) : null;
|
83
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
84
|
-
if (data.guild !== undefined)
|
85
|
-
this.guild = new Guild(data.guild, this.client);
|
86
|
-
if (data.primary_sku_id !== undefined)
|
87
|
-
this.primarySKUId = data.primary_sku_id;
|
88
|
-
if (data.slug !== undefined) this.slug = data.slug;
|
89
|
-
if (data.cover_image !== undefined) this.coverImage = data.cover_image;
|
90
|
-
if (data.flags !== undefined) this.flags = data.flags;
|
91
|
-
if (data.approximate_guild_count !== undefined)
|
92
|
-
this.approximateGuildCount = data.approximate_guild_count;
|
93
|
-
if (data.redirect_uris !== undefined)
|
94
|
-
this.redirectURIs = data.redirect_uris;
|
95
|
-
if (data.interactions_endpoint_url !== undefined)
|
96
|
-
this.interactionsEndpointURL = data.interactions_endpoint_url;
|
97
|
-
if (data.role_connections_verification_url !== undefined)
|
98
|
-
this.roleConnectionsVerificationURL =
|
99
|
-
data.role_connections_verification_url;
|
100
|
-
if (data.tags !== undefined) this.tags = data.tags;
|
101
|
-
if (data.install_params !== undefined)
|
102
|
-
this.installParams = data.install_params;
|
103
|
-
if (data.custom_install_url !== undefined)
|
104
|
-
this.customInstallURL = data.custom_install_url;
|
105
|
-
}
|
106
|
-
|
107
|
-
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
108
|
-
async createGlobalApplicationCommand(options: {
|
109
|
-
name: string;
|
110
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
111
|
-
description?: string;
|
112
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
113
|
-
options?: Array<JSONApplicationCommandOption>;
|
114
|
-
defaultMemberPermissions?: string | null;
|
115
|
-
dmPermission?: boolean;
|
116
|
-
defaultPermission?: boolean | null;
|
117
|
-
type?: ApplicationCommandTypes;
|
118
|
-
nsfw?: boolean;
|
119
|
-
}): Promise<ApplicationCommand> {
|
120
|
-
return new ApplicationCommand(
|
121
|
-
await this.client.rest.post<RawApplicationCommand>(
|
122
|
-
Endpoints.applicationCommands(this.id),
|
123
|
-
{
|
124
|
-
json: this.client.util.applicationCommandToRaw(options),
|
125
|
-
}
|
126
|
-
),
|
127
|
-
this.client
|
128
|
-
);
|
129
|
-
}
|
130
|
-
|
131
|
-
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
132
|
-
async createGuildApplicationCommand(
|
133
|
-
guildId: string,
|
134
|
-
options: {
|
135
|
-
name: string;
|
136
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
137
|
-
description?: string;
|
138
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
139
|
-
options?: Array<JSONApplicationCommandOption>;
|
140
|
-
defaultMemberPermissions?: string | null;
|
141
|
-
dmPermission?: boolean;
|
142
|
-
defaultPermission?: boolean | null;
|
143
|
-
type?: ApplicationCommandTypes;
|
144
|
-
nsfw?: boolean;
|
145
|
-
}
|
146
|
-
): Promise<ApplicationCommand> {
|
147
|
-
return new ApplicationCommand(
|
148
|
-
await this.client.rest.post<RawApplicationCommand>(
|
149
|
-
Endpoints.applicationGuildCommands(this.id, guildId),
|
150
|
-
{
|
151
|
-
json: this.client.util.applicationCommandToRaw(options),
|
152
|
-
}
|
153
|
-
),
|
154
|
-
this.client
|
155
|
-
);
|
156
|
-
}
|
157
|
-
|
158
|
-
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
|
159
|
-
async createTestEntitlement(options: {
|
160
|
-
skuId: string;
|
161
|
-
ownerId: string;
|
162
|
-
ownerType: number;
|
163
|
-
}): Promise<TestEntitlement> {
|
164
|
-
return new TestEntitlement(
|
165
|
-
await this.client.rest.post<
|
166
|
-
Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">
|
167
|
-
>(Endpoints.applicationEntitlements(this.id), {
|
168
|
-
json: {
|
169
|
-
sku_id: options.skuId,
|
170
|
-
owner_id: options.ownerId,
|
171
|
-
owner_type: options.ownerType,
|
172
|
-
},
|
173
|
-
}),
|
174
|
-
this.client
|
175
|
-
);
|
176
|
-
}
|
177
|
-
|
178
|
-
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
179
|
-
deleteGlobalApplicationCommand(commandId: string): void {
|
180
|
-
this.client.rest.delete(Endpoints.applicationCommand(this.id, commandId));
|
181
|
-
}
|
182
|
-
|
183
|
-
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
184
|
-
deleteGuildApplicationCommand(guildId: string, commandId: string): void {
|
185
|
-
this.client.rest.delete(
|
186
|
-
Endpoints.applicationGuildCommand(this.id, guildId, commandId)
|
187
|
-
);
|
188
|
-
}
|
189
|
-
|
190
|
-
/** https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement */
|
191
|
-
deleteTestEntitlement(entitlementId: string): void {
|
192
|
-
this.client.rest.delete(
|
193
|
-
Endpoints.applicationEntitlement(this.id, entitlementId)
|
194
|
-
);
|
195
|
-
}
|
196
|
-
|
197
|
-
/** https://discord.com/developers/docs/resources/application#edit-current-application */
|
198
|
-
async edit(options: {
|
199
|
-
customInstallURL?: string;
|
200
|
-
description?: string;
|
201
|
-
roleConnectionsVerificationURL?: string;
|
202
|
-
installParams?: JSONInstallParams;
|
203
|
-
flags?: ApplicationFlags;
|
204
|
-
icon?: string;
|
205
|
-
coverImage?: string;
|
206
|
-
interactionsEndpointURL?: string;
|
207
|
-
tags?: Array<string>;
|
208
|
-
}): Promise<Application> {
|
209
|
-
return new Application(
|
210
|
-
await this.client.rest.patch<RawApplication>(
|
211
|
-
Endpoints.applicationCurrentUser(),
|
212
|
-
{
|
213
|
-
json: {
|
214
|
-
custom_install_url: options.customInstallURL,
|
215
|
-
description: options.description,
|
216
|
-
role_connections_verification_url:
|
217
|
-
options.roleConnectionsVerificationURL,
|
218
|
-
install_params: options.installParams,
|
219
|
-
flags: options.flags,
|
220
|
-
icon: options.icon,
|
221
|
-
cover_image: options.coverImage,
|
222
|
-
interactions_endpoint_url: options.interactionsEndpointURL,
|
223
|
-
tags: options.tags,
|
224
|
-
},
|
225
|
-
}
|
226
|
-
),
|
227
|
-
this.client
|
228
|
-
);
|
229
|
-
}
|
230
|
-
|
231
|
-
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
232
|
-
async editApplicationCommandPermissions(
|
233
|
-
guildId: string,
|
234
|
-
commandId: string,
|
235
|
-
options: {
|
236
|
-
permissions: Array<JSONGuildApplicationCommandPermissions>;
|
237
|
-
}
|
238
|
-
): Promise<JSONGuildApplicationCommandPermissions> {
|
239
|
-
return this.client.rest
|
240
|
-
.put<RawGuildApplicationCommandPermissions>(
|
241
|
-
Endpoints.applicationCommandPermissions(this.id, guildId, commandId),
|
242
|
-
{
|
243
|
-
json: {
|
244
|
-
permissions: options.permissions.map((option) => ({
|
245
|
-
id: option.id,
|
246
|
-
application_id: option.applicationId,
|
247
|
-
guild_id: option.guildId,
|
248
|
-
permissions: option.permissions.map((permission) => ({
|
249
|
-
id: permission.id,
|
250
|
-
type: permission.type,
|
251
|
-
permission: permission.permission,
|
252
|
-
})),
|
253
|
-
})),
|
254
|
-
},
|
255
|
-
}
|
256
|
-
)
|
257
|
-
.then((response) => ({
|
258
|
-
id: response.id,
|
259
|
-
applicationId: response.application_id,
|
260
|
-
guildId: response.guild_id,
|
261
|
-
permissions: response.permissions.map((permission) => ({
|
262
|
-
id: permission.id,
|
263
|
-
type: permission.type,
|
264
|
-
permission: permission.permission,
|
265
|
-
})),
|
266
|
-
}));
|
267
|
-
}
|
268
|
-
|
269
|
-
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
270
|
-
async editGlobalApplicationCommand(
|
271
|
-
commandId: string,
|
272
|
-
options: {
|
273
|
-
name?: string;
|
274
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
275
|
-
description?: string;
|
276
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
277
|
-
options?: Array<JSONApplicationCommandOption>;
|
278
|
-
defaultMemberPermissions?: string | null;
|
279
|
-
defaultPermission?: boolean | null;
|
280
|
-
dmPermission?: boolean;
|
281
|
-
nsfw?: boolean;
|
282
|
-
}
|
283
|
-
): Promise<ApplicationCommand> {
|
284
|
-
return new ApplicationCommand(
|
285
|
-
await this.client.rest.patch<RawApplicationCommand>(
|
286
|
-
Endpoints.applicationCommand(this.id, commandId),
|
287
|
-
{
|
288
|
-
json: this.client.util.applicationCommandToRaw(options),
|
289
|
-
}
|
290
|
-
),
|
291
|
-
this.client
|
292
|
-
);
|
293
|
-
}
|
294
|
-
|
295
|
-
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
296
|
-
async editGuildApplicationCommand(
|
297
|
-
guildId: string,
|
298
|
-
commandId: string,
|
299
|
-
options: {
|
300
|
-
name?: string;
|
301
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
302
|
-
description?: string;
|
303
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
304
|
-
options?: Array<JSONApplicationCommandOption>;
|
305
|
-
defaultMemberPermissions?: string | null;
|
306
|
-
defaultPermission?: boolean | null;
|
307
|
-
dmPermission?: boolean;
|
308
|
-
nsfw?: boolean;
|
309
|
-
}
|
310
|
-
): Promise<ApplicationCommand> {
|
311
|
-
return new ApplicationCommand(
|
312
|
-
await this.client.rest.patch<RawApplicationCommand>(
|
313
|
-
Endpoints.applicationGuildCommand(this.id, guildId, commandId),
|
314
|
-
{
|
315
|
-
json: this.client.util.applicationCommandToRaw(options),
|
316
|
-
}
|
317
|
-
),
|
318
|
-
this.client
|
319
|
-
);
|
320
|
-
}
|
321
|
-
|
322
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
323
|
-
async getApplicationCommandPermissions(
|
324
|
-
guildId: string,
|
325
|
-
commandId: string
|
326
|
-
): Promise<Array<JSONGuildApplicationCommandPermissions>> {
|
327
|
-
return this.client.rest
|
328
|
-
.get<Array<RawGuildApplicationCommandPermissions>>(
|
329
|
-
Endpoints.applicationCommandPermissions(this.id, guildId, commandId)
|
330
|
-
)
|
331
|
-
.then((response) =>
|
332
|
-
response.map((permissions: RawGuildApplicationCommandPermissions) => ({
|
333
|
-
id: permissions.id,
|
334
|
-
applicationId: permissions.application_id,
|
335
|
-
guildId: permissions.guild_id,
|
336
|
-
permissions: permissions.permissions.map((permission) => ({
|
337
|
-
id: permission.id,
|
338
|
-
type: permission.type,
|
339
|
-
permission: permission.permission,
|
340
|
-
})),
|
341
|
-
}))
|
342
|
-
);
|
343
|
-
}
|
344
|
-
|
345
|
-
/** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
|
346
|
-
async getEntitlements(options?: {
|
347
|
-
userId?: string;
|
348
|
-
skuIds?: Array<string>;
|
349
|
-
before?: string;
|
350
|
-
after?: string;
|
351
|
-
limit?: number;
|
352
|
-
guildId?: string;
|
353
|
-
excludeEnded?: boolean;
|
354
|
-
}): Promise<Array<Entitlement>> {
|
355
|
-
return this.client.rest
|
356
|
-
.get<Array<RawEntitlement>>(Endpoints.applicationEntitlements(this.id), {
|
357
|
-
query: {
|
358
|
-
user_id: options?.userId,
|
359
|
-
sku_ids: options?.skuIds,
|
360
|
-
before: options?.before,
|
361
|
-
after: options?.after,
|
362
|
-
limit: options?.limit,
|
363
|
-
guild_id: options?.guildId,
|
364
|
-
exclude_ended: options?.excludeEnded,
|
365
|
-
},
|
366
|
-
})
|
367
|
-
.then((response) =>
|
368
|
-
response.map((data) => new Entitlement(data, this.client))
|
369
|
-
);
|
370
|
-
}
|
371
|
-
|
372
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
373
|
-
async getGlobalApplicationCommand(
|
374
|
-
commandId: string
|
375
|
-
): Promise<ApplicationCommand> {
|
376
|
-
return new ApplicationCommand(
|
377
|
-
await this.client.rest.get<RawApplicationCommand>(
|
378
|
-
Endpoints.applicationCommand(this.id, commandId)
|
379
|
-
),
|
380
|
-
this.client
|
381
|
-
);
|
382
|
-
}
|
383
|
-
|
384
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
385
|
-
async getGlobalApplicationCommands(options: {
|
386
|
-
withLocalizations?: boolean;
|
387
|
-
}): Promise<Array<ApplicationCommand>> {
|
388
|
-
return this.client.rest
|
389
|
-
.get<Array<RawApplicationCommand>>(
|
390
|
-
Endpoints.applicationCommands(this.id),
|
391
|
-
{
|
392
|
-
query: {
|
393
|
-
with_localizations: options.withLocalizations,
|
394
|
-
},
|
395
|
-
}
|
396
|
-
)
|
397
|
-
.then((response) =>
|
398
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
399
|
-
);
|
400
|
-
}
|
401
|
-
|
402
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
403
|
-
async getGuildApplicationCommand(
|
404
|
-
guildId: string,
|
405
|
-
commandId: string
|
406
|
-
): Promise<ApplicationCommand> {
|
407
|
-
return new ApplicationCommand(
|
408
|
-
await this.client.rest.get<RawApplicationCommand>(
|
409
|
-
Endpoints.applicationGuildCommand(this.id, guildId, commandId)
|
410
|
-
),
|
411
|
-
this.client
|
412
|
-
);
|
413
|
-
}
|
414
|
-
|
415
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
416
|
-
async getGuildApplicationCommands(
|
417
|
-
guildId: string,
|
418
|
-
options?: {
|
419
|
-
withLocalizations?: boolean;
|
420
|
-
}
|
421
|
-
): Promise<Array<ApplicationCommand>> {
|
422
|
-
return this.client.rest
|
423
|
-
.get<Array<RawApplicationCommand>>(
|
424
|
-
Endpoints.applicationGuildCommands(this.id, guildId),
|
425
|
-
{
|
426
|
-
query: {
|
427
|
-
with_localizations: options?.withLocalizations,
|
428
|
-
},
|
429
|
-
}
|
430
|
-
)
|
431
|
-
.then((response) =>
|
432
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
433
|
-
);
|
434
|
-
}
|
435
|
-
|
436
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
437
|
-
async getGuildApplicationCommandPermissions(
|
438
|
-
guildId: string
|
439
|
-
): Promise<Array<JSONGuildApplicationCommandPermissions>> {
|
440
|
-
return this.client.rest
|
441
|
-
.get<Array<RawGuildApplicationCommandPermissions>>(
|
442
|
-
Endpoints.guildApplicationCommandsPermissions(this.id, guildId)
|
443
|
-
)
|
444
|
-
.then((response) =>
|
445
|
-
response.map((permissions: RawGuildApplicationCommandPermissions) => ({
|
446
|
-
id: permissions.id,
|
447
|
-
applicationId: permissions.application_id,
|
448
|
-
guildId: permissions.guild_id,
|
449
|
-
permissions: permissions.permissions.map((permission) => ({
|
450
|
-
id: permission.id,
|
451
|
-
type: permission.type,
|
452
|
-
permission: permission.permission,
|
453
|
-
})),
|
454
|
-
}))
|
455
|
-
);
|
456
|
-
}
|
457
|
-
|
458
|
-
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
459
|
-
async getApplicationRoleConnectionMetadataRecords(): Promise<
|
460
|
-
Array<JSONApplicationRoleConnectionMetadata>
|
461
|
-
> {
|
462
|
-
return this.client.rest
|
463
|
-
.get<Array<RawApplicationRoleConnectionMetadata>>(
|
464
|
-
Endpoints.applicationRoleConnectionMetadata(this.id)
|
465
|
-
)
|
466
|
-
.then((response) =>
|
467
|
-
response.map((data) => ({
|
468
|
-
type: data.type,
|
469
|
-
key: data.key,
|
470
|
-
name: data.name,
|
471
|
-
nameLocalizations: data.name_localizations,
|
472
|
-
description: data.description,
|
473
|
-
descriptionLocalizations: data.description_localizations,
|
474
|
-
}))
|
475
|
-
);
|
476
|
-
}
|
477
|
-
|
478
|
-
/** https://discord.com/developers/docs/monetization/skus#list-skus */
|
479
|
-
async getSKUs(): Promise<Array<SKU>> {
|
480
|
-
return this.client.rest
|
481
|
-
.get<Array<RawSKU>>(Endpoints.applicationSKUs(this.id))
|
482
|
-
.then((response) => response.map((data) => new SKU(data, this.client)));
|
483
|
-
}
|
484
|
-
|
485
|
-
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
486
|
-
async setGlobalApplicationCommands(
|
487
|
-
commands: Array<{
|
488
|
-
id?: string;
|
489
|
-
name: string;
|
490
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
491
|
-
description?: string;
|
492
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
493
|
-
options?: Array<JSONApplicationCommandOption>;
|
494
|
-
defaultMemberPermissions?: string | null;
|
495
|
-
dmPermission?: boolean;
|
496
|
-
defaultPermission?: boolean | null;
|
497
|
-
type?: ApplicationCommandTypes;
|
498
|
-
nsfw?: boolean;
|
499
|
-
}>
|
500
|
-
): Promise<Array<ApplicationCommand>> {
|
501
|
-
return this.client.rest
|
502
|
-
.put<Array<RawApplicationCommand>>(
|
503
|
-
Endpoints.applicationCommands(this.id),
|
504
|
-
{
|
505
|
-
json: commands.map((command) =>
|
506
|
-
this.client.util.applicationCommandToRaw(command)
|
507
|
-
),
|
508
|
-
}
|
509
|
-
)
|
510
|
-
.then((response) =>
|
511
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
512
|
-
);
|
513
|
-
}
|
514
|
-
|
515
|
-
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
516
|
-
async setGuildApplicationCommands(
|
517
|
-
guildId: string,
|
518
|
-
commands: Array<{
|
519
|
-
id?: string;
|
520
|
-
name: string;
|
521
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
522
|
-
description?: string;
|
523
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
524
|
-
options?: Array<JSONApplicationCommandOption>;
|
525
|
-
defaultMemberPermissions?: string | null;
|
526
|
-
dmPermission?: boolean;
|
527
|
-
defaultPermission?: boolean | null;
|
528
|
-
type: ApplicationCommandTypes;
|
529
|
-
nsfw?: boolean;
|
530
|
-
}>
|
531
|
-
): Promise<Array<ApplicationCommand>> {
|
532
|
-
return this.client.rest
|
533
|
-
.put<Array<RawApplicationCommand>>(
|
534
|
-
Endpoints.applicationGuildCommands(this.id, guildId),
|
535
|
-
{
|
536
|
-
json: commands.map((command) =>
|
537
|
-
this.client.util.applicationCommandToRaw(command)
|
538
|
-
),
|
539
|
-
}
|
540
|
-
)
|
541
|
-
.then((response) =>
|
542
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
543
|
-
);
|
544
|
-
}
|
545
|
-
|
546
|
-
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
547
|
-
async updateApplicationRoleConnectionMetadataRecords(): Promise<
|
548
|
-
Array<JSONApplicationRoleConnectionMetadata>
|
549
|
-
> {
|
550
|
-
return this.client.rest
|
551
|
-
.put<Array<RawApplicationRoleConnectionMetadata>>(
|
552
|
-
Endpoints.applicationRoleConnectionMetadata(this.id)
|
553
|
-
)
|
554
|
-
.then((response) =>
|
555
|
-
response.map((data) => ({
|
556
|
-
type: data.type,
|
557
|
-
key: data.key,
|
558
|
-
name: data.name,
|
559
|
-
nameLocalizations: data.name_localizations,
|
560
|
-
description: data.description,
|
561
|
-
descriptionLocalizations: data.description_localizations,
|
562
|
-
}))
|
563
|
-
);
|
564
|
-
}
|
565
|
-
|
566
|
-
override toRaw(): RawApplication {
|
567
|
-
return this.raw;
|
568
|
-
}
|
569
|
-
|
570
|
-
override toJSON(): JSONApplication {
|
571
|
-
return {
|
572
|
-
...super.toJSON(),
|
573
|
-
name: this.name,
|
574
|
-
icon: this.icon,
|
575
|
-
description: this.description,
|
576
|
-
rpcOrigins: this.rpcOrigins,
|
577
|
-
botPublic: this.botPublic,
|
578
|
-
botRequireCodeGrant: this.botRequireCodeGrant,
|
579
|
-
termsOfServiceURL: this.termsOfServiceURL,
|
580
|
-
privacyPolicyURL: this.privacyPolicyURL,
|
581
|
-
owner: this.owner?.toJSON(),
|
582
|
-
verifyKey: this.verifyKey,
|
583
|
-
team: this.team?.toJSON() ?? null,
|
584
|
-
guildId: this.guildId,
|
585
|
-
guild: this.guild?.toJSON(),
|
586
|
-
primarySKUId: this.primarySKUId,
|
587
|
-
slug: this.slug,
|
588
|
-
coverImage: this.coverImage,
|
589
|
-
flags: this.flags,
|
590
|
-
approximateGuildCount: this.approximateGuildCount,
|
591
|
-
redirectURIs: this.redirectURIs,
|
592
|
-
interactionsEndpointURL: this.interactionsEndpointURL,
|
593
|
-
roleConnectionsVerificationURL: this.roleConnectionsVerificationURL,
|
594
|
-
tags: this.tags,
|
595
|
-
installParams: this.installParams,
|
596
|
-
customInstallURL: this.customInstallURL,
|
597
|
-
};
|
598
|
-
}
|
599
|
-
}
|