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
package/lib/structures/Guild.ts
DELETED
@@ -1,1842 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
ApplicationCommand,
|
3
|
-
AuditLog,
|
4
|
-
AutoModerationRule,
|
5
|
-
Base,
|
6
|
-
Channel,
|
7
|
-
Emoji,
|
8
|
-
GuildMember,
|
9
|
-
GuildScheduledEvent,
|
10
|
-
GuildTemplate,
|
11
|
-
Integration,
|
12
|
-
Invite,
|
13
|
-
Role,
|
14
|
-
StageInstance,
|
15
|
-
Sticker,
|
16
|
-
User,
|
17
|
-
VoiceState,
|
18
|
-
Webhook,
|
19
|
-
} from ".";
|
20
|
-
import type { Client } from "../Client";
|
21
|
-
import { Endpoints, type File } from "../rest";
|
22
|
-
import type {
|
23
|
-
JSONAutoModerationAction,
|
24
|
-
JSONBan,
|
25
|
-
JSONDefaultReaction,
|
26
|
-
JSONForumTag,
|
27
|
-
JSONGuild,
|
28
|
-
JSONGuildApplicationCommandPermissions,
|
29
|
-
JSONGuildOnboarding,
|
30
|
-
JSONGuildPreview,
|
31
|
-
JSONGuildScheduledEventEntityMetadata,
|
32
|
-
JSONGuildScheduledEventUser,
|
33
|
-
JSONGuildTemplate,
|
34
|
-
JSONGuildWidget,
|
35
|
-
JSONGuildWidgetSettings,
|
36
|
-
JSONOnboardingPrompt,
|
37
|
-
JSONOverwrite,
|
38
|
-
PresenceUpdateEventFields,
|
39
|
-
JSONThreadMember,
|
40
|
-
JSONVoiceRegion,
|
41
|
-
JSONWelcomeScreen,
|
42
|
-
JSONWelcomeScreenChannel,
|
43
|
-
RawApplicationCommand,
|
44
|
-
RawAuditLog,
|
45
|
-
RawAutoModerationRule,
|
46
|
-
RawBan,
|
47
|
-
RawChannel,
|
48
|
-
RawEmoji,
|
49
|
-
RawGuild,
|
50
|
-
RawGuildApplicationCommandPermissions,
|
51
|
-
RawGuildMember,
|
52
|
-
RawGuildOnboarding,
|
53
|
-
RawGuildPreview,
|
54
|
-
RawGuildScheduledEvent,
|
55
|
-
RawGuildScheduledEventUser,
|
56
|
-
RawGuildTemplate,
|
57
|
-
RawGuildWidget,
|
58
|
-
RawGuildWidgetSettings,
|
59
|
-
RawIntegration,
|
60
|
-
RawInvite,
|
61
|
-
RawRole,
|
62
|
-
RawSticker,
|
63
|
-
RawThreadMember,
|
64
|
-
RawVoiceRegion,
|
65
|
-
RawWebhook,
|
66
|
-
RawWelcomeScreen,
|
67
|
-
RawGuildCreateEventExtraFields,
|
68
|
-
JSONGuildCreateEventExtraFields,
|
69
|
-
JSONTriggerMetadata,
|
70
|
-
JSONApplicationCommandOption,
|
71
|
-
} from "../types";
|
72
|
-
import type {
|
73
|
-
ActionTypes,
|
74
|
-
ApplicationCommandTypes,
|
75
|
-
ChannelTypes,
|
76
|
-
DefaultMessageNotificationLevel,
|
77
|
-
EventTypes,
|
78
|
-
ExplicitContentFilterLevel,
|
79
|
-
ForumLayoutTypes,
|
80
|
-
GuildFeatures,
|
81
|
-
GuildMemberFlags,
|
82
|
-
GuildNSFWLevel,
|
83
|
-
GuildScheduledEventEntityTypes,
|
84
|
-
GuildScheduledEventPrivacyLevel,
|
85
|
-
GuildScheduledEventStatus,
|
86
|
-
ImageWidgetStyleOptions,
|
87
|
-
Locale,
|
88
|
-
MFALevel,
|
89
|
-
OnboardingMode,
|
90
|
-
PremiumTier,
|
91
|
-
SortOrderTypes,
|
92
|
-
SystemChannelFlags,
|
93
|
-
TriggerTypes,
|
94
|
-
VerificationLevel,
|
95
|
-
VideoQualityModes,
|
96
|
-
} from "../constants";
|
97
|
-
import { File as UndiciFile, FormData } from "undici";
|
98
|
-
|
99
|
-
/** https://discord.com/developers/docs/resources/guild */
|
100
|
-
export class Guild extends Base {
|
101
|
-
protected override raw: RawGuild & Partial<RawGuildCreateEventExtraFields>;
|
102
|
-
name: string;
|
103
|
-
icon: string | null;
|
104
|
-
iconHash?: string | null;
|
105
|
-
splash: string | null;
|
106
|
-
discoverySplash: string | null;
|
107
|
-
owner?: boolean;
|
108
|
-
ownerId: string;
|
109
|
-
permissions?: string;
|
110
|
-
region?: string | null;
|
111
|
-
afkChannelId: string | null;
|
112
|
-
afkTimeout: number;
|
113
|
-
widgetEnabled?: boolean;
|
114
|
-
widgetChannelId?: string | null;
|
115
|
-
verificationLevel: VerificationLevel;
|
116
|
-
defaultMessageNotifications: DefaultMessageNotificationLevel;
|
117
|
-
explicitContentFilter: ExplicitContentFilterLevel;
|
118
|
-
roles: Array<Role>;
|
119
|
-
emojis: Array<Emoji>;
|
120
|
-
features: Array<GuildFeatures>;
|
121
|
-
mfaLevel: MFALevel;
|
122
|
-
applicationId: string | null;
|
123
|
-
systemChannelId: string | null;
|
124
|
-
systemChannelFlags: SystemChannelFlags;
|
125
|
-
rulesChannelId: string | null;
|
126
|
-
maxPresences?: number | null;
|
127
|
-
maxMembers?: number;
|
128
|
-
vanityURLCode: string | null;
|
129
|
-
description: string | null;
|
130
|
-
banner: string | null;
|
131
|
-
premiumTier: PremiumTier;
|
132
|
-
premiumSubscriptionCount?: number;
|
133
|
-
preferredLocale: string;
|
134
|
-
publicUpdatesChannelId: string | null;
|
135
|
-
maxVideoChannelUsers?: number;
|
136
|
-
maxStageVideoChannelUsers?: number;
|
137
|
-
approximateMemberCount?: number;
|
138
|
-
approximatePresenceCount?: number;
|
139
|
-
welcomeScreen?: JSONWelcomeScreen;
|
140
|
-
nsfwLevel: GuildNSFWLevel;
|
141
|
-
stickers?: Array<Sticker>;
|
142
|
-
premiumProgressBarEnabled: boolean;
|
143
|
-
safetyAlertsChannelId: string | null;
|
144
|
-
joinedAt?: string;
|
145
|
-
large?: boolean;
|
146
|
-
unavailable?: boolean;
|
147
|
-
memberCount?: number;
|
148
|
-
voiceStates?: Array<VoiceState>;
|
149
|
-
members?: Array<GuildMember>;
|
150
|
-
channels?: Array<Channel>;
|
151
|
-
threads?: Array<Channel>;
|
152
|
-
presences?: Array<PresenceUpdateEventFields>;
|
153
|
-
stageInstances?: Array<StageInstance>;
|
154
|
-
guildScheduledEvents?: Array<GuildScheduledEvent>;
|
155
|
-
|
156
|
-
constructor(
|
157
|
-
data: RawGuild & Partial<RawGuildCreateEventExtraFields>,
|
158
|
-
client: Client
|
159
|
-
) {
|
160
|
-
super(data.id, client);
|
161
|
-
|
162
|
-
this.raw = data;
|
163
|
-
this.name = data.name;
|
164
|
-
this.icon = data.icon;
|
165
|
-
this.splash = data.splash;
|
166
|
-
this.discoverySplash = data.discovery_splash;
|
167
|
-
this.ownerId = data.owner_id;
|
168
|
-
this.afkChannelId = data.afk_channel_id;
|
169
|
-
this.afkTimeout = data.afk_timeout;
|
170
|
-
this.verificationLevel = data.verification_level;
|
171
|
-
this.defaultMessageNotifications = data.default_message_notifications;
|
172
|
-
this.explicitContentFilter = data.explicit_content_filter;
|
173
|
-
this.roles = data.roles?.map((role) => new Role(role, client));
|
174
|
-
this.emojis = data.emojis?.map((emoji) => new Emoji(emoji, client));
|
175
|
-
this.features = data.features;
|
176
|
-
this.mfaLevel = data.mfa_level;
|
177
|
-
this.applicationId = data.application_id;
|
178
|
-
this.systemChannelId = data.system_channel_id;
|
179
|
-
this.systemChannelFlags = data.system_channel_flags;
|
180
|
-
this.rulesChannelId = data.rules_channel_id;
|
181
|
-
this.vanityURLCode = data.vanity_url_code;
|
182
|
-
this.description = data.description;
|
183
|
-
this.banner = data.banner;
|
184
|
-
this.premiumTier = data.premium_tier;
|
185
|
-
this.preferredLocale = data.preferred_locale;
|
186
|
-
this.publicUpdatesChannelId = data.public_updates_channel_id;
|
187
|
-
this.nsfwLevel = data.nsfw_level;
|
188
|
-
this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
|
189
|
-
this.safetyAlertsChannelId = data.safety_alerts_channel_id;
|
190
|
-
|
191
|
-
this.patch(data);
|
192
|
-
}
|
193
|
-
|
194
|
-
protected override patch(
|
195
|
-
data: RawGuild & Partial<RawGuildCreateEventExtraFields>
|
196
|
-
): void {
|
197
|
-
if (data.icon_hash !== undefined) this.iconHash = data.icon_hash;
|
198
|
-
if (data.owner !== undefined) this.owner = data.owner;
|
199
|
-
if (data.permissions !== undefined) this.permissions = data.permissions;
|
200
|
-
if (data.region !== undefined) this.region = data.region;
|
201
|
-
if (data.widget_enabled !== undefined)
|
202
|
-
this.widgetEnabled = data.widget_enabled;
|
203
|
-
if (data.widget_channel_id !== undefined)
|
204
|
-
this.widgetChannelId = data.widget_channel_id;
|
205
|
-
if (data.max_presences !== undefined)
|
206
|
-
this.maxPresences = data.max_presences;
|
207
|
-
if (data.max_members !== undefined) this.maxMembers = data.max_members;
|
208
|
-
if (data.premium_subscription_count !== undefined)
|
209
|
-
this.premiumSubscriptionCount = data.premium_subscription_count;
|
210
|
-
if (data.max_video_channel_users !== undefined)
|
211
|
-
this.maxVideoChannelUsers = data.max_video_channel_users;
|
212
|
-
if (data.max_stage_video_channel_users !== undefined)
|
213
|
-
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users;
|
214
|
-
if (data.approximate_member_count !== undefined)
|
215
|
-
this.approximateMemberCount = data.approximate_member_count;
|
216
|
-
if (data.approximate_presence_count !== undefined)
|
217
|
-
this.approximatePresenceCount = data.approximate_presence_count;
|
218
|
-
if (data.welcome_screen !== undefined)
|
219
|
-
this.welcomeScreen = {
|
220
|
-
description: data.welcome_screen.description,
|
221
|
-
welcomeChannels: data.welcome_screen.welcome_channels.map(
|
222
|
-
(welcomeChannel) => ({
|
223
|
-
channelId: welcomeChannel.channel_id,
|
224
|
-
description: welcomeChannel.description,
|
225
|
-
emojiId: welcomeChannel.emoji_id,
|
226
|
-
emojiName: welcomeChannel.emoji_name,
|
227
|
-
})
|
228
|
-
),
|
229
|
-
};
|
230
|
-
if (data.stickers !== undefined)
|
231
|
-
this.stickers = data.stickers.map(
|
232
|
-
(data) => new Sticker(data, this.client)
|
233
|
-
);
|
234
|
-
if (data.joined_at !== undefined) this.joinedAt = data.joined_at;
|
235
|
-
if (data.large !== undefined) this.large = data.large;
|
236
|
-
if (data.unavailable !== undefined) this.unavailable = data.unavailable;
|
237
|
-
if (data.member_count !== undefined) this.memberCount = data.member_count;
|
238
|
-
if (data.voice_states !== undefined)
|
239
|
-
this.voiceStates = data.voice_states.map(
|
240
|
-
(voiceState) => new VoiceState(voiceState, this.client)
|
241
|
-
);
|
242
|
-
if (data.members !== undefined)
|
243
|
-
this.members = data.members.map(
|
244
|
-
(member) => new GuildMember(member, this.client)
|
245
|
-
);
|
246
|
-
if (data.channels !== undefined)
|
247
|
-
this.channels = data.channels.map(
|
248
|
-
(channel) => new Channel(channel, this.client)
|
249
|
-
);
|
250
|
-
if (data.threads !== undefined)
|
251
|
-
this.threads = data.threads.map(
|
252
|
-
(thread) => new Channel(thread, this.client)
|
253
|
-
);
|
254
|
-
if (data.presences !== undefined)
|
255
|
-
this.presences = data.presences.map((presence) =>
|
256
|
-
this.client.util.presenceToREST(presence, this.client)
|
257
|
-
);
|
258
|
-
if (data.stage_instances !== undefined)
|
259
|
-
this.stageInstances = data.stage_instances.map(
|
260
|
-
(stageIntance) => new StageInstance(stageIntance, this.client)
|
261
|
-
);
|
262
|
-
if (data.guild_scheduled_events !== undefined)
|
263
|
-
this.guildScheduledEvents = data.guild_scheduled_events.map(
|
264
|
-
(guildScheduledEvent) =>
|
265
|
-
new GuildScheduledEvent(guildScheduledEvent, this.client)
|
266
|
-
);
|
267
|
-
}
|
268
|
-
|
269
|
-
/** https://discord.com/developers/docs/resources/guild#add-guild-member */
|
270
|
-
async addMember(
|
271
|
-
userId: string,
|
272
|
-
options: {
|
273
|
-
accessToken: string;
|
274
|
-
nick?: string;
|
275
|
-
roles?: Array<string>;
|
276
|
-
mute?: boolean;
|
277
|
-
deaf?: boolean;
|
278
|
-
}
|
279
|
-
): Promise<GuildMember | null> {
|
280
|
-
return this.client.rest
|
281
|
-
.put<RawGuildMember>(Endpoints.guildMember(this.id, userId), {
|
282
|
-
json: {
|
283
|
-
access_token: options.accessToken,
|
284
|
-
nick: options.nick,
|
285
|
-
roles: options.roles,
|
286
|
-
mute: options.mute,
|
287
|
-
deaf: options.deaf,
|
288
|
-
},
|
289
|
-
})
|
290
|
-
.then((response) => {
|
291
|
-
if (response !== null) {
|
292
|
-
return new GuildMember(response, this.client);
|
293
|
-
} else return null;
|
294
|
-
});
|
295
|
-
}
|
296
|
-
|
297
|
-
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
298
|
-
addMemberRole(userId: string, roleId: string, reason?: string): void {
|
299
|
-
this.client.rest.put(Endpoints.guildMemberRole(this.id, userId, roleId), {
|
300
|
-
reason,
|
301
|
-
});
|
302
|
-
}
|
303
|
-
|
304
|
-
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
305
|
-
async beginGuildPrune(
|
306
|
-
options: {
|
307
|
-
days: number;
|
308
|
-
computePruneCount: boolean;
|
309
|
-
includeRoles: Array<string>;
|
310
|
-
reason?: string;
|
311
|
-
},
|
312
|
-
reason?: string
|
313
|
-
): Promise<number> {
|
314
|
-
return this.client.rest.post<number>(Endpoints.guildPrune(this.id), {
|
315
|
-
json: {
|
316
|
-
days: options.days,
|
317
|
-
compute_prune_count: options.computePruneCount,
|
318
|
-
include_roles: options.includeRoles,
|
319
|
-
reason: options.reason,
|
320
|
-
},
|
321
|
-
reason,
|
322
|
-
});
|
323
|
-
}
|
324
|
-
|
325
|
-
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
326
|
-
async createApplicationCommand(
|
327
|
-
applicationId: string,
|
328
|
-
options: {
|
329
|
-
name: string;
|
330
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
331
|
-
description?: string;
|
332
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
333
|
-
options?: Array<JSONApplicationCommandOption>;
|
334
|
-
defaultMemberPermissions?: string | null;
|
335
|
-
dmPermission?: boolean;
|
336
|
-
defaultPermission?: boolean | null;
|
337
|
-
type?: ApplicationCommandTypes;
|
338
|
-
nsfw?: boolean;
|
339
|
-
}
|
340
|
-
): Promise<ApplicationCommand> {
|
341
|
-
return new ApplicationCommand(
|
342
|
-
await this.client.rest.post<RawApplicationCommand>(
|
343
|
-
Endpoints.applicationGuildCommands(applicationId, this.id),
|
344
|
-
{
|
345
|
-
json: this.client.util.applicationCommandToRaw(options),
|
346
|
-
}
|
347
|
-
),
|
348
|
-
this.client
|
349
|
-
);
|
350
|
-
}
|
351
|
-
|
352
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
353
|
-
async createAutoModerationRule(
|
354
|
-
options: {
|
355
|
-
name: string;
|
356
|
-
eventType: EventTypes;
|
357
|
-
triggerType: TriggerTypes;
|
358
|
-
triggerMetadata?: JSONTriggerMetadata;
|
359
|
-
actions: Array<JSONAutoModerationAction>;
|
360
|
-
enabled?: boolean;
|
361
|
-
exemptRoles?: Array<string>;
|
362
|
-
exemptChannels?: Array<string>;
|
363
|
-
},
|
364
|
-
reason?: string
|
365
|
-
): Promise<AutoModerationRule> {
|
366
|
-
return new AutoModerationRule(
|
367
|
-
await this.client.rest.post<RawAutoModerationRule>(
|
368
|
-
Endpoints.guildAutoModerationRules(this.id),
|
369
|
-
{
|
370
|
-
json: {
|
371
|
-
name: options.name,
|
372
|
-
event_type: options.eventType,
|
373
|
-
trigger_type: options.triggerType,
|
374
|
-
trigger_metadata: options.triggerMetadata,
|
375
|
-
actions: options.actions.map((action) => ({
|
376
|
-
type: action.type,
|
377
|
-
metadata: {
|
378
|
-
channel_id: action.metadata.channelId,
|
379
|
-
duration_seconds: action.metadata.durationSeconds,
|
380
|
-
custom_message: action.metadata.customMessage,
|
381
|
-
},
|
382
|
-
})),
|
383
|
-
enabled: options.enabled,
|
384
|
-
exempt_roles: options.exemptRoles,
|
385
|
-
exempt_channels: options.exemptChannels,
|
386
|
-
},
|
387
|
-
reason,
|
388
|
-
}
|
389
|
-
),
|
390
|
-
this.client
|
391
|
-
);
|
392
|
-
}
|
393
|
-
|
394
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
395
|
-
createBan(
|
396
|
-
userId: string,
|
397
|
-
options?: {
|
398
|
-
deleteMessageDays?: number;
|
399
|
-
deleteMessageSeconds?: number;
|
400
|
-
},
|
401
|
-
reason?: string
|
402
|
-
): void {
|
403
|
-
this.client.rest.put(Endpoints.guildBan(this.id, userId), {
|
404
|
-
json: {
|
405
|
-
delete_message_days: options?.deleteMessageDays,
|
406
|
-
delete_message_seconds: options?.deleteMessageSeconds,
|
407
|
-
},
|
408
|
-
reason,
|
409
|
-
});
|
410
|
-
}
|
411
|
-
|
412
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
413
|
-
async createChannel(
|
414
|
-
options: {
|
415
|
-
name: string | null;
|
416
|
-
type?: ChannelTypes;
|
417
|
-
topic?: string | null;
|
418
|
-
bitrate?: number;
|
419
|
-
userLimit?: number;
|
420
|
-
rateLimitPerUser?: number;
|
421
|
-
position?: number;
|
422
|
-
permissionOverwrites?: Array<JSONOverwrite>;
|
423
|
-
parentId?: string | null;
|
424
|
-
nsfw?: boolean;
|
425
|
-
rtcRegion?: string | null;
|
426
|
-
videoQualityMode?: VideoQualityModes;
|
427
|
-
defaultAutoArchiveDuration?: number;
|
428
|
-
defaultReactionEmoji?: JSONDefaultReaction | null;
|
429
|
-
availableTags?: Array<JSONForumTag>;
|
430
|
-
defaultSortOrder?: SortOrderTypes | null;
|
431
|
-
defaultForumLayout?: ForumLayoutTypes;
|
432
|
-
defaultThreadRateLimitPerUser?: number;
|
433
|
-
},
|
434
|
-
reason?: string
|
435
|
-
): Promise<Channel> {
|
436
|
-
return new Channel(
|
437
|
-
await this.client.rest.post<RawChannel>(
|
438
|
-
Endpoints.guildChannels(this.id),
|
439
|
-
{
|
440
|
-
json: {
|
441
|
-
name: options.name,
|
442
|
-
type: options.type,
|
443
|
-
topic: options.topic,
|
444
|
-
bitrate: options.bitrate,
|
445
|
-
user_limit: options.userLimit,
|
446
|
-
rate_limit_per_user: options.rateLimitPerUser,
|
447
|
-
position: options.position,
|
448
|
-
permission_overwrites: options.permissionOverwrites,
|
449
|
-
parent_id: options.parentId,
|
450
|
-
nsfw: options.nsfw,
|
451
|
-
rtc_region: options.rtcRegion,
|
452
|
-
video_quality_mode: options.videoQualityMode,
|
453
|
-
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
454
|
-
default_reaction_emoji: {
|
455
|
-
emojiId: options.defaultReactionEmoji?.emojiId,
|
456
|
-
emojiName: options.defaultReactionEmoji?.emojiName,
|
457
|
-
},
|
458
|
-
available_tags: options.availableTags,
|
459
|
-
default_sort_order: options.defaultSortOrder,
|
460
|
-
default_forum_layout: options.defaultForumLayout,
|
461
|
-
default_thread_rate_limit_per_user:
|
462
|
-
options.defaultThreadRateLimitPerUser,
|
463
|
-
},
|
464
|
-
reason,
|
465
|
-
}
|
466
|
-
),
|
467
|
-
this.client
|
468
|
-
);
|
469
|
-
}
|
470
|
-
|
471
|
-
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
472
|
-
async createEmoji(
|
473
|
-
options: {
|
474
|
-
name: string;
|
475
|
-
image: string;
|
476
|
-
roles: Array<string>;
|
477
|
-
},
|
478
|
-
reason?: string
|
479
|
-
): Promise<Emoji> {
|
480
|
-
return new Emoji(
|
481
|
-
await this.client.rest.post<RawEmoji>(Endpoints.guildEmojis(this.id), {
|
482
|
-
json: {
|
483
|
-
name: options.name,
|
484
|
-
image: options.image,
|
485
|
-
roles: options.roles,
|
486
|
-
},
|
487
|
-
reason,
|
488
|
-
}),
|
489
|
-
this.client
|
490
|
-
);
|
491
|
-
}
|
492
|
-
|
493
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
494
|
-
async createRole(
|
495
|
-
options: {
|
496
|
-
name: string;
|
497
|
-
permissions: string;
|
498
|
-
color: number;
|
499
|
-
hoist: boolean;
|
500
|
-
icon: string | null;
|
501
|
-
unicodeEmoji: string | null;
|
502
|
-
mentionable: boolean;
|
503
|
-
},
|
504
|
-
reason?: string
|
505
|
-
): Promise<Role> {
|
506
|
-
return new Role(
|
507
|
-
await this.client.rest.post<RawRole>(Endpoints.guildRoles(this.id), {
|
508
|
-
json: {
|
509
|
-
name: options.name,
|
510
|
-
permissions: options.permissions,
|
511
|
-
color: options.color,
|
512
|
-
hoist: options.hoist,
|
513
|
-
icon: options.icon,
|
514
|
-
unicode_emoji: options.unicodeEmoji,
|
515
|
-
mentionable: options.mentionable,
|
516
|
-
},
|
517
|
-
reason,
|
518
|
-
}),
|
519
|
-
this.client
|
520
|
-
);
|
521
|
-
}
|
522
|
-
|
523
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
524
|
-
async createScheduledEvent(
|
525
|
-
options: {
|
526
|
-
channelId?: string | null;
|
527
|
-
entityMetadata?: JSONGuildScheduledEventEntityMetadata | null;
|
528
|
-
name: string;
|
529
|
-
privacyLevel: GuildScheduledEventPrivacyLevel;
|
530
|
-
scheduledStartTime: string;
|
531
|
-
scheduledEndTime?: string | null;
|
532
|
-
description?: string | null;
|
533
|
-
entityType: GuildScheduledEventEntityTypes;
|
534
|
-
image?: string;
|
535
|
-
},
|
536
|
-
reason?: string
|
537
|
-
): Promise<GuildScheduledEvent> {
|
538
|
-
return new GuildScheduledEvent(
|
539
|
-
await this.client.rest.post<RawGuildScheduledEvent>(
|
540
|
-
Endpoints.guildScheduledEvents(this.id),
|
541
|
-
{
|
542
|
-
json: {
|
543
|
-
channel_id: options.channelId,
|
544
|
-
entity_metadata: options.entityMetadata,
|
545
|
-
name: options.name,
|
546
|
-
privacy_level: options.privacyLevel,
|
547
|
-
scheduled_start_time: options.scheduledEndTime,
|
548
|
-
scheduled_end_time: options.scheduledEndTime,
|
549
|
-
description: options.description,
|
550
|
-
entity_type: options.entityType,
|
551
|
-
image: options.image,
|
552
|
-
},
|
553
|
-
reason,
|
554
|
-
}
|
555
|
-
),
|
556
|
-
this.client
|
557
|
-
);
|
558
|
-
}
|
559
|
-
|
560
|
-
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
561
|
-
async createSticker(
|
562
|
-
options: {
|
563
|
-
name: string;
|
564
|
-
description: string;
|
565
|
-
tags: string;
|
566
|
-
file: File;
|
567
|
-
},
|
568
|
-
reason?: string
|
569
|
-
): Promise<Sticker> {
|
570
|
-
const formData = new FormData();
|
571
|
-
|
572
|
-
formData.set("name", options.name);
|
573
|
-
formData.set("description", options.description);
|
574
|
-
formData.set("tags", options.tags);
|
575
|
-
formData.set(
|
576
|
-
"file",
|
577
|
-
new UndiciFile([options.file.contents], options.file.name)
|
578
|
-
);
|
579
|
-
|
580
|
-
return this.client.rest
|
581
|
-
.post<RawSticker>(Endpoints.guildStickers(this.id), {
|
582
|
-
form: formData,
|
583
|
-
reason,
|
584
|
-
})
|
585
|
-
.then((response) => new Sticker(response, this.client));
|
586
|
-
}
|
587
|
-
|
588
|
-
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
589
|
-
async createTemplate(options: {
|
590
|
-
name: string;
|
591
|
-
description?: string | null;
|
592
|
-
}): Promise<GuildTemplate> {
|
593
|
-
return new GuildTemplate(
|
594
|
-
await this.client.rest.post<RawGuildTemplate>(
|
595
|
-
Endpoints.guildTemplates(this.id),
|
596
|
-
{
|
597
|
-
json: {
|
598
|
-
name: options.name,
|
599
|
-
description: options.description,
|
600
|
-
},
|
601
|
-
}
|
602
|
-
),
|
603
|
-
this.client
|
604
|
-
);
|
605
|
-
}
|
606
|
-
|
607
|
-
/** https://discord.com/developers/docs/resources/guild#delete-guild */
|
608
|
-
delete(): void {
|
609
|
-
this.client.rest.delete(Endpoints.guild(this.id));
|
610
|
-
}
|
611
|
-
|
612
|
-
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
613
|
-
deleteApplicationCommand(applicationId: string, commandId: string): void {
|
614
|
-
this.client.rest.delete(
|
615
|
-
Endpoints.applicationGuildCommand(applicationId, this.id, commandId)
|
616
|
-
);
|
617
|
-
}
|
618
|
-
|
619
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
620
|
-
deleteAutoModerationRule(ruleId: string, reason?: string): void {
|
621
|
-
this.client.rest.delete(
|
622
|
-
Endpoints.guildAutoModerationRule(this.id, ruleId),
|
623
|
-
{
|
624
|
-
reason,
|
625
|
-
}
|
626
|
-
);
|
627
|
-
}
|
628
|
-
|
629
|
-
/** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
|
630
|
-
deleteEmoji(emojiId: string, reason?: string): void {
|
631
|
-
this.client.rest.delete(Endpoints.guildEmoji(this.id, emojiId), {
|
632
|
-
reason,
|
633
|
-
});
|
634
|
-
}
|
635
|
-
|
636
|
-
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
637
|
-
deleteIntegration(integrationId: string, reason?: string): void {
|
638
|
-
this.client.rest.delete(
|
639
|
-
Endpoints.guildIntegration(this.id, integrationId),
|
640
|
-
{
|
641
|
-
reason,
|
642
|
-
}
|
643
|
-
);
|
644
|
-
}
|
645
|
-
|
646
|
-
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
647
|
-
deleteRole(roleId: string, reason?: string): void {
|
648
|
-
this.client.rest.delete(Endpoints.guildRole(this.id, roleId), {
|
649
|
-
reason,
|
650
|
-
});
|
651
|
-
}
|
652
|
-
|
653
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
654
|
-
deleteScheduledEvent(scheduledEventId: string): void {
|
655
|
-
this.client.rest.delete(
|
656
|
-
Endpoints.guildScheduledEvent(this.id, scheduledEventId)
|
657
|
-
);
|
658
|
-
}
|
659
|
-
|
660
|
-
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
661
|
-
deleteSticker(stickerId: string, reason?: string): void {
|
662
|
-
this.client.rest.delete(Endpoints.guildSticker(this.id, stickerId), {
|
663
|
-
reason,
|
664
|
-
});
|
665
|
-
}
|
666
|
-
|
667
|
-
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
668
|
-
async deleteTemplate(code: string): Promise<JSONGuildTemplate> {
|
669
|
-
return this.client.rest
|
670
|
-
.delete<RawGuildTemplate>(Endpoints.guildTemplate(this.id, code))
|
671
|
-
.then((response) => new GuildTemplate(response, this.client).toJSON());
|
672
|
-
}
|
673
|
-
|
674
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
675
|
-
async edit(
|
676
|
-
options: {
|
677
|
-
name?: string;
|
678
|
-
region?: string | null;
|
679
|
-
verificationLevel?: VerificationLevel;
|
680
|
-
defaultMessageNotifications?: DefaultMessageNotificationLevel;
|
681
|
-
explicitContentFilter?: ExplicitContentFilterLevel;
|
682
|
-
afkChannelId?: string | null;
|
683
|
-
afkTimeout?: number;
|
684
|
-
icon?: string | null;
|
685
|
-
ownerId?: string;
|
686
|
-
splash?: string | null;
|
687
|
-
discoverySplash?: string | null;
|
688
|
-
banner?: string | null;
|
689
|
-
systemChannelId?: string | null;
|
690
|
-
systemChannelFlags?: SystemChannelFlags;
|
691
|
-
rulesChannelId?: string | null;
|
692
|
-
publicUpdatesChannelId?: string | null;
|
693
|
-
preferredLocale?: string;
|
694
|
-
features?: Array<GuildFeatures>;
|
695
|
-
description?: string | null;
|
696
|
-
premiumProgressBarEnabled?: boolean;
|
697
|
-
safetyAlertsChannelId?: string | null;
|
698
|
-
},
|
699
|
-
reason?: string
|
700
|
-
): Promise<Guild> {
|
701
|
-
return new Guild(
|
702
|
-
await this.client.rest.patch<RawGuild>(Endpoints.guild(this.id), {
|
703
|
-
json: {
|
704
|
-
name: options.name,
|
705
|
-
region: options.region,
|
706
|
-
verification_level: options.verificationLevel,
|
707
|
-
default_message_notifications: options.defaultMessageNotifications,
|
708
|
-
explicit_content_filter: options.explicitContentFilter,
|
709
|
-
afk_channel_id: options.afkChannelId,
|
710
|
-
afk_timeout: options.afkTimeout,
|
711
|
-
icon: options.icon,
|
712
|
-
owner_id: options.ownerId,
|
713
|
-
splash: options.splash,
|
714
|
-
discovery_splash: options.discoverySplash,
|
715
|
-
banner: options.banner,
|
716
|
-
system_channel_id: options.systemChannelId,
|
717
|
-
system_channel_flags: options.systemChannelFlags,
|
718
|
-
rules_channel_id: options.rulesChannelId,
|
719
|
-
public_updates_channel_id: options.publicUpdatesChannelId,
|
720
|
-
preferred_locale: options.preferredLocale,
|
721
|
-
features: options.features,
|
722
|
-
description: options.description,
|
723
|
-
premium_progress_bar_enabled: options.premiumProgressBarEnabled,
|
724
|
-
safety_alerts_channel_id: options.safetyAlertsChannelId,
|
725
|
-
},
|
726
|
-
reason,
|
727
|
-
}),
|
728
|
-
this.client
|
729
|
-
);
|
730
|
-
}
|
731
|
-
|
732
|
-
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
733
|
-
async editApplicationCommand(
|
734
|
-
applicationId: string,
|
735
|
-
commandId: string,
|
736
|
-
options: {
|
737
|
-
name?: string;
|
738
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
739
|
-
description?: string;
|
740
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
741
|
-
options?: Array<JSONApplicationCommandOption>;
|
742
|
-
defaultMemberPermissions?: string | null;
|
743
|
-
defaultPermission?: boolean | null;
|
744
|
-
dmPermission?: boolean;
|
745
|
-
nsfw?: boolean;
|
746
|
-
}
|
747
|
-
): Promise<ApplicationCommand> {
|
748
|
-
return new ApplicationCommand(
|
749
|
-
await this.client.rest.patch<RawApplicationCommand>(
|
750
|
-
Endpoints.applicationGuildCommand(applicationId, this.id, commandId),
|
751
|
-
{
|
752
|
-
json: this.client.util.applicationCommandToRaw(options),
|
753
|
-
}
|
754
|
-
),
|
755
|
-
this.client
|
756
|
-
);
|
757
|
-
}
|
758
|
-
|
759
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
760
|
-
async editAutoModerationRule(
|
761
|
-
ruleId: string,
|
762
|
-
options: {
|
763
|
-
name?: string;
|
764
|
-
eventType?: EventTypes;
|
765
|
-
triggerType?: TriggerTypes;
|
766
|
-
triggerMetadata?: JSONTriggerMetadata;
|
767
|
-
actions?: Array<JSONAutoModerationAction>;
|
768
|
-
enabled?: boolean;
|
769
|
-
exemptRoles?: Array<string>;
|
770
|
-
exemptChannels?: Array<string>;
|
771
|
-
},
|
772
|
-
reason?: string
|
773
|
-
): Promise<AutoModerationRule> {
|
774
|
-
return new AutoModerationRule(
|
775
|
-
await this.client.rest.patch<RawAutoModerationRule>(
|
776
|
-
Endpoints.guildAutoModerationRule(this.id, ruleId),
|
777
|
-
{
|
778
|
-
json: {
|
779
|
-
name: options.name,
|
780
|
-
event_type: options.eventType,
|
781
|
-
trigger_type: options.triggerType,
|
782
|
-
trigger_metadata: options.triggerMetadata,
|
783
|
-
actions: options.actions?.map((action) => ({
|
784
|
-
type: action.type,
|
785
|
-
metadata: {
|
786
|
-
channel_id: action.metadata.channelId,
|
787
|
-
duration_seconds: action.metadata.durationSeconds,
|
788
|
-
custom_message: action.metadata.customMessage,
|
789
|
-
},
|
790
|
-
})),
|
791
|
-
enabled: options.enabled,
|
792
|
-
exempt_roles: options.exemptRoles,
|
793
|
-
exempt_channels: options.exemptChannels,
|
794
|
-
},
|
795
|
-
reason,
|
796
|
-
}
|
797
|
-
),
|
798
|
-
this.client
|
799
|
-
);
|
800
|
-
}
|
801
|
-
|
802
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
803
|
-
editChannelPositions(
|
804
|
-
options: Array<{
|
805
|
-
id: string;
|
806
|
-
position?: number | null;
|
807
|
-
lockPermissions?: boolean | null;
|
808
|
-
parentId?: string | null;
|
809
|
-
}>
|
810
|
-
): void {
|
811
|
-
this.client.rest.patch(Endpoints.guildChannels(this.id), {
|
812
|
-
json: options.map((data) => ({
|
813
|
-
id: data.id,
|
814
|
-
position: data.position,
|
815
|
-
lock_permissions: data.lockPermissions,
|
816
|
-
parent_id: data.parentId,
|
817
|
-
})),
|
818
|
-
});
|
819
|
-
}
|
820
|
-
|
821
|
-
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
822
|
-
async editCurrentMember(
|
823
|
-
options: {
|
824
|
-
nick: string | null;
|
825
|
-
},
|
826
|
-
reason?: string
|
827
|
-
): Promise<GuildMember> {
|
828
|
-
return new GuildMember(
|
829
|
-
await this.client.rest.patch(Endpoints.guildMember(this.id), {
|
830
|
-
json: {
|
831
|
-
nick: options.nick,
|
832
|
-
},
|
833
|
-
reason,
|
834
|
-
}),
|
835
|
-
this.client
|
836
|
-
);
|
837
|
-
}
|
838
|
-
|
839
|
-
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
840
|
-
editCurrentUserVoiceState(options: {
|
841
|
-
channelId?: string;
|
842
|
-
suppress?: boolean;
|
843
|
-
requestToSpeakTimestamp?: string | null;
|
844
|
-
}): void {
|
845
|
-
this.client.rest.patch(Endpoints.guildVoiceState(this.id), {
|
846
|
-
json: {
|
847
|
-
channel_id: options.channelId,
|
848
|
-
suppress: options.suppress,
|
849
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
850
|
-
},
|
851
|
-
});
|
852
|
-
}
|
853
|
-
|
854
|
-
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
855
|
-
async editEmoji(
|
856
|
-
emojiId: string,
|
857
|
-
options: {
|
858
|
-
name?: string;
|
859
|
-
roles?: Array<string> | null;
|
860
|
-
},
|
861
|
-
reason?: string
|
862
|
-
): Promise<Emoji> {
|
863
|
-
return new Emoji(
|
864
|
-
await this.client.rest.patch<RawEmoji>(
|
865
|
-
Endpoints.guildEmoji(this.id, emojiId),
|
866
|
-
{
|
867
|
-
json: {
|
868
|
-
name: options.name,
|
869
|
-
roles: options.roles,
|
870
|
-
},
|
871
|
-
reason,
|
872
|
-
}
|
873
|
-
),
|
874
|
-
this.client
|
875
|
-
);
|
876
|
-
}
|
877
|
-
|
878
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
879
|
-
async editMember(
|
880
|
-
userId: string,
|
881
|
-
options: {
|
882
|
-
nick?: string | null;
|
883
|
-
roles?: Array<string> | null;
|
884
|
-
mute?: boolean | null;
|
885
|
-
deaf?: boolean | null;
|
886
|
-
channelId?: string | null;
|
887
|
-
communicationDisabledUntil?: number | null;
|
888
|
-
flags?: GuildMemberFlags;
|
889
|
-
},
|
890
|
-
reason?: string
|
891
|
-
): Promise<GuildMember> {
|
892
|
-
return new GuildMember(
|
893
|
-
await this.client.rest.patch(Endpoints.guildMember(this.id, userId), {
|
894
|
-
json: {
|
895
|
-
nick: options.nick,
|
896
|
-
roles: options.roles,
|
897
|
-
mute: options.mute,
|
898
|
-
deaf: options.deaf,
|
899
|
-
channel_id: options.channelId,
|
900
|
-
communication_disabled_until: options.communicationDisabledUntil,
|
901
|
-
flags: options.flags,
|
902
|
-
},
|
903
|
-
reason,
|
904
|
-
}),
|
905
|
-
this.client
|
906
|
-
);
|
907
|
-
}
|
908
|
-
|
909
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
910
|
-
async editMFALevel(
|
911
|
-
options: {
|
912
|
-
level: MFALevel;
|
913
|
-
},
|
914
|
-
reason?: string
|
915
|
-
): Promise<number> {
|
916
|
-
return this.client.rest.post<number>(Endpoints.guildMFA(this.id), {
|
917
|
-
json: {
|
918
|
-
level: options.level,
|
919
|
-
},
|
920
|
-
reason,
|
921
|
-
});
|
922
|
-
}
|
923
|
-
|
924
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
|
925
|
-
editOnboarding(
|
926
|
-
options: {
|
927
|
-
prompts: Array<JSONOnboardingPrompt>;
|
928
|
-
defaultChannelIds: Array<string>;
|
929
|
-
enabled: boolean;
|
930
|
-
mode: OnboardingMode;
|
931
|
-
},
|
932
|
-
reason?: string
|
933
|
-
): void {
|
934
|
-
this.client.rest.patch(Endpoints.guildOnboarding(this.id), {
|
935
|
-
json: {
|
936
|
-
prompts: options.prompts.map((prompt) => ({
|
937
|
-
id: prompt.id,
|
938
|
-
type: prompt.type,
|
939
|
-
options: prompt.options.map((option) => ({
|
940
|
-
id: option.id,
|
941
|
-
channel_ids: option.channelIds,
|
942
|
-
role_ids: option.roleIds,
|
943
|
-
emoji:
|
944
|
-
option.emoji !== undefined
|
945
|
-
? {
|
946
|
-
id: option.emoji.id,
|
947
|
-
name: option.emoji.name,
|
948
|
-
roles: option.emoji.roles,
|
949
|
-
user: option.emoji.user,
|
950
|
-
require_colons: option.emoji.requireColons,
|
951
|
-
managed: option.emoji.managed,
|
952
|
-
animated: option.emoji.animated,
|
953
|
-
available: option.emoji.available,
|
954
|
-
}
|
955
|
-
: undefined,
|
956
|
-
emoji_id: option.emojiId,
|
957
|
-
emoji_name: option.emojiName,
|
958
|
-
emoji_animated: option.emojiAnimated,
|
959
|
-
title: option.title,
|
960
|
-
description: option.description,
|
961
|
-
})),
|
962
|
-
title: prompt.title,
|
963
|
-
single_select: prompt.singleSelect,
|
964
|
-
required: prompt.required,
|
965
|
-
in_onboarding: prompt.inOnboarding,
|
966
|
-
})),
|
967
|
-
},
|
968
|
-
reason,
|
969
|
-
});
|
970
|
-
}
|
971
|
-
|
972
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-role */
|
973
|
-
async editRole(
|
974
|
-
roleId: string,
|
975
|
-
options?: {
|
976
|
-
name?: string | null;
|
977
|
-
permissions?: string | null;
|
978
|
-
color?: number | null;
|
979
|
-
hoist?: boolean | null;
|
980
|
-
icon?: string | null;
|
981
|
-
unicodeEmoji?: string | null;
|
982
|
-
mentionable?: boolean | null;
|
983
|
-
},
|
984
|
-
reason?: string
|
985
|
-
): Promise<Role> {
|
986
|
-
return new Role(
|
987
|
-
await this.client.rest.patch<RawRole>(
|
988
|
-
Endpoints.guildRole(this.id, roleId),
|
989
|
-
{
|
990
|
-
json: {
|
991
|
-
name: options?.name,
|
992
|
-
permissions: options?.permissions,
|
993
|
-
color: options?.color,
|
994
|
-
hoist: options?.hoist,
|
995
|
-
icon: options?.icon,
|
996
|
-
unicode_emoji: options?.unicodeEmoji,
|
997
|
-
mentionable: options?.mentionable,
|
998
|
-
},
|
999
|
-
reason,
|
1000
|
-
}
|
1001
|
-
),
|
1002
|
-
this.client
|
1003
|
-
);
|
1004
|
-
}
|
1005
|
-
|
1006
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
1007
|
-
async editRolePositions(
|
1008
|
-
options: Array<{
|
1009
|
-
id: string;
|
1010
|
-
position?: number | null;
|
1011
|
-
}>
|
1012
|
-
): Promise<Array<Role>> {
|
1013
|
-
return this.client.rest
|
1014
|
-
.patch<Array<RawRole>>(Endpoints.guildRoles(this.id), {
|
1015
|
-
json: options.map((data) => ({
|
1016
|
-
id: data.id,
|
1017
|
-
position: data.position,
|
1018
|
-
})),
|
1019
|
-
})
|
1020
|
-
.then((response) => response.map((data) => new Role(data, this.client)));
|
1021
|
-
}
|
1022
|
-
|
1023
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
1024
|
-
async editScheduledEvent(
|
1025
|
-
scheduledEventId: string,
|
1026
|
-
options: {
|
1027
|
-
channelId?: string | null;
|
1028
|
-
entityMetadata?: JSONGuildScheduledEventEntityMetadata | null;
|
1029
|
-
name?: string;
|
1030
|
-
privacyLevel?: GuildScheduledEventPrivacyLevel;
|
1031
|
-
scheduledStartTime?: string;
|
1032
|
-
scheduledEndTime?: string;
|
1033
|
-
description?: string | null;
|
1034
|
-
entityType?: GuildScheduledEventEntityTypes;
|
1035
|
-
status?: GuildScheduledEventStatus;
|
1036
|
-
image?: string;
|
1037
|
-
},
|
1038
|
-
reason?: string
|
1039
|
-
): Promise<GuildScheduledEvent> {
|
1040
|
-
return new GuildScheduledEvent(
|
1041
|
-
await this.client.rest.patch<RawGuildScheduledEvent>(
|
1042
|
-
Endpoints.guildScheduledEvent(this.id, scheduledEventId),
|
1043
|
-
{
|
1044
|
-
json: {
|
1045
|
-
channel_id: options.channelId,
|
1046
|
-
entity_metadata: options.entityMetadata,
|
1047
|
-
name: options.name,
|
1048
|
-
privacy_level: options.privacyLevel,
|
1049
|
-
scheduled_start_time: options.scheduledStartTime,
|
1050
|
-
scheduled_end_time: options.scheduledEndTime,
|
1051
|
-
description: options.description,
|
1052
|
-
entityType: options.entityType,
|
1053
|
-
status: options.status,
|
1054
|
-
image: options.image,
|
1055
|
-
},
|
1056
|
-
reason,
|
1057
|
-
}
|
1058
|
-
),
|
1059
|
-
this.client
|
1060
|
-
);
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
1064
|
-
async editSticker(
|
1065
|
-
stickerId: string,
|
1066
|
-
options: {
|
1067
|
-
name?: string;
|
1068
|
-
description?: string;
|
1069
|
-
tags?: string;
|
1070
|
-
},
|
1071
|
-
reason?: string
|
1072
|
-
): Promise<Sticker> {
|
1073
|
-
return this.client.rest
|
1074
|
-
.patch<RawSticker>(Endpoints.guildSticker(this.id, stickerId), {
|
1075
|
-
json: {
|
1076
|
-
name: options.name,
|
1077
|
-
description: options.description,
|
1078
|
-
tags: options.tags,
|
1079
|
-
},
|
1080
|
-
reason,
|
1081
|
-
})
|
1082
|
-
.then((response) => new Sticker(response, this.client));
|
1083
|
-
}
|
1084
|
-
|
1085
|
-
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1086
|
-
async editTemplate(
|
1087
|
-
code: string,
|
1088
|
-
options: {
|
1089
|
-
name?: string;
|
1090
|
-
description?: string | null;
|
1091
|
-
}
|
1092
|
-
): Promise<GuildTemplate> {
|
1093
|
-
return new GuildTemplate(
|
1094
|
-
await this.client.rest.patch<RawGuildTemplate>(
|
1095
|
-
Endpoints.guildTemplate(this.id, code),
|
1096
|
-
{
|
1097
|
-
json: {
|
1098
|
-
name: options.name,
|
1099
|
-
description: options.description,
|
1100
|
-
},
|
1101
|
-
}
|
1102
|
-
),
|
1103
|
-
this.client
|
1104
|
-
);
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
1108
|
-
editUserVoiceState(
|
1109
|
-
userId: string,
|
1110
|
-
options: {
|
1111
|
-
channelId?: string;
|
1112
|
-
suppress?: boolean;
|
1113
|
-
requestToSpeakTimestamp?: string | null;
|
1114
|
-
}
|
1115
|
-
): void {
|
1116
|
-
this.client.rest.patch(Endpoints.guildVoiceState(this.id, userId), {
|
1117
|
-
json: {
|
1118
|
-
channel_id: options.channelId,
|
1119
|
-
suppress: options.suppress,
|
1120
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
1121
|
-
},
|
1122
|
-
});
|
1123
|
-
}
|
1124
|
-
|
1125
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
1126
|
-
async editWelcomeScreen(
|
1127
|
-
options: {
|
1128
|
-
enabled?: boolean | null;
|
1129
|
-
welcomeChannels?: Array<JSONWelcomeScreenChannel> | null;
|
1130
|
-
description?: string | null;
|
1131
|
-
},
|
1132
|
-
reason?: string
|
1133
|
-
): Promise<JSONWelcomeScreen> {
|
1134
|
-
return this.client.rest
|
1135
|
-
.patch<RawWelcomeScreen>(Endpoints.guildWelcomeScreen(this.id), {
|
1136
|
-
json: {
|
1137
|
-
enabled: options.enabled,
|
1138
|
-
welcome_channels: options.welcomeChannels,
|
1139
|
-
description: options.description,
|
1140
|
-
},
|
1141
|
-
reason,
|
1142
|
-
})
|
1143
|
-
.then((response) => ({
|
1144
|
-
description: response.description,
|
1145
|
-
welcomeChannels: response.welcome_channels.map((data) => ({
|
1146
|
-
channelId: data.channel_id,
|
1147
|
-
description: data.description,
|
1148
|
-
emojiId: data.emoji_id,
|
1149
|
-
emojiName: data.emoji_name,
|
1150
|
-
})),
|
1151
|
-
}));
|
1152
|
-
}
|
1153
|
-
|
1154
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
|
1155
|
-
async editWidget(
|
1156
|
-
options: {
|
1157
|
-
enabled?: boolean;
|
1158
|
-
channelId?: boolean;
|
1159
|
-
},
|
1160
|
-
reason?: string
|
1161
|
-
): Promise<JSONGuildWidgetSettings> {
|
1162
|
-
return this.client.rest
|
1163
|
-
.patch<RawGuildWidgetSettings>(Endpoints.guildWidgetSettings(this.id), {
|
1164
|
-
json: {
|
1165
|
-
enabled: options.enabled,
|
1166
|
-
channel_id: options.channelId,
|
1167
|
-
},
|
1168
|
-
reason,
|
1169
|
-
})
|
1170
|
-
.then((response) => ({
|
1171
|
-
enabled: response.enabled,
|
1172
|
-
channelId: response.channel_id,
|
1173
|
-
}));
|
1174
|
-
}
|
1175
|
-
|
1176
|
-
/** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
|
1177
|
-
async getActiveThreads(): Promise<
|
1178
|
-
Array<{
|
1179
|
-
threads: Array<Channel>;
|
1180
|
-
members: Array<JSONThreadMember>;
|
1181
|
-
}>
|
1182
|
-
> {
|
1183
|
-
return this.client.rest
|
1184
|
-
.get<
|
1185
|
-
Array<{
|
1186
|
-
threads: Array<RawChannel>;
|
1187
|
-
members: Array<RawThreadMember>;
|
1188
|
-
}>
|
1189
|
-
>(Endpoints.guildActiveThreads(this.id))
|
1190
|
-
.then((response) =>
|
1191
|
-
response.map((data) => ({
|
1192
|
-
threads: data.threads.map((data) => new Channel(data, this.client)),
|
1193
|
-
members: data.members.map((data) => ({
|
1194
|
-
id: data.id,
|
1195
|
-
userId: data.user_id,
|
1196
|
-
joinTimestamp: data.join_timestamp,
|
1197
|
-
flags: data.flags,
|
1198
|
-
member:
|
1199
|
-
data.member !== undefined
|
1200
|
-
? new GuildMember(data.member, this.client)
|
1201
|
-
: undefined,
|
1202
|
-
})),
|
1203
|
-
}))
|
1204
|
-
);
|
1205
|
-
}
|
1206
|
-
|
1207
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
1208
|
-
async getApplicationCommand(
|
1209
|
-
applicationId: string,
|
1210
|
-
commandId: string
|
1211
|
-
): Promise<ApplicationCommand> {
|
1212
|
-
return new ApplicationCommand(
|
1213
|
-
await this.client.rest.get<RawApplicationCommand>(
|
1214
|
-
Endpoints.applicationGuildCommand(applicationId, this.id, commandId)
|
1215
|
-
),
|
1216
|
-
this.client
|
1217
|
-
);
|
1218
|
-
}
|
1219
|
-
|
1220
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
1221
|
-
async getApplicationCommands(
|
1222
|
-
applicationId: string,
|
1223
|
-
options?: {
|
1224
|
-
withLocalizations?: boolean;
|
1225
|
-
}
|
1226
|
-
): Promise<Array<ApplicationCommand>> {
|
1227
|
-
return this.client.rest
|
1228
|
-
.get<Array<RawApplicationCommand>>(
|
1229
|
-
Endpoints.applicationGuildCommands(applicationId, this.id),
|
1230
|
-
{
|
1231
|
-
query: {
|
1232
|
-
with_localizations: options?.withLocalizations,
|
1233
|
-
},
|
1234
|
-
}
|
1235
|
-
)
|
1236
|
-
.then((response) =>
|
1237
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
1238
|
-
);
|
1239
|
-
}
|
1240
|
-
|
1241
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
1242
|
-
async getApplicationCommandPermissions(
|
1243
|
-
applicationId: string,
|
1244
|
-
commandId: string
|
1245
|
-
): Promise<Array<JSONGuildApplicationCommandPermissions>> {
|
1246
|
-
return this.client.rest
|
1247
|
-
.get<Array<RawGuildApplicationCommandPermissions>>(
|
1248
|
-
Endpoints.applicationCommandPermissions(
|
1249
|
-
applicationId,
|
1250
|
-
this.id,
|
1251
|
-
commandId
|
1252
|
-
)
|
1253
|
-
)
|
1254
|
-
.then((response) =>
|
1255
|
-
response.map((permissions) => ({
|
1256
|
-
id: permissions.id,
|
1257
|
-
applicationId: permissions.application_id,
|
1258
|
-
guildId: permissions.guild_id,
|
1259
|
-
permissions: permissions.permissions.map((permission) => ({
|
1260
|
-
id: permission.id,
|
1261
|
-
type: permission.type,
|
1262
|
-
permission: permission.permission,
|
1263
|
-
})),
|
1264
|
-
}))
|
1265
|
-
);
|
1266
|
-
}
|
1267
|
-
|
1268
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
1269
|
-
async getApplicationCommandsPermissions(
|
1270
|
-
applicationId: string
|
1271
|
-
): Promise<Array<JSONGuildApplicationCommandPermissions>> {
|
1272
|
-
return this.client.rest
|
1273
|
-
.get<Array<RawGuildApplicationCommandPermissions>>(
|
1274
|
-
Endpoints.guildApplicationCommandsPermissions(applicationId, this.id)
|
1275
|
-
)
|
1276
|
-
.then((response) =>
|
1277
|
-
response.map((permissions) => ({
|
1278
|
-
id: permissions.id,
|
1279
|
-
applicationId: permissions.application_id,
|
1280
|
-
guildId: permissions.guild_id,
|
1281
|
-
permissions: permissions.permissions.map((permission) => ({
|
1282
|
-
id: permission.id,
|
1283
|
-
type: permission.type,
|
1284
|
-
permission: permission.permission,
|
1285
|
-
})),
|
1286
|
-
}))
|
1287
|
-
);
|
1288
|
-
}
|
1289
|
-
|
1290
|
-
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
1291
|
-
async getAuditLog(options?: {
|
1292
|
-
userId?: string;
|
1293
|
-
actionType?: ActionTypes;
|
1294
|
-
before?: string;
|
1295
|
-
after?: string;
|
1296
|
-
limit?: number;
|
1297
|
-
}): Promise<AuditLog> {
|
1298
|
-
return new AuditLog(
|
1299
|
-
await this.client.rest.get<RawAuditLog>(
|
1300
|
-
Endpoints.guildAuditLog(this.id),
|
1301
|
-
{
|
1302
|
-
query: {
|
1303
|
-
user_id: options?.userId,
|
1304
|
-
action_type: options?.actionType,
|
1305
|
-
before: options?.before,
|
1306
|
-
after: options?.after,
|
1307
|
-
limit: options?.limit,
|
1308
|
-
},
|
1309
|
-
}
|
1310
|
-
),
|
1311
|
-
this.client
|
1312
|
-
);
|
1313
|
-
}
|
1314
|
-
|
1315
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
1316
|
-
async getAutoModerationRule(ruleId: string): Promise<AutoModerationRule> {
|
1317
|
-
return new AutoModerationRule(
|
1318
|
-
await this.client.rest.get<RawAutoModerationRule>(
|
1319
|
-
Endpoints.guildAutoModerationRule(this.id, ruleId)
|
1320
|
-
),
|
1321
|
-
this.client
|
1322
|
-
);
|
1323
|
-
}
|
1324
|
-
|
1325
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
1326
|
-
async getAutoModerationRules(): Promise<Array<AutoModerationRule>> {
|
1327
|
-
return this.client.rest
|
1328
|
-
.get<Array<RawAutoModerationRule>>(
|
1329
|
-
Endpoints.guildAutoModerationRules(this.id)
|
1330
|
-
)
|
1331
|
-
.then((response) =>
|
1332
|
-
response.map((data) => new AutoModerationRule(data, this.client))
|
1333
|
-
);
|
1334
|
-
}
|
1335
|
-
|
1336
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
1337
|
-
async getBan(userId: string): Promise<JSONBan> {
|
1338
|
-
return this.client.rest
|
1339
|
-
.get<RawBan>(Endpoints.guildBan(this.id, userId))
|
1340
|
-
.then((response) => ({
|
1341
|
-
reason: response.reason,
|
1342
|
-
user: new User(response.user, this.client),
|
1343
|
-
}));
|
1344
|
-
}
|
1345
|
-
|
1346
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
1347
|
-
async getBans(options?: {
|
1348
|
-
limit?: number;
|
1349
|
-
before?: string;
|
1350
|
-
after?: string;
|
1351
|
-
}): Promise<Array<JSONBan>> {
|
1352
|
-
return this.client.rest
|
1353
|
-
.get<Array<RawBan>>(Endpoints.guildBans(this.id), {
|
1354
|
-
query: {
|
1355
|
-
limit: options?.limit,
|
1356
|
-
before: options?.before,
|
1357
|
-
after: options?.after,
|
1358
|
-
},
|
1359
|
-
})
|
1360
|
-
.then((response) =>
|
1361
|
-
response.map((data) => ({
|
1362
|
-
reason: data.reason,
|
1363
|
-
user: new User(data.user, this.client).toJSON(),
|
1364
|
-
}))
|
1365
|
-
);
|
1366
|
-
}
|
1367
|
-
|
1368
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
1369
|
-
async getChannels(): Promise<Array<Channel>> {
|
1370
|
-
return this.client.rest
|
1371
|
-
.get<Array<RawChannel>>(Endpoints.guildChannels(this.id))
|
1372
|
-
.then((response) =>
|
1373
|
-
response.map((data) => new Channel(data, this.client))
|
1374
|
-
);
|
1375
|
-
}
|
1376
|
-
|
1377
|
-
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
1378
|
-
async getEmoji(emojiId: string): Promise<Emoji> {
|
1379
|
-
return new Emoji(
|
1380
|
-
await this.client.rest.get<RawEmoji>(
|
1381
|
-
Endpoints.guildEmoji(this.id, emojiId)
|
1382
|
-
),
|
1383
|
-
this.client
|
1384
|
-
);
|
1385
|
-
}
|
1386
|
-
|
1387
|
-
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
1388
|
-
async getEmojis(): Promise<Array<Emoji>> {
|
1389
|
-
return this.client.rest
|
1390
|
-
.get<Array<RawEmoji>>(Endpoints.guildEmojis(this.id))
|
1391
|
-
.then((response) => response.map((data) => new Emoji(data, this.client)));
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
1395
|
-
async getIntegrations(): Promise<Array<Integration>> {
|
1396
|
-
return this.client.rest
|
1397
|
-
.get<Array<RawIntegration>>(Endpoints.guildIntegrations(this.id))
|
1398
|
-
.then((response) =>
|
1399
|
-
response.map((data) => new Integration(data, this.client))
|
1400
|
-
);
|
1401
|
-
}
|
1402
|
-
|
1403
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
1404
|
-
async getInvites(): Promise<Array<Invite>> {
|
1405
|
-
return this.client.rest
|
1406
|
-
.get<Array<RawInvite>>(Endpoints.guildInvites(this.id))
|
1407
|
-
.then((response) =>
|
1408
|
-
response.map((data) => new Invite(data, this.client))
|
1409
|
-
);
|
1410
|
-
}
|
1411
|
-
|
1412
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
1413
|
-
async getMember(userId: string): Promise<GuildMember> {
|
1414
|
-
return new GuildMember(
|
1415
|
-
await this.client.rest.get<RawGuildMember>(
|
1416
|
-
Endpoints.guildMember(this.id, userId)
|
1417
|
-
),
|
1418
|
-
this.client
|
1419
|
-
);
|
1420
|
-
}
|
1421
|
-
|
1422
|
-
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
1423
|
-
async getMembers(): Promise<Array<GuildMember>> {
|
1424
|
-
return this.client.rest
|
1425
|
-
.get<Array<RawGuildMember>>(Endpoints.guildMembers(this.id))
|
1426
|
-
.then((response) =>
|
1427
|
-
response.map((data) => new GuildMember(data, this.client))
|
1428
|
-
);
|
1429
|
-
}
|
1430
|
-
|
1431
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
1432
|
-
async getOnboarding(): Promise<JSONGuildOnboarding> {
|
1433
|
-
return this.client.rest
|
1434
|
-
.get<RawGuildOnboarding>(Endpoints.guildOnboarding(this.id))
|
1435
|
-
.then((response) => ({
|
1436
|
-
guildId: response.guild_id,
|
1437
|
-
prompts: response.prompts.map((prompt) => ({
|
1438
|
-
id: prompt.id,
|
1439
|
-
type: prompt.type,
|
1440
|
-
options: prompt.options.map((option) => ({
|
1441
|
-
id: option.id,
|
1442
|
-
channelIds: option.channel_ids,
|
1443
|
-
roleIds: option.role_ids,
|
1444
|
-
emoji:
|
1445
|
-
option.emoji !== undefined
|
1446
|
-
? new Emoji(option.emoji, this.client)
|
1447
|
-
: undefined,
|
1448
|
-
emojiId: option.emoji_id,
|
1449
|
-
emojiName: option.emoji_name,
|
1450
|
-
emojiAnimated: option.emoji_animated,
|
1451
|
-
title: option.title,
|
1452
|
-
description: option.description,
|
1453
|
-
})),
|
1454
|
-
title: prompt.title,
|
1455
|
-
singleSelect: prompt.single_select,
|
1456
|
-
required: prompt.required,
|
1457
|
-
inOnboarding: prompt.in_onboarding,
|
1458
|
-
})),
|
1459
|
-
defaultChannelIds: response.default_channel_ids,
|
1460
|
-
enabled: response.enabled,
|
1461
|
-
mode: response.mode,
|
1462
|
-
}));
|
1463
|
-
}
|
1464
|
-
|
1465
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-preview */
|
1466
|
-
async getPreview(): Promise<JSONGuildPreview> {
|
1467
|
-
return this.client.rest
|
1468
|
-
.get<RawGuildPreview>(Endpoints.guildPreview(this.id))
|
1469
|
-
.then((response) => ({
|
1470
|
-
id: response.id,
|
1471
|
-
name: response.name,
|
1472
|
-
icon: response.icon,
|
1473
|
-
splash: response.splash,
|
1474
|
-
discoverySplash: response.discovery_splash,
|
1475
|
-
emojis: response.emojis.map((emoji) => new Emoji(emoji, this.client)),
|
1476
|
-
features: response.features,
|
1477
|
-
approximateMemberCount: response.approximate_member_count,
|
1478
|
-
approximatePresenceCount: response.approximate_presence_count,
|
1479
|
-
description: response.description,
|
1480
|
-
stickers: response.stickers?.map((sticker) => ({
|
1481
|
-
id: sticker.id,
|
1482
|
-
packId: sticker.pack_id,
|
1483
|
-
name: sticker.name,
|
1484
|
-
description: sticker.description,
|
1485
|
-
tags: sticker.tags,
|
1486
|
-
asset: sticker.asset,
|
1487
|
-
type: sticker.type,
|
1488
|
-
formatType: sticker.format_type,
|
1489
|
-
available: sticker.available,
|
1490
|
-
guildId: sticker.guild_id,
|
1491
|
-
user:
|
1492
|
-
sticker.user !== undefined
|
1493
|
-
? new User(sticker.user, this.client)
|
1494
|
-
: undefined,
|
1495
|
-
sortValue: sticker.sort_value,
|
1496
|
-
})),
|
1497
|
-
}));
|
1498
|
-
}
|
1499
|
-
|
1500
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
1501
|
-
async getPruneCount(options: {
|
1502
|
-
days: number;
|
1503
|
-
includeRoles: string | Array<string>;
|
1504
|
-
}): Promise<number> {
|
1505
|
-
return this.client.rest.get<number>(Endpoints.guildPrune(this.id), {
|
1506
|
-
query: {
|
1507
|
-
days: options.days,
|
1508
|
-
include_roles: options.includeRoles,
|
1509
|
-
},
|
1510
|
-
});
|
1511
|
-
}
|
1512
|
-
|
1513
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
1514
|
-
async getRoles(): Promise<Array<Role>> {
|
1515
|
-
return this.client.rest
|
1516
|
-
.get<Array<RawRole>>(Endpoints.guildRoles(this.id))
|
1517
|
-
.then((response) => response.map((data) => new Role(data, this.client)));
|
1518
|
-
}
|
1519
|
-
|
1520
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
1521
|
-
async getScheduledEvents(options?: {
|
1522
|
-
withUserCount?: boolean;
|
1523
|
-
}): Promise<Array<GuildScheduledEvent>> {
|
1524
|
-
return this.client.rest
|
1525
|
-
.get<Array<RawGuildScheduledEvent>>(
|
1526
|
-
Endpoints.guildScheduledEvents(this.id),
|
1527
|
-
{
|
1528
|
-
query: {
|
1529
|
-
with_user_count: options?.withUserCount,
|
1530
|
-
},
|
1531
|
-
}
|
1532
|
-
)
|
1533
|
-
.then((response) =>
|
1534
|
-
response.map((data) => new GuildScheduledEvent(data, this.client))
|
1535
|
-
);
|
1536
|
-
}
|
1537
|
-
|
1538
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
1539
|
-
async getScheduledEventUsers(
|
1540
|
-
scheduledEventId: string,
|
1541
|
-
options?: {
|
1542
|
-
limit?: number;
|
1543
|
-
withMember?: boolean;
|
1544
|
-
before?: string;
|
1545
|
-
after?: string;
|
1546
|
-
}
|
1547
|
-
): Promise<Array<JSONGuildScheduledEventUser>> {
|
1548
|
-
return this.client.rest
|
1549
|
-
.get<Array<RawGuildScheduledEventUser>>(
|
1550
|
-
Endpoints.guildScheduledEvent(this.id, scheduledEventId),
|
1551
|
-
{
|
1552
|
-
query: {
|
1553
|
-
limit: options?.limit,
|
1554
|
-
with_member: options?.withMember,
|
1555
|
-
before: options?.before,
|
1556
|
-
after: options?.after,
|
1557
|
-
},
|
1558
|
-
}
|
1559
|
-
)
|
1560
|
-
.then((response) =>
|
1561
|
-
response.map((data) => ({
|
1562
|
-
guildScheduledEventId: data.guild_scheduled_event_id,
|
1563
|
-
user: new User(data.user, this.client).toJSON(),
|
1564
|
-
member:
|
1565
|
-
data.member !== undefined
|
1566
|
-
? new GuildMember(data.member, this.client).toJSON()
|
1567
|
-
: undefined,
|
1568
|
-
}))
|
1569
|
-
);
|
1570
|
-
}
|
1571
|
-
|
1572
|
-
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
1573
|
-
async getSticker(stickerId: string): Promise<Sticker> {
|
1574
|
-
return this.client.rest
|
1575
|
-
.get<RawSticker>(Endpoints.guildSticker(this.id, stickerId))
|
1576
|
-
.then((response) => new Sticker(response, this.client));
|
1577
|
-
}
|
1578
|
-
|
1579
|
-
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
1580
|
-
async getStickers(): Promise<Array<Sticker>> {
|
1581
|
-
return this.client.rest
|
1582
|
-
.get<Array<RawSticker>>(Endpoints.guildStickers(this.id))
|
1583
|
-
.then((response) =>
|
1584
|
-
response.map((data) => new Sticker(data, this.client))
|
1585
|
-
);
|
1586
|
-
}
|
1587
|
-
|
1588
|
-
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1589
|
-
async getTemplate(code: string): Promise<GuildTemplate> {
|
1590
|
-
return new GuildTemplate(
|
1591
|
-
await this.client.rest.get<RawGuildTemplate>(
|
1592
|
-
Endpoints.guildTemplate(this.id, code)
|
1593
|
-
),
|
1594
|
-
this.client
|
1595
|
-
);
|
1596
|
-
}
|
1597
|
-
|
1598
|
-
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
1599
|
-
async getTemplates(): Promise<Array<GuildTemplate>> {
|
1600
|
-
return this.client.rest
|
1601
|
-
.get<Array<RawGuildTemplate>>(Endpoints.guildTemplates(this.id))
|
1602
|
-
.then((response) =>
|
1603
|
-
response.map((data) => new GuildTemplate(data, this.client))
|
1604
|
-
);
|
1605
|
-
}
|
1606
|
-
|
1607
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
1608
|
-
getVanityURL(): Promise<{
|
1609
|
-
code: string;
|
1610
|
-
uses: number;
|
1611
|
-
}> {
|
1612
|
-
return this.client.rest.get<{
|
1613
|
-
code: string;
|
1614
|
-
uses: number;
|
1615
|
-
}>(Endpoints.guildVanityURL(this.id));
|
1616
|
-
}
|
1617
|
-
|
1618
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
|
1619
|
-
async getVoiceRegions(): Promise<Array<JSONVoiceRegion>> {
|
1620
|
-
return this.client.rest
|
1621
|
-
.get<Array<RawVoiceRegion>>(Endpoints.guildVoiceRegions(this.id))
|
1622
|
-
.then((response) =>
|
1623
|
-
response.map((data) => ({
|
1624
|
-
id: data.id,
|
1625
|
-
name: data.name,
|
1626
|
-
optimal: data.optimal,
|
1627
|
-
deprecated: data.deprecated,
|
1628
|
-
custom: data.custom,
|
1629
|
-
}))
|
1630
|
-
);
|
1631
|
-
}
|
1632
|
-
|
1633
|
-
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
1634
|
-
async getWebhooks(): Promise<Array<Webhook>> {
|
1635
|
-
return this.client.rest
|
1636
|
-
.get<Array<RawWebhook>>(Endpoints.guildWebhooks(this.id))
|
1637
|
-
.then((response) =>
|
1638
|
-
response.map((data) => new Webhook(data, this.client))
|
1639
|
-
);
|
1640
|
-
}
|
1641
|
-
|
1642
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
|
1643
|
-
async getWelcomeScreen(): Promise<JSONWelcomeScreen> {
|
1644
|
-
return this.client.rest
|
1645
|
-
.get<RawWelcomeScreen>(Endpoints.guildWelcomeScreen(this.id))
|
1646
|
-
.then((response) => ({
|
1647
|
-
description: response.description,
|
1648
|
-
welcomeChannels: response.welcome_channels.map((data) => ({
|
1649
|
-
channelId: data.channel_id,
|
1650
|
-
description: data.description,
|
1651
|
-
emojiId: data.emoji_id,
|
1652
|
-
emojiName: data.emoji_name,
|
1653
|
-
})),
|
1654
|
-
}));
|
1655
|
-
}
|
1656
|
-
|
1657
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-widget */
|
1658
|
-
async getWidget(): Promise<JSONGuildWidget> {
|
1659
|
-
return this.client.rest
|
1660
|
-
.get<RawGuildWidget>(Endpoints.guildWidgetJSON(this.id))
|
1661
|
-
.then((response) => ({
|
1662
|
-
id: response.id,
|
1663
|
-
name: response.name,
|
1664
|
-
instantInvite: response.instant_invite,
|
1665
|
-
channels: response.channels.map(
|
1666
|
-
(data) => new Channel(data, this.client)
|
1667
|
-
),
|
1668
|
-
members: response.members.map((data) => new User(data, this.client)),
|
1669
|
-
presenceCount: response.presence_count,
|
1670
|
-
}));
|
1671
|
-
}
|
1672
|
-
|
1673
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
|
1674
|
-
async getWidgetImage(options?: {
|
1675
|
-
style?: ImageWidgetStyleOptions;
|
1676
|
-
}): Promise<string> {
|
1677
|
-
return this.client.rest.get<string>(Endpoints.guildWidgetImage(this.id), {
|
1678
|
-
query: {
|
1679
|
-
style: options?.style,
|
1680
|
-
},
|
1681
|
-
});
|
1682
|
-
}
|
1683
|
-
|
1684
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
|
1685
|
-
async getWidgetSettings(): Promise<JSONGuildWidgetSettings> {
|
1686
|
-
return this.client.rest
|
1687
|
-
.get<RawGuildWidgetSettings>(Endpoints.guildWidgetSettings(this.id))
|
1688
|
-
.then((response) => ({
|
1689
|
-
enabled: response.enabled,
|
1690
|
-
channelId: response.channel_id,
|
1691
|
-
}));
|
1692
|
-
}
|
1693
|
-
|
1694
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
1695
|
-
removeBan(userId: string, reason?: string): void {
|
1696
|
-
this.client.rest.delete(Endpoints.guildBan(this.id, userId), {
|
1697
|
-
reason,
|
1698
|
-
});
|
1699
|
-
}
|
1700
|
-
|
1701
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member */
|
1702
|
-
removeMember(userId: string, reason?: string): void {
|
1703
|
-
this.client.rest.delete(Endpoints.guildMember(this.id, userId), {
|
1704
|
-
reason,
|
1705
|
-
});
|
1706
|
-
}
|
1707
|
-
|
1708
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
1709
|
-
removeMemberRole(userId: string, roleId: string, reason?: string): void {
|
1710
|
-
this.client.rest.delete(
|
1711
|
-
Endpoints.guildMemberRole(this.id, userId, roleId),
|
1712
|
-
{
|
1713
|
-
reason,
|
1714
|
-
}
|
1715
|
-
);
|
1716
|
-
}
|
1717
|
-
|
1718
|
-
/** https://discord.com/developers/docs/resources/guild#search-guild-members */
|
1719
|
-
async searchMembers(options: {
|
1720
|
-
query: string;
|
1721
|
-
limit?: number;
|
1722
|
-
}): Promise<Array<GuildMember>> {
|
1723
|
-
return this.client.rest
|
1724
|
-
.get<Array<RawGuildMember>>(Endpoints.guildMembersSearch(this.id), {
|
1725
|
-
query: {
|
1726
|
-
query: options.query,
|
1727
|
-
limit: options.limit,
|
1728
|
-
},
|
1729
|
-
})
|
1730
|
-
.then((response) =>
|
1731
|
-
response.map((data) => new GuildMember(data, this.client))
|
1732
|
-
);
|
1733
|
-
}
|
1734
|
-
|
1735
|
-
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
1736
|
-
async setApplicationCommands(
|
1737
|
-
applicationId: string,
|
1738
|
-
commands: Array<{
|
1739
|
-
id?: string;
|
1740
|
-
name: string;
|
1741
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
1742
|
-
description?: string;
|
1743
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
1744
|
-
options?: Array<JSONApplicationCommandOption>;
|
1745
|
-
defaultMemberPermissions?: string | null;
|
1746
|
-
dmPermission?: boolean;
|
1747
|
-
defaultPermission?: boolean | null;
|
1748
|
-
type: ApplicationCommandTypes;
|
1749
|
-
nsfw?: boolean;
|
1750
|
-
}>
|
1751
|
-
): Promise<Array<ApplicationCommand>> {
|
1752
|
-
return this.client.rest
|
1753
|
-
.put<Array<RawApplicationCommand>>(
|
1754
|
-
Endpoints.applicationGuildCommands(applicationId, this.id),
|
1755
|
-
{
|
1756
|
-
json: commands.map((command) =>
|
1757
|
-
this.client.util.applicationCommandToRaw(command)
|
1758
|
-
),
|
1759
|
-
}
|
1760
|
-
)
|
1761
|
-
.then((response) =>
|
1762
|
-
response.map((data) => new ApplicationCommand(data, this.client))
|
1763
|
-
);
|
1764
|
-
}
|
1765
|
-
|
1766
|
-
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
1767
|
-
async syncTemplate(code: string): Promise<GuildTemplate> {
|
1768
|
-
return new GuildTemplate(
|
1769
|
-
await this.client.rest.put<RawGuildTemplate>(
|
1770
|
-
Endpoints.guildTemplate(this.id, code)
|
1771
|
-
),
|
1772
|
-
this.client
|
1773
|
-
);
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
override toRaw(): RawGuild & Partial<RawGuildCreateEventExtraFields> {
|
1777
|
-
return this.raw;
|
1778
|
-
}
|
1779
|
-
|
1780
|
-
override toJSON(): JSONGuild & Partial<JSONGuildCreateEventExtraFields> {
|
1781
|
-
return {
|
1782
|
-
...super.toJSON(),
|
1783
|
-
name: this.name,
|
1784
|
-
icon: this.icon,
|
1785
|
-
iconHash: this.iconHash,
|
1786
|
-
splash: this.splash,
|
1787
|
-
discoverySplash: this.discoverySplash,
|
1788
|
-
owner: this.owner,
|
1789
|
-
ownerId: this.ownerId,
|
1790
|
-
permissions: this.permissions,
|
1791
|
-
region: this.region,
|
1792
|
-
afkChannelId: this.afkChannelId,
|
1793
|
-
afkTimeout: this.afkTimeout,
|
1794
|
-
widgetEnabled: this.widgetEnabled,
|
1795
|
-
widgetChannelId: this.widgetChannelId,
|
1796
|
-
verificationLevel: this.verificationLevel,
|
1797
|
-
defaultMessageNotifications: this.defaultMessageNotifications,
|
1798
|
-
explicitContentFilter: this.explicitContentFilter,
|
1799
|
-
roles: this.roles,
|
1800
|
-
emojis: this.emojis,
|
1801
|
-
features: this.features,
|
1802
|
-
mfaLevel: this.mfaLevel,
|
1803
|
-
applicationId: this.applicationId,
|
1804
|
-
systemChannelId: this.systemChannelId,
|
1805
|
-
systemChannelFlags: this.systemChannelFlags,
|
1806
|
-
rulesChannelId: this.rulesChannelId,
|
1807
|
-
maxPresences: this.maxPresences,
|
1808
|
-
maxMembers: this.maxMembers,
|
1809
|
-
vanityURLCode: this.vanityURLCode,
|
1810
|
-
description: this.description,
|
1811
|
-
banner: this.banner,
|
1812
|
-
premiumTier: this.premiumTier,
|
1813
|
-
premiumSubscriptionCount: this.premiumSubscriptionCount,
|
1814
|
-
preferredLocale: this.preferredLocale,
|
1815
|
-
publicUpdatesChannelId: this.publicUpdatesChannelId,
|
1816
|
-
maxVideoChannelUsers: this.maxVideoChannelUsers,
|
1817
|
-
maxStageVideoChannelUsers: this.maxStageVideoChannelUsers,
|
1818
|
-
approximateMemberCount: this.approximateMemberCount,
|
1819
|
-
approximatePresenceCount: this.approximatePresenceCount,
|
1820
|
-
welcomeScreen: this.welcomeScreen,
|
1821
|
-
nsfwLevel: this.nsfwLevel,
|
1822
|
-
stickers: this.stickers,
|
1823
|
-
premiumProgressBarEnabled: this.premiumProgressBarEnabled,
|
1824
|
-
safetyAlertsChannelId: this.safetyAlertsChannelId,
|
1825
|
-
joinedAt: this.joinedAt,
|
1826
|
-
large: this.large,
|
1827
|
-
unavailable: this.unavailable,
|
1828
|
-
memberCount: this.memberCount,
|
1829
|
-
voiceStates: this.voiceStates?.map((voiceState) => voiceState.toJSON()),
|
1830
|
-
members: this.members?.map((member) => member.toJSON()),
|
1831
|
-
channels: this.channels?.map((channel) => channel.toJSON()),
|
1832
|
-
threads: this.threads?.map((thread) => thread.toJSON()),
|
1833
|
-
presences: this.presences,
|
1834
|
-
stageInstances: this.stageInstances?.map((stageInstance) =>
|
1835
|
-
stageInstance.toJSON()
|
1836
|
-
),
|
1837
|
-
guildScheduledEvents: this.guildScheduledEvents?.map(
|
1838
|
-
(guildScheduledEvent) => guildScheduledEvent.toJSON()
|
1839
|
-
),
|
1840
|
-
};
|
1841
|
-
}
|
1842
|
-
}
|