seyfert 0.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/LICENSE +190 -0
- package/README.md +57 -0
- package/lib/api/CDN.d.ts +220 -0
- package/lib/api/CDN.js +236 -0
- package/lib/api/REST.d.ts +127 -0
- package/lib/api/REST.js +424 -0
- package/lib/api/Router.d.ts +17 -0
- package/lib/api/Router.js +63 -0
- package/lib/api/Routes/applications.d.ts +46 -0
- package/lib/api/Routes/applications.js +2 -0
- package/lib/api/Routes/cdn.d.ts +66 -0
- package/lib/api/Routes/cdn.js +2 -0
- package/lib/api/Routes/channels.d.ts +109 -0
- package/lib/api/Routes/channels.js +2 -0
- package/lib/api/Routes/gateway.d.ts +11 -0
- package/lib/api/Routes/gateway.js +2 -0
- package/lib/api/Routes/guilds.d.ts +171 -0
- package/lib/api/Routes/guilds.js +2 -0
- package/lib/api/Routes/index.d.ts +13 -0
- package/lib/api/Routes/index.js +17 -0
- package/lib/api/Routes/interactions.d.ts +14 -0
- package/lib/api/Routes/interactions.js +2 -0
- package/lib/api/Routes/invites.d.ts +9 -0
- package/lib/api/Routes/invites.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +13 -0
- package/lib/api/Routes/stage-instances.js +2 -0
- package/lib/api/Routes/stickers.d.ts +11 -0
- package/lib/api/Routes/stickers.js +2 -0
- package/lib/api/Routes/users.d.ts +35 -0
- package/lib/api/Routes/users.js +2 -0
- package/lib/api/Routes/voice.d.ts +10 -0
- package/lib/api/Routes/voice.js +2 -0
- package/lib/api/Routes/webhooks.d.ts +29 -0
- package/lib/api/Routes/webhooks.js +2 -0
- package/lib/api/errors/DiscordAPIError.d.ts +51 -0
- package/lib/api/errors/DiscordAPIError.js +81 -0
- package/lib/api/errors/HTTPError.d.ts +20 -0
- package/lib/api/errors/HTTPError.js +28 -0
- package/lib/api/errors/RateLimitError.d.ts +19 -0
- package/lib/api/errors/RateLimitError.js +37 -0
- package/lib/api/handlers/BurstHandler.d.ts +51 -0
- package/lib/api/handlers/BurstHandler.js +124 -0
- package/lib/api/handlers/SequentialHandler.d.ts +81 -0
- package/lib/api/handlers/SequentialHandler.js +365 -0
- package/lib/api/handlers/Shared.d.ts +14 -0
- package/lib/api/handlers/Shared.js +125 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.js +21 -0
- package/lib/api/interfaces/Handler.d.ts +21 -0
- package/lib/api/interfaces/Handler.js +2 -0
- package/lib/api/shared.d.ts +7 -0
- package/lib/api/shared.js +27 -0
- package/lib/api/utils/constants.d.ts +39 -0
- package/lib/api/utils/constants.js +50 -0
- package/lib/api/utils/types.d.ts +335 -0
- package/lib/api/utils/types.js +14 -0
- package/lib/api/utils/utils.d.ts +52 -0
- package/lib/api/utils/utils.js +159 -0
- package/lib/builders/ActionRow.d.ts +40 -0
- package/lib/builders/ActionRow.js +58 -0
- package/lib/builders/Attachment.d.ts +106 -0
- package/lib/builders/Attachment.js +196 -0
- package/lib/builders/Base.d.ts +10 -0
- package/lib/builders/Base.js +13 -0
- package/lib/builders/Button.d.ts +59 -0
- package/lib/builders/Button.js +94 -0
- package/lib/builders/MessageEmbed.d.ts +116 -0
- package/lib/builders/MessageEmbed.js +159 -0
- package/lib/builders/Modal.d.ts +111 -0
- package/lib/builders/Modal.js +162 -0
- package/lib/builders/SelectMenu.d.ts +201 -0
- package/lib/builders/SelectMenu.js +293 -0
- package/lib/builders/index.d.ts +12 -0
- package/lib/builders/index.js +54 -0
- package/lib/builders/types.d.ts +21 -0
- package/lib/builders/types.js +2 -0
- package/lib/cache/adapters/default.d.ts +24 -0
- package/lib/cache/adapters/default.js +118 -0
- package/lib/cache/adapters/index.d.ts +4 -0
- package/lib/cache/adapters/index.js +20 -0
- package/lib/cache/adapters/redis.d.ts +35 -0
- package/lib/cache/adapters/redis.js +180 -0
- package/lib/cache/adapters/types.d.ts +25 -0
- package/lib/cache/adapters/types.js +2 -0
- package/lib/cache/adapters/workeradapter.d.ts +24 -0
- package/lib/cache/adapters/workeradapter.js +76 -0
- package/lib/cache/index.d.ts +97 -0
- package/lib/cache/index.js +394 -0
- package/lib/cache/resources/channels.d.ts +7 -0
- package/lib/cache/resources/channels.js +20 -0
- package/lib/cache/resources/default/base.d.ts +25 -0
- package/lib/cache/resources/default/base.js +75 -0
- package/lib/cache/resources/default/guild-based.d.ts +33 -0
- package/lib/cache/resources/default/guild-based.js +91 -0
- package/lib/cache/resources/default/guild-related.d.ts +32 -0
- package/lib/cache/resources/default/guild-related.js +102 -0
- package/lib/cache/resources/emojis.d.ts +7 -0
- package/lib/cache/resources/emojis.js +17 -0
- package/lib/cache/resources/guilds.d.ts +10 -0
- package/lib/cache/resources/guilds.js +117 -0
- package/lib/cache/resources/members.d.ts +10 -0
- package/lib/cache/resources/members.js +41 -0
- package/lib/cache/resources/presence.d.ts +9 -0
- package/lib/cache/resources/presence.js +14 -0
- package/lib/cache/resources/roles.d.ts +7 -0
- package/lib/cache/resources/roles.js +17 -0
- package/lib/cache/resources/stage-instances.d.ts +5 -0
- package/lib/cache/resources/stage-instances.js +8 -0
- package/lib/cache/resources/stickers.d.ts +7 -0
- package/lib/cache/resources/stickers.js +17 -0
- package/lib/cache/resources/threads.d.ts +7 -0
- package/lib/cache/resources/threads.js +17 -0
- package/lib/cache/resources/users.d.ts +7 -0
- package/lib/cache/resources/users.js +17 -0
- package/lib/cache/resources/voice-states.d.ts +9 -0
- package/lib/cache/resources/voice-states.js +13 -0
- package/lib/client/base.d.ts +244 -0
- package/lib/client/base.js +178 -0
- package/lib/client/client.d.ts +32 -0
- package/lib/client/client.js +156 -0
- package/lib/client/httpclient.d.ts +21 -0
- package/lib/client/httpclient.js +143 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +19 -0
- package/lib/client/oninteraction.d.ts +4 -0
- package/lib/client/oninteraction.js +180 -0
- package/lib/client/workerclient.d.ts +28 -0
- package/lib/client/workerclient.js +213 -0
- package/lib/collection.d.ts +233 -0
- package/lib/collection.js +371 -0
- package/lib/commands/applications/chat.d.ts +139 -0
- package/lib/commands/applications/chat.js +173 -0
- package/lib/commands/applications/chatcontext.d.ts +28 -0
- package/lib/commands/applications/chatcontext.js +53 -0
- package/lib/commands/applications/menu.d.ts +39 -0
- package/lib/commands/applications/menu.js +87 -0
- package/lib/commands/applications/menucontext.d.ts +25 -0
- package/lib/commands/applications/menucontext.js +64 -0
- package/lib/commands/applications/options.d.ts +67 -0
- package/lib/commands/applications/options.js +44 -0
- package/lib/commands/applications/shared.d.ts +35 -0
- package/lib/commands/applications/shared.js +2 -0
- package/lib/commands/decorators.d.ts +107 -0
- package/lib/commands/decorators.js +85 -0
- package/lib/commands/handler.d.ts +15 -0
- package/lib/commands/handler.js +140 -0
- package/lib/commands/index.d.ts +8 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/optionresolver.d.ts +49 -0
- package/lib/commands/optionresolver.js +146 -0
- package/lib/common/bot/watcher.d.ts +53 -0
- package/lib/common/bot/watcher.js +104 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.js +30 -0
- package/lib/common/it/colors.d.ts +274 -0
- package/lib/common/it/colors.js +453 -0
- package/lib/common/it/constants.d.ts +36 -0
- package/lib/common/it/constants.js +40 -0
- package/lib/common/it/logger.d.ts +114 -0
- package/lib/common/it/logger.js +189 -0
- package/lib/common/it/utils.d.ts +107 -0
- package/lib/common/it/utils.js +275 -0
- package/lib/common/shorters/base.d.ts +5 -0
- package/lib/common/shorters/base.js +10 -0
- package/lib/common/shorters/channels.d.ts +90 -0
- package/lib/common/shorters/channels.js +95 -0
- package/lib/common/shorters/guilds.d.ts +389 -0
- package/lib/common/shorters/guilds.js +350 -0
- package/lib/common/shorters/members.d.ts +115 -0
- package/lib/common/shorters/members.js +179 -0
- package/lib/common/shorters/messages.d.ts +27 -0
- package/lib/common/shorters/messages.js +117 -0
- package/lib/common/shorters/roles.d.ts +12 -0
- package/lib/common/shorters/roles.js +51 -0
- package/lib/common/shorters/templates.d.ts +12 -0
- package/lib/common/shorters/templates.js +29 -0
- package/lib/common/shorters/users.d.ts +11 -0
- package/lib/common/shorters/users.js +42 -0
- package/lib/common/shorters/webhook.d.ts +33 -0
- package/lib/common/shorters/webhook.js +69 -0
- package/lib/common/types/options.d.ts +10 -0
- package/lib/common/types/options.js +2 -0
- package/lib/common/types/resolvables.d.ts +10 -0
- package/lib/common/types/resolvables.js +2 -0
- package/lib/common/types/util.d.ts +90 -0
- package/lib/common/types/util.js +2 -0
- package/lib/common/types/write.d.ts +21 -0
- package/lib/common/types/write.js +2 -0
- package/lib/components/ActionRow.d.ts +10 -0
- package/lib/components/ActionRow.js +13 -0
- package/lib/components/ButtonComponent.d.ts +19 -0
- package/lib/components/ButtonComponent.js +34 -0
- package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
- package/lib/components/ChannelSelectMenuComponent.js +12 -0
- package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
- package/lib/components/MentionableSelectMenuComponent.js +7 -0
- package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
- package/lib/components/RoleSelectMenuComponent.js +7 -0
- package/lib/components/StringSelectMenuComponent.d.ts +6 -0
- package/lib/components/StringSelectMenuComponent.js +12 -0
- package/lib/components/TextInputComponent.d.ts +7 -0
- package/lib/components/TextInputComponent.js +14 -0
- package/lib/components/UserSelectMenuComponent.d.ts +4 -0
- package/lib/components/UserSelectMenuComponent.js +7 -0
- package/lib/components/command.d.ts +23 -0
- package/lib/components/command.js +15 -0
- package/lib/components/handler.d.ts +48 -0
- package/lib/components/handler.js +231 -0
- package/lib/components/index.d.ts +20 -0
- package/lib/components/index.js +55 -0
- package/lib/components/listener.d.ts +11 -0
- package/lib/components/listener.js +18 -0
- package/lib/events/event.d.ts +23 -0
- package/lib/events/event.js +2 -0
- package/lib/events/handler.d.ts +19 -0
- package/lib/events/handler.js +112 -0
- package/lib/events/hooks/application_command.d.ts +12 -0
- package/lib/events/hooks/application_command.js +8 -0
- package/lib/events/hooks/auto_moderation.d.ts +22 -0
- package/lib/events/hooks/auto_moderation.js +21 -0
- package/lib/events/hooks/channel.d.ts +11 -0
- package/lib/events/hooks/channel.js +24 -0
- package/lib/events/hooks/custom.d.ts +4 -0
- package/lib/events/hooks/custom.js +11 -0
- package/lib/events/hooks/dispatch.d.ts +5 -0
- package/lib/events/hooks/dispatch.js +12 -0
- package/lib/events/hooks/entitlement.d.ts +35 -0
- package/lib/events/hooks/entitlement.js +16 -0
- package/lib/events/hooks/guild.d.ts +228 -0
- package/lib/events/hooks/guild.js +101 -0
- package/lib/events/hooks/index.d.ts +23 -0
- package/lib/events/hooks/index.js +34 -0
- package/lib/events/hooks/integration.d.ts +94 -0
- package/lib/events/hooks/integration.js +27 -0
- package/lib/events/hooks/interactions.d.ts +4 -0
- package/lib/events/hooks/interactions.js +8 -0
- package/lib/events/hooks/invite.d.ts +21 -0
- package/lib/events/hooks/invite.js +12 -0
- package/lib/events/hooks/message.d.ts +69 -0
- package/lib/events/hooks/message.js +37 -0
- package/lib/events/hooks/presence.d.ts +27 -0
- package/lib/events/hooks/presence.js +8 -0
- package/lib/events/hooks/stage.d.ts +29 -0
- package/lib/events/hooks/stage.js +16 -0
- package/lib/events/hooks/thread.d.ts +198 -0
- package/lib/events/hooks/thread.js +29 -0
- package/lib/events/hooks/typing.d.ts +16 -0
- package/lib/events/hooks/typing.js +14 -0
- package/lib/events/hooks/user.d.ts +4 -0
- package/lib/events/hooks/user.js +8 -0
- package/lib/events/hooks/voice.d.ts +37 -0
- package/lib/events/hooks/voice.js +18 -0
- package/lib/events/hooks/webhook.d.ts +6 -0
- package/lib/events/hooks/webhook.js +8 -0
- package/lib/events/index.d.ts +2 -0
- package/lib/events/index.js +18 -0
- package/lib/index.d.ts +79 -0
- package/lib/index.js +104 -0
- package/lib/langs/handler.d.ts +11 -0
- package/lib/langs/handler.js +34 -0
- package/lib/langs/index.d.ts +2 -0
- package/lib/langs/index.js +18 -0
- package/lib/langs/router.d.ts +18 -0
- package/lib/langs/router.js +42 -0
- package/lib/structures/AnonymousGuild.d.ts +7 -0
- package/lib/structures/AnonymousGuild.js +11 -0
- package/lib/structures/AutoModerationRule.d.ts +22 -0
- package/lib/structures/AutoModerationRule.js +34 -0
- package/lib/structures/ClientUser.d.ts +25 -0
- package/lib/structures/ClientUser.js +52 -0
- package/lib/structures/Guild.d.ts +86 -0
- package/lib/structures/Guild.js +66 -0
- package/lib/structures/GuildEmoji.d.ts +29 -0
- package/lib/structures/GuildEmoji.js +47 -0
- package/lib/structures/GuildMember.d.ts +92 -0
- package/lib/structures/GuildMember.js +137 -0
- package/lib/structures/GuildPreview.d.ts +10 -0
- package/lib/structures/GuildPreview.js +14 -0
- package/lib/structures/GuildRole.d.ts +21 -0
- package/lib/structures/GuildRole.js +32 -0
- package/lib/structures/GuildTemplate.d.ts +23 -0
- package/lib/structures/GuildTemplate.js +36 -0
- package/lib/structures/Interaction.d.ts +152 -0
- package/lib/structures/Interaction.js +409 -0
- package/lib/structures/Message.d.ts +53 -0
- package/lib/structures/Message.js +123 -0
- package/lib/structures/Sticker.d.ts +27 -0
- package/lib/structures/Sticker.js +44 -0
- package/lib/structures/User.d.ts +20 -0
- package/lib/structures/User.js +37 -0
- package/lib/structures/Webhook.d.ts +42 -0
- package/lib/structures/Webhook.js +63 -0
- package/lib/structures/channels.d.ts +232 -0
- package/lib/structures/channels.js +366 -0
- package/lib/structures/extra/Base.d.ts +7 -0
- package/lib/structures/extra/Base.js +39 -0
- package/lib/structures/extra/BaseComponent.d.ts +9 -0
- package/lib/structures/extra/BaseComponent.js +12 -0
- package/lib/structures/extra/BaseGuild.d.ts +40 -0
- package/lib/structures/extra/BaseGuild.js +71 -0
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
- package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
- package/lib/structures/extra/BitField.d.ts +14 -0
- package/lib/structures/extra/BitField.js +56 -0
- package/lib/structures/extra/DiscordBase.d.ts +18 -0
- package/lib/structures/extra/DiscordBase.js +28 -0
- package/lib/structures/extra/Permissions.d.ts +54 -0
- package/lib/structures/extra/Permissions.js +9 -0
- package/lib/structures/extra/functions.d.ts +11 -0
- package/lib/structures/extra/functions.js +69 -0
- package/lib/structures/index.d.ts +15 -0
- package/lib/structures/index.js +31 -0
- package/lib/websocket/SharedTypes.d.ts +128 -0
- package/lib/websocket/SharedTypes.js +2 -0
- package/lib/websocket/constants/index.d.ts +26 -0
- package/lib/websocket/constants/index.js +31 -0
- package/lib/websocket/discord/basesocket.d.ts +12 -0
- package/lib/websocket/discord/basesocket.js +37 -0
- package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/events/memberUpdate.js +47 -0
- package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
- package/lib/websocket/discord/events/presenceUpdate.js +46 -0
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +1 -0
- package/lib/websocket/discord/index.d.ts +4 -0
- package/lib/websocket/discord/index.js +20 -0
- package/lib/websocket/discord/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/memberUpdate.js +47 -0
- package/lib/websocket/discord/shard.d.ts +46 -0
- package/lib/websocket/discord/shard.js +278 -0
- package/lib/websocket/discord/sharder.d.ts +25 -0
- package/lib/websocket/discord/sharder.js +153 -0
- package/lib/websocket/discord/shared.d.ts +99 -0
- package/lib/websocket/discord/shared.js +8 -0
- package/lib/websocket/discord/worker.d.ts +43 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +69 -0
- package/lib/websocket/discord/workermanager.js +273 -0
- package/lib/websocket/index.d.ts +3 -0
- package/lib/websocket/index.js +19 -0
- package/lib/websocket/structures/index.d.ts +117 -0
- package/lib/websocket/structures/index.js +261 -0
- package/lib/websocket/structures/timeout.d.ts +20 -0
- package/lib/websocket/structures/timeout.js +75 -0
- package/package.json +70 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookMessage = exports.Message = exports.BaseMessage = void 0;
|
|
4
|
+
const ActionRow_1 = require("../components/ActionRow");
|
|
5
|
+
const GuildMember_1 = require("./GuildMember");
|
|
6
|
+
const User_1 = require("./User");
|
|
7
|
+
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
8
|
+
const functions_1 = require("./extra/functions");
|
|
9
|
+
class BaseMessage extends DiscordBase_1.DiscordBase {
|
|
10
|
+
guildId;
|
|
11
|
+
timestamp;
|
|
12
|
+
author;
|
|
13
|
+
member;
|
|
14
|
+
components;
|
|
15
|
+
mentions;
|
|
16
|
+
constructor(client, data) {
|
|
17
|
+
super(client, data);
|
|
18
|
+
this.mentions = {
|
|
19
|
+
roles: data.mention_roles ?? [],
|
|
20
|
+
channels: data.mention_channels ?? [],
|
|
21
|
+
users: [],
|
|
22
|
+
};
|
|
23
|
+
this.components = data.components?.map(x => new ActionRow_1.MessageActionRowComponent(x)) ?? [];
|
|
24
|
+
this.patch(data);
|
|
25
|
+
}
|
|
26
|
+
get url() {
|
|
27
|
+
return (0, functions_1.messageLink)(this.channelId, this.id, this.guildId);
|
|
28
|
+
}
|
|
29
|
+
async guild(force = false) {
|
|
30
|
+
if (!this.guildId)
|
|
31
|
+
return;
|
|
32
|
+
return this.client.guilds.fetch(this.guildId, force);
|
|
33
|
+
}
|
|
34
|
+
async channel(force = false) {
|
|
35
|
+
return this.client.channels.fetch(this.channelId, force);
|
|
36
|
+
}
|
|
37
|
+
react(emoji) {
|
|
38
|
+
return this.client.messages.reactions.add(this.id, this.channelId, emoji);
|
|
39
|
+
}
|
|
40
|
+
patch(data) {
|
|
41
|
+
if ('guild_id' in data) {
|
|
42
|
+
this.guildId = data.guild_id;
|
|
43
|
+
}
|
|
44
|
+
if (data.type !== undefined) {
|
|
45
|
+
this.type = data.type;
|
|
46
|
+
}
|
|
47
|
+
if ('timestamp' in data && data.timestamp) {
|
|
48
|
+
this.timestamp = Date.parse(data.timestamp);
|
|
49
|
+
}
|
|
50
|
+
if ('application_id' in data) {
|
|
51
|
+
this.applicationId = data.application_id;
|
|
52
|
+
}
|
|
53
|
+
if ('author' in data && data.author) {
|
|
54
|
+
this.author = new User_1.User(this.client, data.author);
|
|
55
|
+
}
|
|
56
|
+
if ('member' in data && data.member) {
|
|
57
|
+
this.member = new GuildMember_1.GuildMember(this.client, data.member, this.author, this.guildId);
|
|
58
|
+
}
|
|
59
|
+
if (data.mentions?.length) {
|
|
60
|
+
this.mentions.users = this.guildId
|
|
61
|
+
? data.mentions.map(m => new GuildMember_1.GuildMember(this.client, {
|
|
62
|
+
...m.member,
|
|
63
|
+
user: m,
|
|
64
|
+
}, m, this.guildId))
|
|
65
|
+
: data.mentions.map(u => new User_1.User(this.client, u));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.BaseMessage = BaseMessage;
|
|
70
|
+
class Message extends BaseMessage {
|
|
71
|
+
constructor(client, data) {
|
|
72
|
+
super(client, data);
|
|
73
|
+
}
|
|
74
|
+
fetch() {
|
|
75
|
+
return this.client.messages.fetch(this.id, this.channelId);
|
|
76
|
+
}
|
|
77
|
+
reply(body) {
|
|
78
|
+
return this.write({
|
|
79
|
+
...body,
|
|
80
|
+
message_reference: {
|
|
81
|
+
message_id: this.id,
|
|
82
|
+
channel_id: this.channelId,
|
|
83
|
+
guild_id: this.guildId,
|
|
84
|
+
fail_if_not_exists: true,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
edit(body) {
|
|
89
|
+
return this.client.messages.edit(this.id, this.channelId, body);
|
|
90
|
+
}
|
|
91
|
+
write(body) {
|
|
92
|
+
return this.client.messages.write(this.channelId, body);
|
|
93
|
+
}
|
|
94
|
+
delete(reason) {
|
|
95
|
+
return this.client.messages.delete(this.id, this.channelId, reason);
|
|
96
|
+
}
|
|
97
|
+
crosspost(reason) {
|
|
98
|
+
return this.client.messages.crosspost(this.id, this.channelId, reason);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.Message = Message;
|
|
102
|
+
class WebhookMessage extends BaseMessage {
|
|
103
|
+
webhookId;
|
|
104
|
+
webhookToken;
|
|
105
|
+
constructor(client, data, webhookId, webhookToken) {
|
|
106
|
+
super(client, data);
|
|
107
|
+
this.webhookId = webhookId;
|
|
108
|
+
this.webhookToken = webhookToken;
|
|
109
|
+
}
|
|
110
|
+
fetch() {
|
|
111
|
+
return this.api.webhooks(this.webhookId)(this.webhookToken).get({ query: this.thread?.id });
|
|
112
|
+
}
|
|
113
|
+
edit(body) {
|
|
114
|
+
return this.client.webhooks.messages.edit(this.webhookId, this.webhookToken, { ...body, messageId: this.id });
|
|
115
|
+
}
|
|
116
|
+
write(body) {
|
|
117
|
+
return this.client.webhooks.messages.write(this.webhookId, this.webhookToken, body);
|
|
118
|
+
}
|
|
119
|
+
delete(reason) {
|
|
120
|
+
return this.client.webhooks.messages.delete(this.webhookId, this.webhookToken, this.id, reason);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.WebhookMessage = WebhookMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Attachment } from '../builders';
|
|
2
|
+
import type { BaseClient } from '../client/base';
|
|
3
|
+
import type { APISticker, MethodContext, ObjectToLower, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIGuildStickerFormDataBody } from '../common';
|
|
4
|
+
import { User } from './User';
|
|
5
|
+
import { DiscordBase } from './extra/DiscordBase';
|
|
6
|
+
export interface Sticker extends DiscordBase, ObjectToLower<Omit<APISticker, 'user'>> {
|
|
7
|
+
}
|
|
8
|
+
export declare class Sticker extends DiscordBase {
|
|
9
|
+
user?: User;
|
|
10
|
+
constructor(client: BaseClient, data: APISticker);
|
|
11
|
+
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api"> | undefined>;
|
|
12
|
+
edit(body: RESTPatchAPIGuildStickerJSONBody, reason?: string): Promise<Sticker> | undefined;
|
|
13
|
+
fetch(force?: boolean): Promise<Sticker> | undefined;
|
|
14
|
+
delete(reason?: string): Promise<void> | undefined;
|
|
15
|
+
static methods({ client, guildId }: MethodContext<{
|
|
16
|
+
guildId: string;
|
|
17
|
+
}>): {
|
|
18
|
+
list: () => Promise<Sticker[]>;
|
|
19
|
+
create: (payload: CreateStickerBodyRequest, reason?: string) => Promise<Sticker>;
|
|
20
|
+
edit: (stickerId: string, body: RESTPatchAPIGuildStickerJSONBody, reason?: string) => Promise<Sticker>;
|
|
21
|
+
fetch: (stickerId: string, force?: boolean) => Promise<Sticker>;
|
|
22
|
+
delete: (stickerId: string, reason?: string) => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface CreateStickerBodyRequest extends Omit<RESTPostAPIGuildStickerFormDataBody, 'file'> {
|
|
26
|
+
file: Attachment;
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sticker = void 0;
|
|
4
|
+
const User_1 = require("./User");
|
|
5
|
+
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
6
|
+
class Sticker extends DiscordBase_1.DiscordBase {
|
|
7
|
+
user;
|
|
8
|
+
constructor(client, data) {
|
|
9
|
+
super(client, data);
|
|
10
|
+
if (data.user) {
|
|
11
|
+
this.user = new User_1.User(this.client, data.user);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async guild(force = false) {
|
|
15
|
+
if (!this.guildId)
|
|
16
|
+
return;
|
|
17
|
+
return this.client.guilds.fetch(this.id, force);
|
|
18
|
+
}
|
|
19
|
+
edit(body, reason) {
|
|
20
|
+
if (!this.guildId)
|
|
21
|
+
return;
|
|
22
|
+
return this.client.guilds.stickers.edit(this.guildId, this.id, body, reason);
|
|
23
|
+
}
|
|
24
|
+
fetch(force = false) {
|
|
25
|
+
if (!this.guildId)
|
|
26
|
+
return;
|
|
27
|
+
return this.client.guilds.stickers.fetch(this.guildId, this.id, force);
|
|
28
|
+
}
|
|
29
|
+
delete(reason) {
|
|
30
|
+
if (!this.guildId)
|
|
31
|
+
return;
|
|
32
|
+
return this.client.guilds.stickers.delete(this.guildId, this.id, reason);
|
|
33
|
+
}
|
|
34
|
+
static methods({ client, guildId }) {
|
|
35
|
+
return {
|
|
36
|
+
list: () => client.guilds.stickers.list(guildId),
|
|
37
|
+
create: (payload, reason) => client.guilds.stickers.create(guildId, payload, reason),
|
|
38
|
+
edit: (stickerId, body, reason) => client.guilds.stickers.edit(guildId, stickerId, body, reason),
|
|
39
|
+
fetch: (stickerId, force = false) => client.guilds.stickers.fetch(guildId, stickerId, force),
|
|
40
|
+
delete: (stickerId, reason) => client.guilds.stickers.delete(guildId, stickerId, reason),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Sticker = Sticker;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { APIUser, MessageCreateBodyRequest, ObjectToLower } from '../common';
|
|
2
|
+
import type { ImageOptions } from '../common/types/options';
|
|
3
|
+
import { DiscordBase } from './extra/DiscordBase';
|
|
4
|
+
export interface User extends ObjectToLower<APIUser> {
|
|
5
|
+
}
|
|
6
|
+
export declare class User extends DiscordBase<APIUser> {
|
|
7
|
+
get tag(): string;
|
|
8
|
+
get name(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch user
|
|
11
|
+
*/
|
|
12
|
+
fetch(force?: boolean): Promise<User>;
|
|
13
|
+
/**
|
|
14
|
+
* Open a DM with the user
|
|
15
|
+
*/
|
|
16
|
+
dm(force?: boolean): Promise<import("./channels").DMChannel>;
|
|
17
|
+
write(body: MessageCreateBodyRequest): Promise<import("./Message").Message>;
|
|
18
|
+
avatarURL(options?: ImageOptions): string;
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.User = void 0;
|
|
4
|
+
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
5
|
+
class User extends DiscordBase_1.DiscordBase {
|
|
6
|
+
get tag() {
|
|
7
|
+
return this.globalName ?? `${this.username}#${this.discriminator}`;
|
|
8
|
+
}
|
|
9
|
+
get name() {
|
|
10
|
+
return this.globalName ?? this.username;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetch user
|
|
14
|
+
*/
|
|
15
|
+
fetch(force = false) {
|
|
16
|
+
return this.client.users.fetch(this.id, force);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Open a DM with the user
|
|
20
|
+
*/
|
|
21
|
+
dm(force = false) {
|
|
22
|
+
return this.client.users.createDM(this.id, force);
|
|
23
|
+
}
|
|
24
|
+
write(body) {
|
|
25
|
+
return this.client.users.write(this.id, body);
|
|
26
|
+
}
|
|
27
|
+
avatarURL(options) {
|
|
28
|
+
if (!this.avatar) {
|
|
29
|
+
return this.rest.cdn.defaultAvatar(Number(this.discriminator));
|
|
30
|
+
}
|
|
31
|
+
return this.rest.cdn.avatar(this.id, this.avatar, options);
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return `<@${this.id}>`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.User = User;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BaseClient } from '../client/base';
|
|
2
|
+
import type { APIWebhook, ImageOptions, MessageWebhookCreateBodyRequest, MessageWebhookPayload, MessageWebhookUpdateBodyRequest, MethodContext, ObjectToLower, RESTGetAPIWebhookWithTokenMessageQuery, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery } from '../common';
|
|
3
|
+
import { AnonymousGuild } from './AnonymousGuild';
|
|
4
|
+
import { User } from './User';
|
|
5
|
+
import { DiscordBase } from './extra/DiscordBase';
|
|
6
|
+
export interface Webhook extends DiscordBase, ObjectToLower<Omit<APIWebhook, 'user' | 'source_guild'>> {
|
|
7
|
+
}
|
|
8
|
+
export declare class Webhook extends DiscordBase {
|
|
9
|
+
user?: User;
|
|
10
|
+
sourceGuild?: Partial<AnonymousGuild>;
|
|
11
|
+
messages: ReturnType<typeof Webhook.messages>;
|
|
12
|
+
constructor(client: BaseClient, data: APIWebhook);
|
|
13
|
+
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api"> | undefined>;
|
|
14
|
+
channel(force?: boolean): Promise<import("./channels").BaseChannel<import("discord-api-types/payloads/v10/channel").ChannelType> | import("./channels").DMChannel | import("./channels").CategoryChannel | undefined>;
|
|
15
|
+
avatarURL(options?: ImageOptions): string | null;
|
|
16
|
+
fetch(): Promise<Webhook>;
|
|
17
|
+
edit(body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody, reason?: string): Promise<import("discord-api-types/rest/v10/webhook").RESTGetAPIWebhookWithTokenResult>;
|
|
18
|
+
delete(reason?: string): Promise<never>;
|
|
19
|
+
static messages({ client, webhookId, webhookToken }: MethodContext<{
|
|
20
|
+
webhookId: string;
|
|
21
|
+
webhookToken: string;
|
|
22
|
+
}>): {
|
|
23
|
+
write: (payload: MessageWebhookMethodWriteParams) => Promise<import("./Message").WebhookMessage | null>;
|
|
24
|
+
edit: (payload: MessageWebhookMethodEditParams) => Promise<import("./Message").WebhookMessage>;
|
|
25
|
+
delete: (messageId: string, reason?: string) => Promise<never>;
|
|
26
|
+
};
|
|
27
|
+
static methods({ client, webhookId, webhookToken }: MethodContext<{
|
|
28
|
+
webhookId: string;
|
|
29
|
+
webhookToken?: string;
|
|
30
|
+
}>): {
|
|
31
|
+
delete: (reason?: string) => Promise<never>;
|
|
32
|
+
edit: (body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, reason?: string) => Promise<import("discord-api-types/rest/v10/webhook").RESTGetAPIWebhookWithTokenResult>;
|
|
33
|
+
fetch: () => Promise<Webhook>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export type MessageWebhookMethodEditParams = MessageWebhookPayload<MessageWebhookUpdateBodyRequest, {
|
|
37
|
+
messageId: string;
|
|
38
|
+
query?: RESTGetAPIWebhookWithTokenMessageQuery;
|
|
39
|
+
}>;
|
|
40
|
+
export type MessageWebhookMethodWriteParams = MessageWebhookPayload<MessageWebhookCreateBodyRequest, {
|
|
41
|
+
query?: RESTPostAPIWebhookWithTokenQuery;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Webhook = void 0;
|
|
4
|
+
const AnonymousGuild_1 = require("./AnonymousGuild");
|
|
5
|
+
const User_1 = require("./User");
|
|
6
|
+
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
7
|
+
class Webhook extends DiscordBase_1.DiscordBase {
|
|
8
|
+
user;
|
|
9
|
+
sourceGuild;
|
|
10
|
+
messages;
|
|
11
|
+
constructor(client, data) {
|
|
12
|
+
super(client, data);
|
|
13
|
+
if (data.user) {
|
|
14
|
+
this.user = new User_1.User(this.client, data.user);
|
|
15
|
+
}
|
|
16
|
+
if (data.source_guild) {
|
|
17
|
+
this.sourceGuild = new AnonymousGuild_1.AnonymousGuild(this.client, data.source_guild);
|
|
18
|
+
}
|
|
19
|
+
Object.assign(this, {
|
|
20
|
+
messages: Webhook.messages({ client, webhookId: this.id, webhookToken: this.token }),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async guild(force = false) {
|
|
24
|
+
if (!this.sourceGuild?.id)
|
|
25
|
+
return;
|
|
26
|
+
return this.client.guilds.fetch(this.sourceGuild.id, force);
|
|
27
|
+
}
|
|
28
|
+
async channel(force = false) {
|
|
29
|
+
if (!this.sourceChannel?.id)
|
|
30
|
+
return;
|
|
31
|
+
return this.client.channels.fetch(this.sourceChannel.id, force);
|
|
32
|
+
}
|
|
33
|
+
avatarURL(options) {
|
|
34
|
+
if (!this.avatar) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return this.rest.cdn.avatar(this.id, this.avatar, options);
|
|
38
|
+
}
|
|
39
|
+
async fetch() {
|
|
40
|
+
return this.client.webhooks.fetch(this.id, this.token);
|
|
41
|
+
}
|
|
42
|
+
async edit(body, reason) {
|
|
43
|
+
return this.client.webhooks.edit(this.id, body, { reason, token: this.token });
|
|
44
|
+
}
|
|
45
|
+
delete(reason) {
|
|
46
|
+
return this.client.webhooks.delete(this.id, { token: this.token, reason });
|
|
47
|
+
}
|
|
48
|
+
static messages({ client, webhookId, webhookToken }) {
|
|
49
|
+
return {
|
|
50
|
+
write: (payload) => client.webhooks.messages.write(webhookId, webhookToken, payload),
|
|
51
|
+
edit: (payload) => client.webhooks.messages.edit(webhookId, webhookToken, payload),
|
|
52
|
+
delete: (messageId, reason) => client.webhooks.messages.delete(webhookId, webhookToken, messageId, reason),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static methods({ client, webhookId, webhookToken }) {
|
|
56
|
+
return {
|
|
57
|
+
delete: (reason) => client.webhooks.delete(webhookId, { reason, token: webhookToken }),
|
|
58
|
+
edit: (body, reason) => client.webhooks.edit(webhookId, body, { token: webhookToken, reason }),
|
|
59
|
+
fetch: () => client.webhooks.fetch(webhookId, webhookToken),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Webhook = Webhook;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { ChannelType, VideoQualityMode, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildForumChannel, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, type ThreadAutoArchiveDuration } from 'discord-api-types/v10';
|
|
2
|
+
import type { BaseClient } from '../client/base';
|
|
3
|
+
import type { APIChannelBase, APIGuildChannel, APIGuildForumDefaultReactionEmoji, APIGuildForumTag, EmojiResolvable, MessageCreateBodyRequest, MessageUpdateBodyRequest, MethodContext, ObjectToLower, RESTGetAPIChannelMessageReactionUsersQuery, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIGuildChannelJSONBody, SortOrderType, StringToNumber, ToClass } from '../common';
|
|
4
|
+
import { Webhook } from './Webhook';
|
|
5
|
+
import { DiscordBase } from './extra/DiscordBase';
|
|
6
|
+
export declare class BaseChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
|
|
7
|
+
type: T;
|
|
8
|
+
constructor(client: BaseClient, data: APIChannelBase<ChannelType>);
|
|
9
|
+
static __intent__(id: '@me'): 'DirectMessages';
|
|
10
|
+
static __intent__(id: string): 'DirectMessages' | 'Guilds';
|
|
11
|
+
/** The URL to the channel */
|
|
12
|
+
get url(): string;
|
|
13
|
+
fetch(force?: boolean): Promise<AllChannels>;
|
|
14
|
+
delete(reason?: string): Promise<AllChannels>;
|
|
15
|
+
edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<AllChannels>;
|
|
16
|
+
toString(): string;
|
|
17
|
+
isStage(): this is StageChannel;
|
|
18
|
+
isMedia(): this is MediaChannel;
|
|
19
|
+
isDM(): this is DMChannel;
|
|
20
|
+
isForum(): this is ForumChannel;
|
|
21
|
+
isThread(): this is ThreadChannel;
|
|
22
|
+
isDirectory(): this is DirectoryChannel;
|
|
23
|
+
isVoice(): this is VoiceChannel;
|
|
24
|
+
isTextGuild(): this is TextGuildChannel;
|
|
25
|
+
isCategory(): this is CategoryChannel;
|
|
26
|
+
isNews(): this is NewsChannel;
|
|
27
|
+
isTextable(): this is AllTextableChannels;
|
|
28
|
+
isGuildTextable(): this is AllGuildTextableChannels;
|
|
29
|
+
isThreadOnly(): this is ForumChannel | MediaChannel;
|
|
30
|
+
is<T extends (keyof IChannelTypes)[]>(channelTypes: T): this is IChannelTypes[T[number]];
|
|
31
|
+
static allMethods(ctx: MethodContext<{
|
|
32
|
+
guildId: string;
|
|
33
|
+
}>): {
|
|
34
|
+
list: (force?: boolean) => Promise<AllChannels[]>;
|
|
35
|
+
fetch: (id: string, force?: boolean) => Promise<AllChannels>;
|
|
36
|
+
create: (body: RESTPostAPIGuildChannelJSONBody) => Promise<AllChannels>;
|
|
37
|
+
delete: (id: string, reason?: string) => Promise<AllChannels>;
|
|
38
|
+
edit: (id: string, body: RESTPatchAPIChannelJSONBody, reason?: string) => Promise<AllChannels>;
|
|
39
|
+
editPositions: (body: RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<never>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
interface IChannelTypes {
|
|
43
|
+
GuildStageVoice: StageChannel;
|
|
44
|
+
GuildMedia: MediaChannel;
|
|
45
|
+
DM: DMChannel;
|
|
46
|
+
GuildForum: ForumChannel;
|
|
47
|
+
AnnouncementThread: ThreadChannel;
|
|
48
|
+
PrivateThread: ThreadChannel;
|
|
49
|
+
PublicThread: ThreadChannel;
|
|
50
|
+
GuildDirectory: DirectoryChannel;
|
|
51
|
+
GuildVoice: VoiceChannel;
|
|
52
|
+
GuildText: TextGuildChannel;
|
|
53
|
+
GuildCategory: CategoryChannel;
|
|
54
|
+
GuildAnnouncement: NewsChannel;
|
|
55
|
+
}
|
|
56
|
+
export interface BaseGuildChannel extends ObjectToLower<APIGuildChannel<ChannelType>> {
|
|
57
|
+
}
|
|
58
|
+
export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
59
|
+
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
|
|
60
|
+
get url(): string;
|
|
61
|
+
setPosition(position: number, reason?: string): Promise<AllChannels>;
|
|
62
|
+
setName(name: string, reason?: string): Promise<AllChannels>;
|
|
63
|
+
setParent(parent_id: string | null, reason?: string): Promise<AllChannels>;
|
|
64
|
+
}
|
|
65
|
+
export interface MessagesMethods extends BaseChannel<ChannelType> {
|
|
66
|
+
}
|
|
67
|
+
export declare class MessagesMethods extends DiscordBase {
|
|
68
|
+
typing(): Promise<never>;
|
|
69
|
+
messages: {
|
|
70
|
+
write: (body: MessageCreateBodyRequest) => Promise<import("./Message").Message>;
|
|
71
|
+
edit: (messageId: string, body: MessageUpdateBodyRequest) => Promise<import("./Message").Message>;
|
|
72
|
+
crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
|
|
73
|
+
delete: (messageId: string, reason?: string) => Promise<void>;
|
|
74
|
+
fetch: (messageId: string) => Promise<import("./Message").Message>;
|
|
75
|
+
purge: (messages: string[], reason?: string) => Promise<never>;
|
|
76
|
+
};
|
|
77
|
+
pins: {
|
|
78
|
+
fetch: () => Promise<import("./Message").Message[]>;
|
|
79
|
+
set: (messageId: string, reason?: string) => Promise<never>;
|
|
80
|
+
delete: (messageId: string, reason?: string) => Promise<never>;
|
|
81
|
+
};
|
|
82
|
+
reactions: {
|
|
83
|
+
add: (messageId: string, emoji: EmojiResolvable) => Promise<never>;
|
|
84
|
+
delete: (messageId: string, emoji: EmojiResolvable, userId?: string) => Promise<never>;
|
|
85
|
+
fetch: (messageId: string, emoji: EmojiResolvable, query?: RESTGetAPIChannelMessageReactionUsersQuery) => Promise<import("./User").User[]>;
|
|
86
|
+
purge: (messageId: string, emoji?: EmojiResolvable) => Promise<never>;
|
|
87
|
+
};
|
|
88
|
+
static messages(ctx: MethodContext<{
|
|
89
|
+
channelId: string;
|
|
90
|
+
}>): {
|
|
91
|
+
write: (body: MessageCreateBodyRequest) => Promise<import("./Message").Message>;
|
|
92
|
+
edit: (messageId: string, body: MessageUpdateBodyRequest) => Promise<import("./Message").Message>;
|
|
93
|
+
crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
|
|
94
|
+
delete: (messageId: string, reason?: string) => Promise<void>;
|
|
95
|
+
fetch: (messageId: string) => Promise<import("./Message").Message>;
|
|
96
|
+
purge: (messages: string[], reason?: string) => Promise<never>;
|
|
97
|
+
};
|
|
98
|
+
static reactions(ctx: MethodContext<{
|
|
99
|
+
channelId: string;
|
|
100
|
+
}>): {
|
|
101
|
+
add: (messageId: string, emoji: EmojiResolvable) => Promise<never>;
|
|
102
|
+
delete: (messageId: string, emoji: EmojiResolvable, userId?: string) => Promise<never>;
|
|
103
|
+
fetch: (messageId: string, emoji: EmojiResolvable, query?: RESTGetAPIChannelMessageReactionUsersQuery) => Promise<import("./User").User[]>;
|
|
104
|
+
purge: (messageId: string, emoji?: EmojiResolvable) => Promise<never>;
|
|
105
|
+
};
|
|
106
|
+
static pins(ctx: MethodContext<{
|
|
107
|
+
channelId: string;
|
|
108
|
+
}>): {
|
|
109
|
+
fetch: () => Promise<import("./Message").Message[]>;
|
|
110
|
+
set: (messageId: string, reason?: string) => Promise<never>;
|
|
111
|
+
delete: (messageId: string, reason?: string) => Promise<never>;
|
|
112
|
+
};
|
|
113
|
+
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest): T;
|
|
114
|
+
}
|
|
115
|
+
export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type'>>, MessagesMethods {
|
|
116
|
+
}
|
|
117
|
+
export declare class TextBaseGuildChannel extends BaseGuildChannel {
|
|
118
|
+
}
|
|
119
|
+
export default function channelFrom(data: APIChannelBase<ChannelType>, client: BaseClient): AllChannels;
|
|
120
|
+
export interface TopicableGuildChannel extends BaseChannel<ChannelType> {
|
|
121
|
+
}
|
|
122
|
+
export declare class TopicableGuildChannel extends DiscordBase {
|
|
123
|
+
setTopic(topic: string | null, reason?: string): Promise<AllChannels>;
|
|
124
|
+
}
|
|
125
|
+
export interface ThreadOnlyMethods extends BaseChannel<ChannelType>, TopicableGuildChannel {
|
|
126
|
+
}
|
|
127
|
+
export declare class ThreadOnlyMethods extends DiscordBase {
|
|
128
|
+
setTags(tags: APIGuildForumTag[], reason?: string): Promise<AllChannels>;
|
|
129
|
+
setAutoArchiveDuration(duration: ThreadAutoArchiveDuration, reason?: string): Promise<AllChannels>;
|
|
130
|
+
setReactionEmoji(emoji: APIGuildForumDefaultReactionEmoji, reason?: string): Promise<AllChannels>;
|
|
131
|
+
setSortOrder(sort: SortOrderType, reason?: string): Promise<AllChannels>;
|
|
132
|
+
setThreadRateLimit(rate: number, reason?: string): Promise<AllChannels>;
|
|
133
|
+
}
|
|
134
|
+
export interface VoiceChannelMethods extends BaseChannel<ChannelType> {
|
|
135
|
+
}
|
|
136
|
+
export declare class VoiceChannelMethods extends DiscordBase {
|
|
137
|
+
setBitrate(bitrate: number | null, reason?: string): Promise<AllChannels>;
|
|
138
|
+
setUserLimit(user_limit: number | null, reason?: string): Promise<AllChannels>;
|
|
139
|
+
setRTC(rtc_region: string | null, reason?: string): Promise<AllChannels>;
|
|
140
|
+
setVideoQuality(quality: keyof typeof VideoQualityMode, reason?: string): Promise<AllChannels>;
|
|
141
|
+
}
|
|
142
|
+
export declare class WebhookGuildMethods extends DiscordBase {
|
|
143
|
+
webhooks: {
|
|
144
|
+
list: () => Promise<Webhook[]>;
|
|
145
|
+
};
|
|
146
|
+
static guild(ctx: MethodContext<{
|
|
147
|
+
guildId: string;
|
|
148
|
+
}>): {
|
|
149
|
+
list: () => Promise<Webhook[]>;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export declare class WebhookChannelMethods extends DiscordBase {
|
|
153
|
+
webhooks: {
|
|
154
|
+
list: () => Promise<Webhook[]>;
|
|
155
|
+
create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<Webhook>;
|
|
156
|
+
};
|
|
157
|
+
static channel(ctx: MethodContext<{
|
|
158
|
+
channelId: string;
|
|
159
|
+
}>): {
|
|
160
|
+
list: () => Promise<Webhook[]>;
|
|
161
|
+
create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<Webhook>;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export interface TextGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type'>>, BaseGuildChannel, TextBaseGuildChannel, WebhookChannelMethods {
|
|
165
|
+
}
|
|
166
|
+
export declare class TextGuildChannel extends BaseGuildChannel {
|
|
167
|
+
type: ChannelType.GuildText;
|
|
168
|
+
setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<AllChannels>;
|
|
169
|
+
setNsfw(nsfw?: boolean, reason?: string): Promise<AllChannels>;
|
|
170
|
+
}
|
|
171
|
+
export interface DMChannel extends ObjectToLower<APIDMChannel>, Omit<MessagesMethods, 'edit'> {
|
|
172
|
+
}
|
|
173
|
+
declare const DMChannel_base: ToClass<Omit<BaseChannel<ChannelType.DM>, "edit">, DMChannel>;
|
|
174
|
+
export declare class DMChannel extends DMChannel_base {
|
|
175
|
+
type: ChannelType.DM;
|
|
176
|
+
}
|
|
177
|
+
export interface VoiceChannel extends ObjectToLower<APIGuildVoiceChannel>, Omit<TextGuildChannel, 'type'>, VoiceChannelMethods, WebhookChannelMethods {
|
|
178
|
+
}
|
|
179
|
+
export declare class VoiceChannel extends BaseChannel<ChannelType.GuildVoice> {
|
|
180
|
+
type: ChannelType.GuildVoice;
|
|
181
|
+
}
|
|
182
|
+
export interface StageChannel extends ObjectToLower<Omit<APIGuildStageVoiceChannel, 'type'>>, TopicableGuildChannel, VoiceChannelMethods {
|
|
183
|
+
}
|
|
184
|
+
export declare class StageChannel extends BaseChannel<ChannelType> {
|
|
185
|
+
type: ChannelType.GuildStageVoice;
|
|
186
|
+
}
|
|
187
|
+
export interface MediaChannel extends ObjectToLower<Omit<APIGuildMediaChannel, 'type'>>, ThreadOnlyMethods {
|
|
188
|
+
}
|
|
189
|
+
export declare class MediaChannel extends BaseChannel<ChannelType> {
|
|
190
|
+
type: ChannelType.GuildMedia;
|
|
191
|
+
}
|
|
192
|
+
export interface ForumChannel extends ObjectToLower<APIGuildForumChannel>, Omit<ThreadOnlyMethods, 'type'>, WebhookChannelMethods {
|
|
193
|
+
}
|
|
194
|
+
export declare class ForumChannel extends BaseChannel<ChannelType.GuildForum> {
|
|
195
|
+
type: ChannelType.GuildForum;
|
|
196
|
+
}
|
|
197
|
+
export interface ThreadChannel extends ObjectToLower<APIThreadChannel>, TextBaseGuildChannel {
|
|
198
|
+
}
|
|
199
|
+
export declare class ThreadChannel extends BaseChannel<ChannelType.PublicThread | ChannelType.AnnouncementThread | ChannelType.PrivateThread> {
|
|
200
|
+
type: ChannelType.PublicThread | ChannelType.AnnouncementThread | ChannelType.PrivateThread;
|
|
201
|
+
webhooks: {
|
|
202
|
+
list: () => Promise<Webhook[]>;
|
|
203
|
+
create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<Webhook>;
|
|
204
|
+
};
|
|
205
|
+
setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<AllChannels>;
|
|
206
|
+
pin(reason?: string): Promise<AllChannels>;
|
|
207
|
+
unpin(reason?: string): Promise<AllChannels>;
|
|
208
|
+
setTags(applied_tags: string[], reason?: string): Promise<AllChannels>;
|
|
209
|
+
setArchived(archived?: boolean, reason?: string): Promise<AllChannels>;
|
|
210
|
+
setAutoArchiveDuration(auto_archive_duration: StringToNumber<`${ThreadAutoArchiveDuration}`>, reason?: string): Promise<AllChannels>;
|
|
211
|
+
setInvitable(invitable?: boolean, reason?: string): Promise<AllChannels>;
|
|
212
|
+
setLocked(locked?: boolean, reason?: string): Promise<AllChannels>;
|
|
213
|
+
}
|
|
214
|
+
export interface CategoryChannel extends ObjectToLower<APIGuildCategoryChannel> {
|
|
215
|
+
}
|
|
216
|
+
declare const CategoryChannel_base: ToClass<Omit<BaseGuildChannel, "type" | "setParent">, CategoryChannel>;
|
|
217
|
+
export declare class CategoryChannel extends CategoryChannel_base {
|
|
218
|
+
type: ChannelType.GuildCategory;
|
|
219
|
+
}
|
|
220
|
+
export interface NewsChannel extends ObjectToLower<APINewsChannel>, WebhookChannelMethods {
|
|
221
|
+
}
|
|
222
|
+
export declare class NewsChannel extends BaseChannel<ChannelType.GuildAnnouncement> {
|
|
223
|
+
type: ChannelType.GuildAnnouncement;
|
|
224
|
+
addFollower(webhook_channel_id: string, reason?: string): Promise<import("discord-api-types/v10").APIFollowedChannel>;
|
|
225
|
+
}
|
|
226
|
+
export declare class DirectoryChannel extends BaseChannel<ChannelType.GuildDirectory> {
|
|
227
|
+
}
|
|
228
|
+
export type AllGuildChannels = TextGuildChannel | VoiceChannel | MediaChannel | ForumChannel | ThreadChannel | CategoryChannel | NewsChannel | DirectoryChannel | StageChannel;
|
|
229
|
+
export type AllTextableChannels = TextGuildChannel | VoiceChannel | DMChannel | NewsChannel | ThreadChannel;
|
|
230
|
+
export type AllGuildTextableChannels = TextGuildChannel | VoiceChannel | NewsChannel | ThreadChannel;
|
|
231
|
+
export type AllChannels = BaseChannel<ChannelType> | BaseGuildChannel | TextGuildChannel | DMChannel | VoiceChannel | MediaChannel | ForumChannel | ThreadChannel | CategoryChannel | NewsChannel | DirectoryChannel | StageChannel;
|
|
232
|
+
export {};
|