seyfert 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/CDN.d.ts +1 -1
- package/lib/api/CDN.js +0 -2
- package/lib/api/Router.js +2 -2
- package/lib/api/Routes/applications.d.ts +29 -33
- package/lib/api/Routes/channels.d.ts +11 -17
- package/lib/api/Routes/interactions.d.ts +3 -7
- package/lib/api/Routes/webhooks.d.ts +4 -6
- package/lib/api/api.d.ts +5 -0
- package/lib/api/api.js +36 -0
- package/lib/api/shared.d.ts +5 -3
- package/lib/builders/Attachment.d.ts +2 -3
- package/lib/builders/Button.d.ts +2 -2
- package/lib/cache/adapters/default.d.ts +1 -0
- package/lib/cache/adapters/default.js +1 -0
- package/lib/cache/adapters/redis.d.ts +1 -0
- package/lib/cache/adapters/redis.js +7 -0
- package/lib/cache/adapters/types.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.d.ts +5 -4
- package/lib/cache/adapters/workeradapter.js +11 -5
- package/lib/cache/index.d.ts +4 -6
- package/lib/cache/index.js +5 -6
- package/lib/cache/resources/default/base.d.ts +2 -1
- package/lib/cache/resources/default/guild-based.d.ts +2 -1
- package/lib/cache/resources/default/guild-based.js +6 -6
- package/lib/cache/resources/default/guild-related.d.ts +2 -1
- package/lib/cache/resources/default/guild-related.js +1 -1
- package/lib/cache/resources/guilds.js +2 -1
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/overwrites.js +7 -1
- package/lib/client/base.d.ts +18 -171
- package/lib/client/base.js +12 -15
- package/lib/client/client.d.ts +6 -1
- package/lib/client/client.js +13 -12
- package/lib/client/oninteractioncreate.js +4 -4
- package/lib/client/onmessagecreate.js +188 -152
- package/lib/client/workerclient.d.ts +15 -1
- package/lib/client/workerclient.js +135 -27
- package/lib/collection.js +2 -2
- package/lib/commands/applications/chat.d.ts +15 -7
- package/lib/commands/applications/chat.js +7 -7
- package/lib/commands/applications/chatcontext.d.ts +6 -4
- package/lib/commands/applications/chatcontext.js +12 -7
- package/lib/commands/applications/menu.d.ts +5 -1
- package/lib/commands/applications/menu.js +4 -0
- package/lib/commands/applications/menucontext.d.ts +5 -3
- package/lib/commands/applications/menucontext.js +9 -4
- package/lib/commands/applications/options.d.ts +1 -2
- package/lib/commands/decorators.d.ts +17 -5
- package/lib/commands/decorators.js +17 -7
- package/lib/commands/handler.d.ts +5 -5
- package/lib/commands/handler.js +40 -36
- package/lib/commands/optionresolver.d.ts +11 -4
- package/lib/commands/optionresolver.js +6 -4
- package/lib/common/index.d.ts +7 -0
- package/lib/common/index.js +7 -0
- package/lib/common/it/utils.js +2 -0
- package/lib/common/shorters/channels.d.ts +67 -129
- package/lib/common/shorters/channels.js +119 -135
- package/lib/common/shorters/emojis.d.ts +47 -0
- package/lib/common/shorters/emojis.js +80 -0
- package/lib/common/shorters/guilds.d.ts +22 -249
- package/lib/common/shorters/guilds.js +51 -140
- package/lib/common/shorters/members.d.ts +82 -108
- package/lib/common/shorters/members.js +151 -166
- package/lib/common/shorters/messages.d.ts +11 -23
- package/lib/common/shorters/messages.js +58 -104
- package/lib/common/shorters/reactions.d.ts +10 -0
- package/lib/common/shorters/reactions.js +45 -0
- package/lib/common/shorters/roles.d.ts +39 -7
- package/lib/common/shorters/roles.js +74 -42
- package/lib/common/shorters/templates.d.ts +6 -8
- package/lib/common/shorters/templates.js +17 -21
- package/lib/common/shorters/users.d.ts +4 -0
- package/lib/common/shorters/users.js +30 -0
- package/lib/common/shorters/webhook.d.ts +62 -26
- package/lib/common/shorters/webhook.js +113 -58
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/util.d.ts +1 -1
- package/lib/components/handler.d.ts +11 -8
- package/lib/components/handler.js +34 -22
- package/lib/index.d.ts +4 -2
- package/lib/langs/handler.js +7 -2
- package/lib/structures/AutoModerationRule.d.ts +2 -2
- package/lib/structures/ClientUser.d.ts +2 -2
- package/lib/structures/Guild.d.ts +2 -2
- package/lib/structures/GuildEmoji.d.ts +4 -4
- package/lib/structures/GuildEmoji.js +7 -7
- package/lib/structures/GuildMember.d.ts +6 -6
- package/lib/structures/GuildMember.js +2 -2
- package/lib/structures/GuildPreview.d.ts +2 -2
- package/lib/structures/GuildRole.d.ts +2 -2
- package/lib/structures/GuildTemplate.d.ts +2 -2
- package/lib/structures/Interaction.d.ts +7 -8
- package/lib/structures/Interaction.js +1 -1
- package/lib/structures/Message.d.ts +7 -6
- package/lib/structures/Message.js +7 -4
- package/lib/structures/Sticker.d.ts +2 -2
- package/lib/structures/Webhook.d.ts +2 -2
- package/lib/structures/Webhook.js +3 -3
- package/lib/structures/channels.d.ts +19 -20
- package/lib/structures/channels.js +13 -25
- package/lib/structures/extra/Base.d.ts +1 -2
- package/lib/structures/extra/DiscordBase.d.ts +2 -2
- package/lib/websocket/constants/index.js +2 -3
- package/lib/websocket/discord/shard.js +4 -2
- package/lib/websocket/discord/sharder.d.ts +3 -0
- package/lib/websocket/discord/sharder.js +12 -5
- package/lib/websocket/discord/shared.d.ts +3 -0
- package/lib/websocket/discord/worker.d.ts +24 -7
- package/lib/websocket/discord/workermanager.d.ts +30 -6
- package/lib/websocket/discord/workermanager.js +160 -51
- package/package.json +8 -5
|
@@ -1,258 +1,31 @@
|
|
|
1
|
-
import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody,
|
|
2
|
-
import type {
|
|
3
|
-
import { AnonymousGuild, Guild,
|
|
1
|
+
import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildsJSONBody } from 'discord-api-types/v10';
|
|
2
|
+
import type { ObjectToLower } from '..';
|
|
3
|
+
import { AnonymousGuild, Guild, GuildMember, Sticker, type CreateStickerBodyRequest } from '../../structures';
|
|
4
4
|
import { BaseShorter } from './base';
|
|
5
5
|
export declare class GuildShorter extends BaseShorter {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Creates a new guild.
|
|
8
|
+
* @param body The data for creating the guild.
|
|
9
|
+
* @returns A Promise that resolves to the created guild.
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Creates a new guild.
|
|
12
|
-
* @param body The data for creating the guild.
|
|
13
|
-
* @returns A Promise that resolves to the created guild.
|
|
14
|
-
*/
|
|
15
|
-
create: (body: RESTPostAPIGuildsJSONBody) => Promise<Guild<"api">>;
|
|
16
|
-
/**
|
|
17
|
-
* Fetches a guild by its ID.
|
|
18
|
-
* @param id The ID of the guild to fetch.
|
|
19
|
-
* @param force Whether to force fetching the guild from the API even if it exists in the cache.
|
|
20
|
-
* @returns A Promise that resolves to the fetched guild.
|
|
21
|
-
*/
|
|
22
|
-
fetch: (id: string, force?: boolean) => Promise<Guild<"cached"> | Guild<"api">>;
|
|
23
|
-
/**
|
|
24
|
-
* Generates the widget URL for the guild.
|
|
25
|
-
* @param id The ID of the guild.
|
|
26
|
-
* @param style The style of the widget.
|
|
27
|
-
* @returns The generated widget URL.
|
|
28
|
-
*/
|
|
29
|
-
widgetURL: (id: string, style?: GuildWidgetStyle) => Promise<import("discord-api-types/v10").APIGuildWidgetSettings>;
|
|
30
|
-
list: (query?: RESTGetAPICurrentUserGuildsQuery) => Promise<AnonymousGuild[]>;
|
|
31
|
-
fetchSelf: (id: string) => Promise<GuildMember>;
|
|
32
|
-
leave: (id: string) => Promise<void | undefined>;
|
|
33
|
-
channels: {
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves a list of channels in the guild.
|
|
36
|
-
* @param guildId The ID of the guild.
|
|
37
|
-
* @param force Whether to force fetching channels from the API even if they exist in the cache.
|
|
38
|
-
* @returns A Promise that resolves to an array of channels.
|
|
39
|
-
*/
|
|
40
|
-
list: (guildId: string, force?: boolean) => Promise<import("../../structures").AllChannels[]>;
|
|
41
|
-
/**
|
|
42
|
-
* Fetches a channel by its ID.
|
|
43
|
-
* @param guildId The ID of the guild.
|
|
44
|
-
* @param channelId The ID of the channel to fetch.
|
|
45
|
-
* @param force Whether to force fetching the channel from the API even if it exists in the cache.
|
|
46
|
-
* @returns A Promise that resolves to the fetched channel.
|
|
47
|
-
*/
|
|
48
|
-
fetch: (guildId: string, channelId: string, force?: boolean | undefined) => Promise<import("../../structures").AllChannels>;
|
|
49
|
-
/**
|
|
50
|
-
* Creates a new channel in the guild.
|
|
51
|
-
* @param guildId The ID of the guild.
|
|
52
|
-
* @param body The data for creating the channel.
|
|
53
|
-
* @returns A Promise that resolves to the created channel.
|
|
54
|
-
*/
|
|
55
|
-
create: (guildId: string, body: RESTPostAPIGuildChannelJSONBody) => Promise<import("../../structures").AllChannels>;
|
|
56
|
-
/**
|
|
57
|
-
* Deletes a channel from the guild.
|
|
58
|
-
* @param guildId The ID of the guild.
|
|
59
|
-
* @param channelId The ID of the channel to delete.
|
|
60
|
-
* @param reason The reason for deleting the channel.
|
|
61
|
-
* @returns A Promise that resolves to the deleted channel.
|
|
62
|
-
*/
|
|
63
|
-
delete: (guildId: string, channelId: string, reason?: string | undefined) => Promise<import("../../structures").AllChannels>;
|
|
64
|
-
/**
|
|
65
|
-
* Edits a channel in the guild.
|
|
66
|
-
* @param guildchannelId The ID of the guild.
|
|
67
|
-
* @param channelId The ID of the channel to edit.
|
|
68
|
-
* @param body The data to update the channel with.
|
|
69
|
-
* @param reason The reason for editing the channel.
|
|
70
|
-
* @returns A Promise that resolves to the edited channel.
|
|
71
|
-
*/
|
|
72
|
-
edit: (guildchannelId: string, channelId: string, body: RESTPatchAPIChannelJSONBody, reason?: string | undefined) => Promise<import("../../structures").AllChannels>;
|
|
73
|
-
/**
|
|
74
|
-
* Edits the positions of channels in the guild.
|
|
75
|
-
* @param guildId The ID of the guild.
|
|
76
|
-
* @param body The data containing the new positions of channels.
|
|
77
|
-
*/
|
|
78
|
-
editPositions: (guildId: string, body: RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<never>;
|
|
79
|
-
};
|
|
80
|
-
moderation: {
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves a list of auto-moderation rules in the guild.
|
|
83
|
-
* @param guildId The ID of the guild.
|
|
84
|
-
* @returns A Promise that resolves to an array of auto-moderation rules.
|
|
85
|
-
*/
|
|
86
|
-
list: (guildId: string) => Promise<import("discord-api-types/v10").RESTGetAPIAutoModerationRulesResult>;
|
|
87
|
-
/**
|
|
88
|
-
* Creates a new auto-moderation rule in the guild.
|
|
89
|
-
* @param guildId The ID of the guild.
|
|
90
|
-
* @param body The data for creating the auto-moderation rule.
|
|
91
|
-
* @returns A Promise that resolves to the created auto-moderation rule.
|
|
92
|
-
*/
|
|
93
|
-
create: (guildId: string, body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
94
|
-
/**
|
|
95
|
-
* Deletes an auto-moderation rule from the guild.
|
|
96
|
-
* @param guildId The ID of the guild.
|
|
97
|
-
* @param ruleId The ID of the rule to delete.
|
|
98
|
-
* @param reason The reason for deleting the rule.
|
|
99
|
-
* @returns A Promise that resolves once the rule is deleted.
|
|
100
|
-
*/
|
|
101
|
-
delete: (guildId: string, ruleId: string, reason?: string | undefined) => Promise<never>;
|
|
102
|
-
/**
|
|
103
|
-
* Fetches an auto-moderation rule by its ID.
|
|
104
|
-
* @param guildId The ID of the guild.
|
|
105
|
-
* @param ruleId The ID of the rule to fetch.
|
|
106
|
-
* @returns A Promise that resolves to the fetched auto-moderation rule.
|
|
107
|
-
*/
|
|
108
|
-
fetch: (guildId: string, ruleId: string) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
109
|
-
/**
|
|
110
|
-
* Edits an auto-moderation rule in the guild.
|
|
111
|
-
* @param guildId The ID of the guild.
|
|
112
|
-
* @param ruleId The ID of the rule to edit.
|
|
113
|
-
* @param body The data to update the rule with.
|
|
114
|
-
* @param reason The reason for editing the rule.
|
|
115
|
-
* @returns A Promise that resolves to the edited auto-moderation rule.
|
|
116
|
-
*/
|
|
117
|
-
edit: (guildId: string, ruleId: string, body: {
|
|
118
|
-
name?: string | undefined;
|
|
119
|
-
eventType?: import("discord-api-types/v10").AutoModerationRuleEventType | undefined;
|
|
120
|
-
triggerMetadata?: import("discord-api-types/v10").APIAutoModerationRuleTriggerMetadata | undefined;
|
|
121
|
-
actions?: import("discord-api-types/v10").APIAutoModerationAction[] | undefined;
|
|
122
|
-
enabled?: boolean | undefined;
|
|
123
|
-
exemptRoles?: string[] | undefined;
|
|
124
|
-
exemptChannels?: string[] | undefined;
|
|
125
|
-
}, reason?: string | undefined) => Promise<import("discord-api-types/v10").APIAutoModerationRule>;
|
|
126
|
-
};
|
|
127
|
-
stickers: {
|
|
128
|
-
/**
|
|
129
|
-
* Retrieves a list of stickers in the guild.
|
|
130
|
-
* @param guildId The ID of the guild.
|
|
131
|
-
* @returns A Promise that resolves to an array of stickers.
|
|
132
|
-
*/
|
|
133
|
-
list: (guildId: string) => Promise<Sticker[]>;
|
|
134
|
-
/**
|
|
135
|
-
* Creates a new sticker in the guild.
|
|
136
|
-
* @param guildId The ID of the guild.
|
|
137
|
-
* @param request The request body for creating the sticker.
|
|
138
|
-
* @param reason The reason for creating the sticker.
|
|
139
|
-
* @returns A Promise that resolves to the created sticker.
|
|
140
|
-
*/
|
|
141
|
-
create: (guildId: string, { file, ...json }: CreateStickerBodyRequest, reason?: string | undefined) => Promise<Sticker>;
|
|
142
|
-
/**
|
|
143
|
-
* Edits an existing sticker in the guild.
|
|
144
|
-
* @param guildId The ID of the guild.
|
|
145
|
-
* @param stickerId The ID of the sticker to edit.
|
|
146
|
-
* @param body The data to update the sticker with.
|
|
147
|
-
* @param reason The reason for editing the sticker.
|
|
148
|
-
* @returns A Promise that resolves to the edited sticker.
|
|
149
|
-
*/
|
|
150
|
-
edit: (guildId: string, stickerId: string, body: RESTPatchAPIGuildStickerJSONBody, reason?: string | undefined) => Promise<Sticker>;
|
|
151
|
-
/**
|
|
152
|
-
* Fetches a sticker by its ID from the guild.
|
|
153
|
-
* @param guildId The ID of the guild.
|
|
154
|
-
* @param stickerId The ID of the sticker to fetch.
|
|
155
|
-
* @param force Whether to force fetching the sticker from the API even if it exists in the cache.
|
|
156
|
-
* @returns A Promise that resolves to the fetched sticker.
|
|
157
|
-
*/
|
|
158
|
-
fetch: (guildId: string, stickerId: string, force?: boolean) => Promise<Sticker>;
|
|
159
|
-
/**
|
|
160
|
-
* Deletes a sticker from the guild.
|
|
161
|
-
* @param guildId The ID of the guild.
|
|
162
|
-
* @param stickerId The ID of the sticker to delete.
|
|
163
|
-
* @param reason The reason for deleting the sticker.
|
|
164
|
-
* @returns A Promise that resolves once the sticker is deleted.
|
|
165
|
-
*/
|
|
166
|
-
delete: (guildId: string, stickerId: string, reason?: string | undefined) => Promise<void>;
|
|
167
|
-
};
|
|
168
|
-
emojis: {
|
|
169
|
-
/**
|
|
170
|
-
* Retrieves a list of emojis in the guild.
|
|
171
|
-
* @param guildId The ID of the guild.
|
|
172
|
-
* @param force Whether to force fetching emojis from the API even if they exist in the cache.
|
|
173
|
-
* @returns A Promise that resolves to an array of emojis.
|
|
174
|
-
*/
|
|
175
|
-
list: (guildId: string, force?: boolean) => Promise<GuildEmoji[]>;
|
|
176
|
-
/**
|
|
177
|
-
* Creates a new emoji in the guild.
|
|
178
|
-
* @param guildId The ID of the guild.
|
|
179
|
-
* @param body The data for creating the emoji.
|
|
180
|
-
* @returns A Promise that resolves to the created emoji.
|
|
181
|
-
*/
|
|
182
|
-
create: (guildId: string, body: Omit<RESTPostAPIGuildEmojiJSONBody, "image"> & {
|
|
183
|
-
image: ImageResolvable;
|
|
184
|
-
}) => Promise<void>;
|
|
185
|
-
/**
|
|
186
|
-
* Fetches an emoji by its ID.
|
|
187
|
-
* @param guildId The ID of the guild.
|
|
188
|
-
* @param emojiId The ID of the emoji to fetch.
|
|
189
|
-
* @param force Whether to force fetching the emoji from the API even if it exists in the cache.
|
|
190
|
-
* @returns A Promise that resolves to the fetched emoji.
|
|
191
|
-
*/
|
|
192
|
-
fetch: (guildId: string, emojiId: string, force?: boolean) => Promise<GuildEmoji>;
|
|
193
|
-
/**
|
|
194
|
-
* Deletes an emoji from the guild.
|
|
195
|
-
* @param guildId The ID of the guild.
|
|
196
|
-
* @param emojiId The ID of the emoji to delete.
|
|
197
|
-
* @param reason The reason for deleting the emoji.
|
|
198
|
-
*/
|
|
199
|
-
delete: (guildId: string, emojiId: string, reason?: string | undefined) => Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Edits an emoji in the guild.
|
|
202
|
-
* @param guildId The ID of the guild.
|
|
203
|
-
* @param emojiId The ID of the emoji to edit.
|
|
204
|
-
* @param body The data to update the emoji with.
|
|
205
|
-
* @param reason The reason for editing the emoji.
|
|
206
|
-
* @returns A Promise that resolves to the edited emoji.
|
|
207
|
-
*/
|
|
208
|
-
edit: (guildId: string, emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string | undefined) => Promise<GuildEmoji>;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
11
|
+
create(body: RESTPostAPIGuildsJSONBody): Promise<Guild<'api'>>;
|
|
211
12
|
/**
|
|
212
|
-
*
|
|
13
|
+
* Fetches a guild by its ID.
|
|
14
|
+
* @param id The ID of the guild to fetch.
|
|
15
|
+
* @param force Whether to force fetching the guild from the API even if it exists in the cache.
|
|
16
|
+
* @returns A Promise that resolves to the fetched guild.
|
|
213
17
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* @param body The data for creating the emoji.
|
|
226
|
-
* @returns A Promise that resolves to the created emoji.
|
|
227
|
-
*/
|
|
228
|
-
create: (guildId: string, body: OmitInsert<RESTPostAPIGuildEmojiJSONBody, 'image', {
|
|
229
|
-
image: ImageResolvable;
|
|
230
|
-
}>) => Promise<void>;
|
|
231
|
-
/**
|
|
232
|
-
* Fetches an emoji by its ID.
|
|
233
|
-
* @param guildId The ID of the guild.
|
|
234
|
-
* @param emojiId The ID of the emoji to fetch.
|
|
235
|
-
* @param force Whether to force fetching the emoji from the API even if it exists in the cache.
|
|
236
|
-
* @returns A Promise that resolves to the fetched emoji.
|
|
237
|
-
*/
|
|
238
|
-
fetch: (guildId: string, emojiId: string, force?: boolean) => Promise<GuildEmoji>;
|
|
239
|
-
/**
|
|
240
|
-
* Deletes an emoji from the guild.
|
|
241
|
-
* @param guildId The ID of the guild.
|
|
242
|
-
* @param emojiId The ID of the emoji to delete.
|
|
243
|
-
* @param reason The reason for deleting the emoji.
|
|
244
|
-
*/
|
|
245
|
-
delete: (guildId: string, emojiId: string, reason?: string) => Promise<void>;
|
|
246
|
-
/**
|
|
247
|
-
* Edits an emoji in the guild.
|
|
248
|
-
* @param guildId The ID of the guild.
|
|
249
|
-
* @param emojiId The ID of the emoji to edit.
|
|
250
|
-
* @param body The data to update the emoji with.
|
|
251
|
-
* @param reason The reason for editing the emoji.
|
|
252
|
-
* @returns A Promise that resolves to the edited emoji.
|
|
253
|
-
*/
|
|
254
|
-
edit: (guildId: string, emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) => Promise<GuildEmoji>;
|
|
255
|
-
};
|
|
18
|
+
fetch(id: string, force?: boolean): Promise<Guild<"cached"> | Guild<"api">>;
|
|
19
|
+
/**
|
|
20
|
+
* Generates the widget URL for the guild.
|
|
21
|
+
* @param id The ID of the guild.
|
|
22
|
+
* @param style The style of the widget.
|
|
23
|
+
* @returns The generated widget URL.
|
|
24
|
+
*/
|
|
25
|
+
widgetURL(id: string, style?: GuildWidgetStyle): Promise<import("discord-api-types/v10").APIGuildWidgetSettings>;
|
|
26
|
+
list(query?: RESTGetAPICurrentUserGuildsQuery): Promise<AnonymousGuild[]>;
|
|
27
|
+
fetchSelf(id: string): Promise<GuildMember>;
|
|
28
|
+
leave(id: string): Promise<void | undefined>;
|
|
256
29
|
/**
|
|
257
30
|
* Provides access to channel-related functionality in a guild.
|
|
258
31
|
*/
|
|
@@ -10,150 +10,61 @@ const channels_1 = __importDefault(require("../../structures/channels"));
|
|
|
10
10
|
const base_1 = require("./base");
|
|
11
11
|
class GuildShorter extends base_1.BaseShorter {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Creates a new guild.
|
|
14
|
+
* @param body The data for creating the guild.
|
|
15
|
+
* @returns A Promise that resolves to the created guild.
|
|
14
16
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param body The data for creating the guild.
|
|
20
|
-
* @returns A Promise that resolves to the created guild.
|
|
21
|
-
*/
|
|
22
|
-
create: async (body) => {
|
|
23
|
-
const guild = await this.client.proxy.guilds.post({ body });
|
|
24
|
-
await this.client.cache.guilds?.setIfNI('Guilds', guild.id, guild);
|
|
25
|
-
return new structures_1.Guild(this.client, guild);
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* Fetches a guild by its ID.
|
|
29
|
-
* @param id The ID of the guild to fetch.
|
|
30
|
-
* @param force Whether to force fetching the guild from the API even if it exists in the cache.
|
|
31
|
-
* @returns A Promise that resolves to the fetched guild.
|
|
32
|
-
*/
|
|
33
|
-
fetch: async (id, force = false) => {
|
|
34
|
-
if (!force) {
|
|
35
|
-
const guild = await this.client.cache.guilds?.get(id);
|
|
36
|
-
if (guild)
|
|
37
|
-
return guild;
|
|
38
|
-
}
|
|
39
|
-
const data = await this.client.proxy.guilds(id).get();
|
|
40
|
-
await this.client.cache.guilds?.patch(id, data);
|
|
41
|
-
return (await this.client.cache.guilds?.get(id)) ?? new structures_1.Guild(this.client, data);
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* Generates the widget URL for the guild.
|
|
45
|
-
* @param id The ID of the guild.
|
|
46
|
-
* @param style The style of the widget.
|
|
47
|
-
* @returns The generated widget URL.
|
|
48
|
-
*/
|
|
49
|
-
widgetURL: (id, style) => {
|
|
50
|
-
const query = new URLSearchParams();
|
|
51
|
-
if (style) {
|
|
52
|
-
query.append('style', style);
|
|
53
|
-
}
|
|
54
|
-
return this.client.proxy.guilds(id).widget.get({ query });
|
|
55
|
-
},
|
|
56
|
-
list: (query) => {
|
|
57
|
-
return this.client.proxy
|
|
58
|
-
.users('@me')
|
|
59
|
-
.guilds.get({ query })
|
|
60
|
-
.then(guilds => guilds.map(guild => new structures_1.AnonymousGuild(this.client, { ...guild, splash: null })));
|
|
61
|
-
},
|
|
62
|
-
fetchSelf: async (id) => {
|
|
63
|
-
const self = await this.client.proxy.guilds(id).members(this.client.botId).get();
|
|
64
|
-
await this.client.cache.members?.patch(self.user.id, id, self);
|
|
65
|
-
return new structures_1.GuildMember(this.client, self, self.user, id);
|
|
66
|
-
},
|
|
67
|
-
leave: (id) => {
|
|
68
|
-
return this.client.proxy
|
|
69
|
-
.users('@me')
|
|
70
|
-
.guilds(id)
|
|
71
|
-
.delete()
|
|
72
|
-
.then(() => this.client.cache.guilds?.removeIfNI('Guilds', id));
|
|
73
|
-
},
|
|
74
|
-
channels: this.channels,
|
|
75
|
-
moderation: this.moderation,
|
|
76
|
-
stickers: this.stickers,
|
|
77
|
-
emojis: this.emojis,
|
|
78
|
-
};
|
|
17
|
+
async create(body) {
|
|
18
|
+
const guild = await this.client.proxy.guilds.post({ body });
|
|
19
|
+
await this.client.cache.guilds?.setIfNI('Guilds', guild.id, guild);
|
|
20
|
+
return new structures_1.Guild(this.client, guild);
|
|
79
21
|
}
|
|
80
22
|
/**
|
|
81
|
-
*
|
|
23
|
+
* Fetches a guild by its ID.
|
|
24
|
+
* @param id The ID of the guild to fetch.
|
|
25
|
+
* @param force Whether to force fetching the guild from the API even if it exists in the cache.
|
|
26
|
+
* @returns A Promise that resolves to the fetched guild.
|
|
82
27
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
fetch: async (guildId, emojiId, force = false) => {
|
|
124
|
-
let emoji;
|
|
125
|
-
if (!force) {
|
|
126
|
-
emoji = await this.client.cache.emojis?.get(emojiId);
|
|
127
|
-
if (emoji)
|
|
128
|
-
return emoji;
|
|
129
|
-
}
|
|
130
|
-
emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).get();
|
|
131
|
-
return new structures_1.GuildEmoji(this.client, emoji, guildId);
|
|
132
|
-
},
|
|
133
|
-
/**
|
|
134
|
-
* Deletes an emoji from the guild.
|
|
135
|
-
* @param guildId The ID of the guild.
|
|
136
|
-
* @param emojiId The ID of the emoji to delete.
|
|
137
|
-
* @param reason The reason for deleting the emoji.
|
|
138
|
-
*/
|
|
139
|
-
delete: async (guildId, emojiId, reason) => {
|
|
140
|
-
await this.client.proxy.guilds(guildId).emojis(emojiId).delete({ reason });
|
|
141
|
-
await this.client.cache.channels?.removeIfNI('GuildEmojisAndStickers', emojiId, guildId);
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* Edits an emoji in the guild.
|
|
145
|
-
* @param guildId The ID of the guild.
|
|
146
|
-
* @param emojiId The ID of the emoji to edit.
|
|
147
|
-
* @param body The data to update the emoji with.
|
|
148
|
-
* @param reason The reason for editing the emoji.
|
|
149
|
-
* @returns A Promise that resolves to the edited emoji.
|
|
150
|
-
*/
|
|
151
|
-
edit: async (guildId, emojiId, body, reason) => {
|
|
152
|
-
const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason });
|
|
153
|
-
await this.client.cache.channels?.setIfNI('GuildEmojisAndStickers', emoji.id, guildId, emoji);
|
|
154
|
-
return new structures_1.GuildEmoji(this.client, emoji, guildId);
|
|
155
|
-
},
|
|
156
|
-
};
|
|
28
|
+
async fetch(id, force = false) {
|
|
29
|
+
if (!force) {
|
|
30
|
+
const guild = await this.client.cache.guilds?.get(id);
|
|
31
|
+
if (guild)
|
|
32
|
+
return guild;
|
|
33
|
+
}
|
|
34
|
+
const data = await this.client.proxy.guilds(id).get();
|
|
35
|
+
await this.client.cache.guilds?.patch(id, data);
|
|
36
|
+
return (await this.client.cache.guilds?.get(id)) ?? new structures_1.Guild(this.client, data);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generates the widget URL for the guild.
|
|
40
|
+
* @param id The ID of the guild.
|
|
41
|
+
* @param style The style of the widget.
|
|
42
|
+
* @returns The generated widget URL.
|
|
43
|
+
*/
|
|
44
|
+
widgetURL(id, style) {
|
|
45
|
+
const query = new URLSearchParams();
|
|
46
|
+
if (style) {
|
|
47
|
+
query.append('style', style);
|
|
48
|
+
}
|
|
49
|
+
return this.client.proxy.guilds(id).widget.get({ query });
|
|
50
|
+
}
|
|
51
|
+
list(query) {
|
|
52
|
+
return this.client.proxy
|
|
53
|
+
.users('@me')
|
|
54
|
+
.guilds.get({ query })
|
|
55
|
+
.then(guilds => guilds.map(guild => new structures_1.AnonymousGuild(this.client, { ...guild, splash: null })));
|
|
56
|
+
}
|
|
57
|
+
async fetchSelf(id) {
|
|
58
|
+
const self = await this.client.proxy.guilds(id).members(this.client.botId).get();
|
|
59
|
+
await this.client.cache.members?.patch(self.user.id, id, self);
|
|
60
|
+
return new structures_1.GuildMember(this.client, self, self.user, id);
|
|
61
|
+
}
|
|
62
|
+
leave(id) {
|
|
63
|
+
return this.client.proxy
|
|
64
|
+
.users('@me')
|
|
65
|
+
.guilds(id)
|
|
66
|
+
.delete()
|
|
67
|
+
.then(() => this.client.cache.guilds?.removeIfNI('Guilds', id));
|
|
157
68
|
}
|
|
158
69
|
/**
|
|
159
70
|
* Provides access to channel-related functionality in a guild.
|