chapterjs 0.1.1 → 0.1.4
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/assets/asset.d.ts +46 -0
- package/dist/assets/asset.js +86 -0
- package/dist/assets/public.d.ts +19 -0
- package/dist/assets/public.js +120 -0
- package/dist/cache/cache.d.ts +62 -0
- package/dist/cache/cache.js +80 -0
- package/dist/cache/store.d.ts +45 -0
- package/dist/cache/store.js +53 -0
- package/dist/cli/build.d.ts +41 -0
- package/dist/cli/build.js +206 -0
- package/dist/cli/cli.js +108 -25
- package/dist/cli/cluster.d.ts +70 -0
- package/dist/cli/cluster.js +213 -0
- package/dist/cli/dev.d.ts +18 -1
- package/dist/cli/dev.js +252 -198
- package/dist/cli/env.d.ts +31 -0
- package/dist/cli/env.js +93 -0
- package/dist/cli/log.d.ts +13 -0
- package/dist/cli/log.js +17 -0
- package/dist/cli/node-version.d.ts +8 -0
- package/dist/cli/node-version.js +13 -0
- package/dist/cli/preflight.d.ts +36 -0
- package/dist/cli/preflight.js +122 -0
- package/dist/cli/project.d.ts +122 -0
- package/dist/cli/project.js +452 -0
- package/dist/cli/start.d.ts +25 -0
- package/dist/cli/start.js +225 -0
- package/dist/commands/autocomplete.d.ts +13 -0
- package/dist/commands/autocomplete.js +159 -0
- package/dist/commands/command.d.ts +346 -0
- package/dist/commands/command.js +28 -0
- package/dist/commands/convention.d.ts +64 -0
- package/dist/commands/convention.js +464 -0
- package/dist/commands/register.d.ts +18 -0
- package/dist/commands/register.js +42 -0
- package/dist/commands/router.d.ts +20 -0
- package/dist/commands/router.js +228 -0
- package/dist/commands/tree.d.ts +43 -0
- package/dist/commands/tree.js +206 -0
- package/dist/commands/twins.d.ts +15 -0
- package/dist/commands/twins.js +78 -0
- package/dist/components/button.d.ts +79 -0
- package/dist/components/button.js +108 -0
- package/dist/components/component.d.ts +140 -0
- package/dist/components/component.js +39 -0
- package/dist/components/convention.d.ts +35 -0
- package/dist/components/convention.js +339 -0
- package/dist/components/custom-id.d.ts +72 -0
- package/dist/components/custom-id.js +128 -0
- package/dist/components/embed.d.ts +28 -0
- package/dist/components/embed.js +11 -0
- package/dist/components/file.d.ts +30 -0
- package/dist/components/file.js +52 -0
- package/dist/components/instance.d.ts +100 -0
- package/dist/components/instance.js +86 -0
- package/dist/components/layout.d.ts +103 -0
- package/dist/components/layout.js +279 -0
- package/dist/components/modal.d.ts +244 -0
- package/dist/components/modal.js +399 -0
- package/dist/components/options.d.ts +41 -0
- package/dist/components/options.js +101 -0
- package/dist/components/render.d.ts +12 -0
- package/dist/components/render.js +58 -0
- package/dist/components/router.d.ts +18 -0
- package/dist/components/router.js +256 -0
- package/dist/components/select.d.ts +144 -0
- package/dist/components/select.js +179 -0
- package/dist/core/bot.d.ts +99 -0
- package/dist/core/bot.js +174 -0
- package/dist/core/memory.d.ts +66 -0
- package/dist/core/memory.js +115 -0
- package/dist/discord/api.d.ts +112 -0
- package/dist/discord/api.js +115 -0
- package/dist/discord/cdn.d.ts +67 -0
- package/dist/discord/cdn.js +100 -0
- package/dist/discord/codes.d.ts +171 -0
- package/dist/discord/codes.js +421 -0
- package/dist/discord/endpoint.d.ts +56 -0
- package/dist/discord/endpoint.js +53 -0
- package/dist/discord/endpoints.d.ts +1529 -0
- package/dist/discord/endpoints.js +1139 -0
- package/dist/discord/formatting.d.ts +67 -0
- package/dist/discord/formatting.js +87 -0
- package/dist/discord/index.d.ts +10 -0
- package/dist/discord/index.js +13 -0
- package/dist/discord/intents.d.ts +48 -0
- package/dist/discord/intents.js +128 -0
- package/dist/discord/permissions.d.ts +94 -0
- package/dist/discord/permissions.js +185 -0
- package/dist/discord/snowflake.d.ts +21 -0
- package/dist/discord/snowflake.js +36 -0
- package/dist/discord/types/application-command.d.ts +332 -0
- package/dist/discord/types/application-command.js +48 -0
- package/dist/discord/types/application-role-connection-metadata.d.ts +42 -0
- package/dist/discord/types/application-role-connection-metadata.js +22 -0
- package/dist/discord/types/application.d.ts +208 -0
- package/dist/discord/types/application.js +48 -0
- package/dist/discord/types/audit-log.d.ts +255 -0
- package/dist/discord/types/audit-log.js +144 -0
- package/dist/discord/types/auto-moderation.d.ts +167 -0
- package/dist/discord/types/auto-moderation.js +52 -0
- package/dist/discord/types/channel.d.ts +557 -0
- package/dist/discord/types/channel.js +88 -0
- package/dist/discord/types/common.d.ts +54 -0
- package/dist/discord/types/common.js +38 -0
- package/dist/discord/types/component.d.ts +775 -0
- package/dist/discord/types/component.js +76 -0
- package/dist/discord/types/emoji.d.ts +74 -0
- package/dist/discord/types/emoji.js +1 -0
- package/dist/discord/types/entitlement.d.ts +84 -0
- package/dist/discord/types/entitlement.js +22 -0
- package/dist/discord/types/gateway-events.d.ts +1148 -0
- package/dist/discord/types/gateway-events.js +54 -0
- package/dist/discord/types/gateway.d.ts +38 -0
- package/dist/discord/types/gateway.js +1 -0
- package/dist/discord/types/guild-scheduled-event.d.ts +257 -0
- package/dist/discord/types/guild-scheduled-event.js +68 -0
- package/dist/discord/types/guild-template.d.ts +51 -0
- package/dist/discord/types/guild-template.js +1 -0
- package/dist/discord/types/guild.d.ts +910 -0
- package/dist/discord/types/guild.js +153 -0
- package/dist/discord/types/index.d.ts +31 -0
- package/dist/discord/types/index.js +31 -0
- package/dist/discord/types/interaction.d.ts +321 -0
- package/dist/discord/types/interaction.js +47 -0
- package/dist/discord/types/invite.d.ts +158 -0
- package/dist/discord/types/invite.js +39 -0
- package/dist/discord/types/message.d.ts +834 -0
- package/dist/discord/types/message.js +159 -0
- package/dist/discord/types/oauth2.d.ts +22 -0
- package/dist/discord/types/oauth2.js +1 -0
- package/dist/discord/types/permissions.d.ts +183 -0
- package/dist/discord/types/permissions.js +118 -0
- package/dist/discord/types/poll.d.ts +106 -0
- package/dist/discord/types/poll.js +8 -0
- package/dist/discord/types/sku.d.ts +47 -0
- package/dist/discord/types/sku.js +26 -0
- package/dist/discord/types/soundboard.d.ts +71 -0
- package/dist/discord/types/soundboard.js +1 -0
- package/dist/discord/types/stage-instance.d.ts +58 -0
- package/dist/discord/types/stage-instance.js +10 -0
- package/dist/discord/types/sticker.d.ts +115 -0
- package/dist/discord/types/sticker.js +20 -0
- package/dist/discord/types/subscription.d.ts +54 -0
- package/dist/discord/types/subscription.js +12 -0
- package/dist/discord/types/team.d.ts +55 -0
- package/dist/discord/types/team.js +21 -0
- package/dist/discord/types/user.d.ts +273 -0
- package/dist/discord/types/user.js +83 -0
- package/dist/discord/types/voice.d.ts +72 -0
- package/dist/discord/types/voice.js +1 -0
- package/dist/discord/types/webhook.d.ts +184 -0
- package/dist/discord/types/webhook.js +12 -0
- package/dist/events/convention.d.ts +25 -0
- package/dist/events/convention.js +97 -0
- package/dist/events/event.d.ts +8 -0
- package/dist/events/event.js +20 -0
- package/dist/events/registry.d.ts +706 -0
- package/dist/events/registry.js +839 -0
- package/dist/events/router.d.ts +45 -0
- package/dist/events/router.js +133 -0
- package/dist/events/types.d.ts +7 -0
- package/dist/events/types.js +48 -0
- package/dist/gateway/errors.d.ts +18 -0
- package/dist/gateway/errors.js +47 -0
- package/dist/gateway/gateway.d.ts +64 -0
- package/dist/gateway/gateway.js +117 -0
- package/dist/gateway/identify-queue.d.ts +25 -0
- package/dist/gateway/identify-queue.js +29 -0
- package/dist/gateway/shard.d.ts +94 -0
- package/dist/gateway/shard.js +414 -0
- package/dist/gateway/state.d.ts +11 -0
- package/dist/gateway/state.js +184 -0
- package/dist/index.d.ts +55 -18
- package/dist/index.js +38 -12
- package/dist/interactions/cooldown.d.ts +33 -0
- package/dist/interactions/cooldown.js +74 -0
- package/dist/interactions/dispatch.d.ts +91 -0
- package/dist/interactions/dispatch.js +110 -0
- package/dist/loader/generated.d.ts +37 -0
- package/dist/loader/generated.js +114 -0
- package/dist/loader/hot.d.ts +13 -0
- package/dist/loader/hot.js +85 -0
- package/dist/loader/loader.d.ts +72 -0
- package/dist/loader/loader.js +135 -0
- package/dist/loader/locate.d.ts +10 -0
- package/dist/loader/locate.js +36 -0
- package/dist/loader/watch.d.ts +17 -0
- package/dist/loader/watch.js +66 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +6 -0
- package/dist/messages/commands.d.ts +23 -0
- package/dist/messages/commands.js +123 -0
- package/dist/messages/convention.d.ts +89 -0
- package/dist/messages/convention.js +347 -0
- package/dist/messages/messages.d.ts +219 -0
- package/dist/messages/messages.js +30 -0
- package/dist/messages/phrases.d.ts +23 -0
- package/dist/messages/phrases.js +44 -0
- package/dist/messages/translate.d.ts +100 -0
- package/dist/messages/translate.js +249 -0
- package/dist/presence/convention.d.ts +26 -0
- package/dist/presence/convention.js +133 -0
- package/dist/presence/presence.d.ts +57 -0
- package/dist/presence/presence.js +27 -0
- package/dist/rest/errors.d.ts +55 -0
- package/dist/rest/errors.js +92 -0
- package/dist/rest/rate-limiter.d.ts +46 -0
- package/dist/rest/rate-limiter.js +153 -0
- package/dist/rest/rest.d.ts +63 -0
- package/dist/rest/rest.js +194 -0
- package/dist/structures/base.d.ts +48 -0
- package/dist/structures/base.js +84 -0
- package/dist/structures/channel.d.ts +380 -0
- package/dist/structures/channel.js +627 -0
- package/dist/structures/context.d.ts +30 -0
- package/dist/structures/context.js +7 -0
- package/dist/structures/emoji.d.ts +46 -0
- package/dist/structures/emoji.js +65 -0
- package/dist/structures/entities.d.ts +62 -0
- package/dist/structures/entities.js +226 -0
- package/dist/structures/guild.d.ts +348 -0
- package/dist/structures/guild.js +466 -0
- package/dist/structures/interaction.d.ts +197 -0
- package/dist/structures/interaction.js +396 -0
- package/dist/structures/invite.d.ts +38 -0
- package/dist/structures/invite.js +57 -0
- package/dist/structures/known.d.ts +28 -0
- package/dist/structures/known.js +58 -0
- package/dist/structures/member.d.ts +140 -0
- package/dist/structures/member.js +260 -0
- package/dist/structures/message.d.ts +197 -0
- package/dist/structures/message.js +268 -0
- package/dist/structures/payload.d.ts +91 -0
- package/dist/structures/payload.js +184 -0
- package/dist/structures/role.d.ts +69 -0
- package/dist/structures/role.js +112 -0
- package/dist/structures/user.d.ts +59 -0
- package/dist/structures/user.js +94 -0
- package/dist/structures/webhook.d.ts +46 -0
- package/dist/structures/webhook.js +79 -0
- package/dist/tasks/convention.d.ts +26 -0
- package/dist/tasks/convention.js +78 -0
- package/dist/tasks/schedule.d.ts +54 -0
- package/dist/tasks/schedule.js +236 -0
- package/dist/tasks/scheduler.d.ts +33 -0
- package/dist/tasks/scheduler.js +107 -0
- package/dist/tasks/task.d.ts +76 -0
- package/dist/tasks/task.js +28 -0
- package/dist/util/case.d.ts +13 -0
- package/dist/util/case.js +54 -0
- package/dist/util/duration.d.ts +8 -0
- package/dist/util/duration.js +29 -0
- package/dist/util/websocket.d.ts +9 -0
- package/dist/util/websocket.js +31 -0
- package/dist/voice/connection.d.ts +90 -0
- package/dist/voice/connection.js +494 -0
- package/dist/voice/dave.d.ts +109 -0
- package/dist/voice/dave.js +245 -0
- package/dist/voice/opus.d.ts +19 -0
- package/dist/voice/opus.js +273 -0
- package/dist/voice/session.d.ts +55 -0
- package/dist/voice/session.js +405 -0
- package/dist/voice/source.d.ts +22 -0
- package/dist/voice/source.js +195 -0
- package/dist/voice/transport.d.ts +43 -0
- package/dist/voice/transport.js +140 -0
- package/dist/voice/usage.d.ts +4 -0
- package/dist/voice/usage.js +33 -0
- package/package.json +26 -7
- package/vendor/dave/LICENSE +231 -0
- package/vendor/dave/libdave.d.mts +99 -0
- package/vendor/dave/libdave.mjs +2 -0
- package/vendor/dave/libdave.wasm +0 -0
- package/dist/components.d.ts +0 -97
- package/dist/components.js +0 -260
- package/dist/context.d.ts +0 -72
- package/dist/context.js +0 -273
- package/dist/discord/client.d.ts +0 -35
- package/dist/discord/client.js +0 -66
- package/dist/discord/constants.d.ts +0 -49
- package/dist/discord/constants.js +0 -61
- package/dist/discord/events.d.ts +0 -129
- package/dist/discord/events.js +0 -102
- package/dist/discord/gateway.d.ts +0 -61
- package/dist/discord/gateway.js +0 -320
- package/dist/discord/payloads.d.ts +0 -275
- package/dist/discord/payloads.js +0 -3
- package/dist/discord/presence.d.ts +0 -42
- package/dist/discord/presence.js +0 -51
- package/dist/discord/rest.d.ts +0 -49
- package/dist/discord/rest.js +0 -271
- package/dist/discord/types.d.ts +0 -334
- package/dist/discord/types.js +0 -4
- package/dist/events.d.ts +0 -94
- package/dist/events.js +0 -255
- package/dist/presence.d.ts +0 -92
- package/dist/presence.js +0 -250
- package/dist/structures/Channel.d.ts +0 -110
- package/dist/structures/Channel.js +0 -171
- package/dist/structures/Guild.d.ts +0 -70
- package/dist/structures/Guild.js +0 -105
- package/dist/structures/Interaction.d.ts +0 -113
- package/dist/structures/Interaction.js +0 -274
- package/dist/structures/Member.d.ts +0 -70
- package/dist/structures/Member.js +0 -124
- package/dist/structures/Message.d.ts +0 -87
- package/dist/structures/Message.js +0 -182
- package/dist/structures/Reaction.d.ts +0 -38
- package/dist/structures/Reaction.js +0 -64
- package/dist/structures/Role.d.ts +0 -43
- package/dist/structures/Role.js +0 -77
- package/dist/structures/User.d.ts +0 -41
- package/dist/structures/User.js +0 -79
- package/dist/structures/utils.d.ts +0 -72
- package/dist/structures/utils.js +0 -59
- package/dist/utils/errors.d.ts +0 -5
- package/dist/utils/errors.js +0 -28
- package/dist/utils/modules.d.ts +0 -39
- package/dist/utils/modules.js +0 -156
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import type { CacheStore } from '../cache/store.js';
|
|
2
|
+
import { Permissions, type PermissionResolvable } from '../discord/permissions.js';
|
|
3
|
+
import { ChannelType, type CreateChannelInviteJSONParams, type ModifyGuildChannelJSONParams, type ModifyThreadJSONParams, type RawChannel, type RawForumTag, type RawThreadMember, type StartThreadWithoutMessageJSONParams } from '../discord/types/channel.js';
|
|
4
|
+
import type { Snowflake } from '../discord/types/common.js';
|
|
5
|
+
import type { CreateWebhookJSONParams } from '../discord/types/webhook.js';
|
|
6
|
+
import { type Camelize } from '../util/case.js';
|
|
7
|
+
import { IdStructure } from './base.js';
|
|
8
|
+
import type { Guild } from './guild.js';
|
|
9
|
+
import type { Invite } from './invite.js';
|
|
10
|
+
import { GuildMember } from './member.js';
|
|
11
|
+
import { type Message } from './message.js';
|
|
12
|
+
import { type MessageInput } from './payload.js';
|
|
13
|
+
import { Role } from './role.js';
|
|
14
|
+
import type { User } from './user.js';
|
|
15
|
+
import type { Webhook } from './webhook.js';
|
|
16
|
+
import type { JoinOptions, VoiceConnection } from '../voice/connection.js';
|
|
17
|
+
/** Only the framework writes to the messages of a channel. */
|
|
18
|
+
export declare function messagesOf(channel: Channel): CacheStore<Snowflake, Message>;
|
|
19
|
+
/**
|
|
20
|
+
* A channel of any kind. Use the `is...()` methods to know which kind it is
|
|
21
|
+
* and get the properties and actions of that kind.
|
|
22
|
+
* @see https://docs.discord.com/developers/resources/channel#channel-object
|
|
23
|
+
*/
|
|
24
|
+
export declare class Channel extends IdStructure<RawChannel> {
|
|
25
|
+
/**
|
|
26
|
+
* The kind of channel, as a value of `ChannelType`.
|
|
27
|
+
* @see https://docs.discord.com/developers/resources/channel#channel-object-channel-types
|
|
28
|
+
*/
|
|
29
|
+
get type(): ChannelType;
|
|
30
|
+
/** The id of the server of the channel; `null` for a private one. */
|
|
31
|
+
get guildId(): Snowflake | null;
|
|
32
|
+
/** The server of the channel; `null` for a private one. */
|
|
33
|
+
get guild(): Guild | null;
|
|
34
|
+
/** Whether messages can be sent in it. */
|
|
35
|
+
isTextBased(): this is TextBasedChannel;
|
|
36
|
+
/** Whether it belongs to a server and is not a thread. */
|
|
37
|
+
isGuildChannel(): this is GuildChannel;
|
|
38
|
+
/** A text or announcement channel of a server. */
|
|
39
|
+
isText(): this is TextChannel;
|
|
40
|
+
/** A voice or stage channel. */
|
|
41
|
+
isVoice(): this is VoiceChannel;
|
|
42
|
+
/** A category, which groups channels. */
|
|
43
|
+
isCategory(): this is CategoryChannel;
|
|
44
|
+
/** A forum or media channel, made of posts. */
|
|
45
|
+
isForum(): this is ForumChannel;
|
|
46
|
+
/** A thread, or a post of a forum. */
|
|
47
|
+
isThread(): this is ThreadChannel;
|
|
48
|
+
/** A private conversation. */
|
|
49
|
+
isDM(): this is DMChannel;
|
|
50
|
+
/** Asks Discord for the latest data of the channel. */
|
|
51
|
+
fetch(): Promise<Channel>;
|
|
52
|
+
/**
|
|
53
|
+
* Deletes the channel (closes it, for a private conversation).
|
|
54
|
+
* @see https://docs.discord.com/developers/resources/channel#deleteclose-channel
|
|
55
|
+
*/
|
|
56
|
+
delete(reason?: string): Promise<void>;
|
|
57
|
+
/** `<#id>`: links the channel when put in a message. */
|
|
58
|
+
toString(): string;
|
|
59
|
+
}
|
|
60
|
+
/** What `fetchMessages()` takes: how many messages, and from where. */
|
|
61
|
+
export interface FetchMessagesOptions {
|
|
62
|
+
/** How many messages, from 1 to 100. Default: 50. */
|
|
63
|
+
limit?: number;
|
|
64
|
+
/** Only messages before this one. */
|
|
65
|
+
before?: Snowflake | {
|
|
66
|
+
id: Snowflake;
|
|
67
|
+
};
|
|
68
|
+
/** Only messages after this one. */
|
|
69
|
+
after?: Snowflake | {
|
|
70
|
+
id: Snowflake;
|
|
71
|
+
};
|
|
72
|
+
/** Messages around this one. */
|
|
73
|
+
around?: Snowflake | {
|
|
74
|
+
id: Snowflake;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** What every channel messages can be sent in has. */
|
|
78
|
+
export interface TextBasedMethods {
|
|
79
|
+
/** The messages of the channel the bot remembers. */
|
|
80
|
+
readonly messages: ReadonlyMap<Snowflake, Message>;
|
|
81
|
+
/** The id of the last message sent in the channel, when known. */
|
|
82
|
+
readonly lastMessageId: Snowflake | null;
|
|
83
|
+
/**
|
|
84
|
+
* Sends a message in the channel.
|
|
85
|
+
* @see https://docs.discord.com/developers/resources/message#create-message
|
|
86
|
+
*/
|
|
87
|
+
send(message: MessageInput): Promise<Message>;
|
|
88
|
+
/**
|
|
89
|
+
* A message of the channel: from what the bot remembers, or else from Discord.
|
|
90
|
+
* @see https://docs.discord.com/developers/resources/message#get-channel-message
|
|
91
|
+
*/
|
|
92
|
+
fetchMessage(id: Snowflake, options?: {
|
|
93
|
+
force?: boolean;
|
|
94
|
+
}): Promise<Message>;
|
|
95
|
+
/**
|
|
96
|
+
* The latest messages of the channel, newest first.
|
|
97
|
+
* @see https://docs.discord.com/developers/resources/message#get-channel-messages
|
|
98
|
+
*/
|
|
99
|
+
fetchMessages(options?: FetchMessagesOptions): Promise<Message[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes several messages at once. Messages older than two weeks can't
|
|
102
|
+
* be deleted in bulk: they are left out, and their number is not counted
|
|
103
|
+
* in the result.
|
|
104
|
+
* @returns how many messages were deleted
|
|
105
|
+
* @see https://docs.discord.com/developers/resources/message#bulk-delete-messages
|
|
106
|
+
*/
|
|
107
|
+
bulkDelete(messages: readonly (Snowflake | {
|
|
108
|
+
id: Snowflake;
|
|
109
|
+
})[], reason?: string): Promise<number>;
|
|
110
|
+
/**
|
|
111
|
+
* Shows "the bot is typing…" for 10 seconds, or until it sends a message.
|
|
112
|
+
* @see https://docs.discord.com/developers/resources/channel#trigger-typing-indicator
|
|
113
|
+
*/
|
|
114
|
+
sendTyping(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* The pinned messages of the channel, latest pin first.
|
|
117
|
+
* @see https://docs.discord.com/developers/resources/message#get-channel-pins
|
|
118
|
+
*/
|
|
119
|
+
fetchPins(): Promise<Message[]>;
|
|
120
|
+
}
|
|
121
|
+
/** What a role or a member is allowed or denied in one channel. */
|
|
122
|
+
export interface PermissionOverwrite {
|
|
123
|
+
/** The id of the role or of the member. */
|
|
124
|
+
id: Snowflake;
|
|
125
|
+
/** Whether it applies to a role or to a member. */
|
|
126
|
+
type: 'role' | 'member';
|
|
127
|
+
/** What is allowed, whatever the server says. */
|
|
128
|
+
allow: Permissions;
|
|
129
|
+
/** What is denied, whatever the server says. */
|
|
130
|
+
deny: Permissions;
|
|
131
|
+
}
|
|
132
|
+
/** What `edit()` takes on a channel of a server. */
|
|
133
|
+
export type GuildChannelEditOptions = Camelize<ModifyGuildChannelJSONParams>;
|
|
134
|
+
/** What `createInvite()` takes. */
|
|
135
|
+
export type InviteCreateOptions = Camelize<CreateChannelInviteJSONParams>;
|
|
136
|
+
/**
|
|
137
|
+
* A channel of a server (not a thread).
|
|
138
|
+
* @see https://docs.discord.com/developers/resources/channel#channel-object
|
|
139
|
+
*/
|
|
140
|
+
export declare class GuildChannel extends Channel {
|
|
141
|
+
/** The id of the server of the channel. */
|
|
142
|
+
get guildId(): Snowflake;
|
|
143
|
+
/** The server of the channel. */
|
|
144
|
+
get guild(): Guild;
|
|
145
|
+
/** The name of the channel. */
|
|
146
|
+
get name(): string;
|
|
147
|
+
/** Where the channel is in the list. */
|
|
148
|
+
get position(): number;
|
|
149
|
+
/** The id of the category of the channel, when it is in one. */
|
|
150
|
+
get parentId(): Snowflake | null;
|
|
151
|
+
/** The category of the channel, when it is in one and it is known. */
|
|
152
|
+
get parent(): CategoryChannel | null;
|
|
153
|
+
/** Whether the channel is age-restricted. */
|
|
154
|
+
get nsfw(): boolean;
|
|
155
|
+
/** What roles and members are allowed or denied in this channel. */
|
|
156
|
+
get permissionOverwrites(): PermissionOverwrite[];
|
|
157
|
+
/**
|
|
158
|
+
* What a member can do in this channel: their permissions in the server,
|
|
159
|
+
* changed by the overwrites of the channel.
|
|
160
|
+
* @see https://docs.discord.com/developers/topics/permissions#permission-overwrites
|
|
161
|
+
*/
|
|
162
|
+
permissionsFor(member: GuildMember): Permissions;
|
|
163
|
+
/**
|
|
164
|
+
* Changes the channel.
|
|
165
|
+
* @see https://docs.discord.com/developers/resources/channel#modify-channel
|
|
166
|
+
*/
|
|
167
|
+
edit(options: GuildChannelEditOptions, reason?: string): Promise<this>;
|
|
168
|
+
/**
|
|
169
|
+
* Allows or denies permissions to a role or a member in this channel.
|
|
170
|
+
* Permissions that are in neither list follow the server.
|
|
171
|
+
* @see https://docs.discord.com/developers/resources/channel#edit-channel-permissions
|
|
172
|
+
*/
|
|
173
|
+
setPermissions(target: Role | GuildMember | User, permissions: {
|
|
174
|
+
allow?: PermissionResolvable;
|
|
175
|
+
deny?: PermissionResolvable;
|
|
176
|
+
}, reason?: string): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Removes what was set for a role or a member in this channel.
|
|
179
|
+
* @see https://docs.discord.com/developers/resources/channel#delete-channel-permission
|
|
180
|
+
*/
|
|
181
|
+
deletePermissions(target: Snowflake | {
|
|
182
|
+
id: Snowflake;
|
|
183
|
+
}, reason?: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Creates an invite to this channel.
|
|
186
|
+
* @see https://docs.discord.com/developers/resources/channel#create-channel-invite
|
|
187
|
+
*/
|
|
188
|
+
createInvite(options?: InviteCreateOptions, reason?: string): Promise<Invite>;
|
|
189
|
+
/**
|
|
190
|
+
* The invites that lead to this channel.
|
|
191
|
+
* @see https://docs.discord.com/developers/resources/channel#get-channel-invites
|
|
192
|
+
*/
|
|
193
|
+
fetchInvites(): Promise<Invite[]>;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a webhook that posts in this channel.
|
|
196
|
+
* @see https://docs.discord.com/developers/resources/webhook#create-webhook
|
|
197
|
+
*/
|
|
198
|
+
createWebhook(options: Camelize<CreateWebhookJSONParams>, reason?: string): Promise<Webhook>;
|
|
199
|
+
/**
|
|
200
|
+
* The webhooks that post in this channel.
|
|
201
|
+
* @see https://docs.discord.com/developers/resources/webhook#get-channel-webhooks
|
|
202
|
+
*/
|
|
203
|
+
fetchWebhooks(): Promise<Webhook[]>;
|
|
204
|
+
}
|
|
205
|
+
/** What `startThread()` takes on a text channel. */
|
|
206
|
+
export type ThreadCreateOptions = Camelize<StartThreadWithoutMessageJSONParams>;
|
|
207
|
+
/** A text or announcement channel of a server. */
|
|
208
|
+
export declare class TextChannel extends GuildChannel {
|
|
209
|
+
/** The topic shown at the top of the channel. */
|
|
210
|
+
get topic(): string | null;
|
|
211
|
+
/** How many seconds a member waits between two messages (slowmode). */
|
|
212
|
+
get slowmode(): number;
|
|
213
|
+
/** Whether it is an announcement channel, which servers can follow. */
|
|
214
|
+
get isAnnouncement(): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Starts a thread that is not attached to a message. To start one from a
|
|
217
|
+
* message, use `message.startThread()`.
|
|
218
|
+
* @see https://docs.discord.com/developers/resources/channel#start-thread-without-message
|
|
219
|
+
*/
|
|
220
|
+
startThread(options: ThreadCreateOptions, reason?: string): Promise<ThreadChannel>;
|
|
221
|
+
/**
|
|
222
|
+
* Makes another channel receive what is published in this announcement
|
|
223
|
+
* channel.
|
|
224
|
+
* @see https://docs.discord.com/developers/resources/channel#follow-announcement-channel
|
|
225
|
+
*/
|
|
226
|
+
follow(target: Snowflake | {
|
|
227
|
+
id: Snowflake;
|
|
228
|
+
}, reason?: string): Promise<void>;
|
|
229
|
+
}
|
|
230
|
+
export interface TextChannel extends TextBasedMethods {
|
|
231
|
+
}
|
|
232
|
+
/** A voice or stage channel: people talk in it, and can write too. */
|
|
233
|
+
export declare class VoiceChannel extends GuildChannel {
|
|
234
|
+
/** The audio quality, in bits per second. */
|
|
235
|
+
get bitrate(): number;
|
|
236
|
+
/** How many people can join; `0` means no limit. */
|
|
237
|
+
get userLimit(): number;
|
|
238
|
+
/** The voice region of the channel; `null` when Discord picks it. */
|
|
239
|
+
get rtcRegion(): string | null;
|
|
240
|
+
/** Whether it is a stage channel, where a few speak and the others listen. */
|
|
241
|
+
get isStage(): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Joins the voice channel, or moves the bot there from another voice
|
|
244
|
+
* channel of the server. Resolves once the bot can play. On a stage, the
|
|
245
|
+
* bot becomes a speaker when it may, and asks to speak otherwise.
|
|
246
|
+
* @see https://docs.discord.com/developers/topics/voice-connections#connecting-to-voice
|
|
247
|
+
*/
|
|
248
|
+
join(options?: JoinOptions): Promise<VoiceConnection>;
|
|
249
|
+
/**
|
|
250
|
+
* Sets the status shown under the name of the voice channel; `null`
|
|
251
|
+
* removes it.
|
|
252
|
+
* @see https://docs.discord.com/developers/resources/channel#set-voice-channel-status
|
|
253
|
+
*/
|
|
254
|
+
setStatus(status: string | null, reason?: string): Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
export interface VoiceChannel extends TextBasedMethods {
|
|
257
|
+
}
|
|
258
|
+
/** A category: it groups channels. */
|
|
259
|
+
export declare class CategoryChannel extends GuildChannel {
|
|
260
|
+
/** The channels of the category the bot knows, in order. */
|
|
261
|
+
get children(): GuildChannel[];
|
|
262
|
+
}
|
|
263
|
+
/** A tag the posts of a forum can have. */
|
|
264
|
+
export type ForumTag = Camelize<RawForumTag>;
|
|
265
|
+
/** What `createPost()` takes. */
|
|
266
|
+
export interface ForumPostOptions {
|
|
267
|
+
/** The title of the post. */
|
|
268
|
+
name: string;
|
|
269
|
+
/** The first message of the post. */
|
|
270
|
+
message: MessageInput;
|
|
271
|
+
/** The ids of the tags of the post. */
|
|
272
|
+
appliedTags?: Snowflake[];
|
|
273
|
+
/** After how many minutes without activity the post is archived. */
|
|
274
|
+
autoArchiveDuration?: 60 | 1440 | 4320 | 10080;
|
|
275
|
+
/** Slowmode of the post, in seconds. */
|
|
276
|
+
slowmode?: number;
|
|
277
|
+
}
|
|
278
|
+
/** A forum or media channel: it only contains posts, which are threads. */
|
|
279
|
+
export declare class ForumChannel extends GuildChannel {
|
|
280
|
+
/** The guidelines of the forum. */
|
|
281
|
+
get topic(): string | null;
|
|
282
|
+
/** The tags posts of this forum can have. */
|
|
283
|
+
get availableTags(): ForumTag[];
|
|
284
|
+
/**
|
|
285
|
+
* Creates a post in the forum.
|
|
286
|
+
* @see https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel
|
|
287
|
+
*/
|
|
288
|
+
createPost(options: ForumPostOptions, reason?: string): Promise<ThreadChannel>;
|
|
289
|
+
}
|
|
290
|
+
/** What `edit()` takes on a thread. */
|
|
291
|
+
export type ThreadEditOptions = Camelize<ModifyThreadJSONParams>;
|
|
292
|
+
/** Someone in a thread, and since when. */
|
|
293
|
+
export type ThreadMember = Camelize<Omit<RawThreadMember, 'member'>>;
|
|
294
|
+
/**
|
|
295
|
+
* A thread, or a post of a forum.
|
|
296
|
+
* @see https://docs.discord.com/developers/topics/threads
|
|
297
|
+
*/
|
|
298
|
+
export declare class ThreadChannel extends Channel {
|
|
299
|
+
/** The id of the server of the thread. */
|
|
300
|
+
get guildId(): Snowflake;
|
|
301
|
+
/** The server of the thread. */
|
|
302
|
+
get guild(): Guild;
|
|
303
|
+
/** The name of the thread. */
|
|
304
|
+
get name(): string;
|
|
305
|
+
/** The id of the channel the thread was created in. */
|
|
306
|
+
get parentId(): Snowflake;
|
|
307
|
+
/**
|
|
308
|
+
* The channel the thread was created in; `null` when it is of a kind
|
|
309
|
+
* this version does not know.
|
|
310
|
+
*/
|
|
311
|
+
get parent(): TextChannel | ForumChannel | null;
|
|
312
|
+
/** The id of the user who created the thread. */
|
|
313
|
+
get ownerId(): Snowflake | null;
|
|
314
|
+
/** Whether the thread is archived. */
|
|
315
|
+
get archived(): boolean;
|
|
316
|
+
/** Whether only moderators can unarchive it. */
|
|
317
|
+
get locked(): boolean;
|
|
318
|
+
/** Whether only invited members and moderators can see it. */
|
|
319
|
+
get isPrivate(): boolean;
|
|
320
|
+
/** When the thread was archived or unarchived for the last time. */
|
|
321
|
+
get archivedAt(): Date | null;
|
|
322
|
+
/** An approximate count of the members of the thread (stops at 50). */
|
|
323
|
+
get memberCount(): number;
|
|
324
|
+
/** The ids of the tags of the post, in a forum. */
|
|
325
|
+
get appliedTags(): readonly Snowflake[];
|
|
326
|
+
/** Threads inherit the permissions of the channel they are in. */
|
|
327
|
+
permissionsFor(member: GuildMember): Permissions;
|
|
328
|
+
/**
|
|
329
|
+
* Changes the thread: name, archive, lock, slowmode, tags.
|
|
330
|
+
* @see https://docs.discord.com/developers/resources/channel#modify-channel
|
|
331
|
+
*/
|
|
332
|
+
edit(options: ThreadEditOptions, reason?: string): Promise<this>;
|
|
333
|
+
/** Archives the thread: it leaves the channel list but can come back. */
|
|
334
|
+
archive(reason?: string): Promise<this>;
|
|
335
|
+
/** Brings an archived thread back. */
|
|
336
|
+
unarchive(reason?: string): Promise<this>;
|
|
337
|
+
/** Makes the bot join the thread. */
|
|
338
|
+
join(): Promise<void>;
|
|
339
|
+
/** Makes the bot leave the thread. */
|
|
340
|
+
leave(): Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* Adds a member to the thread.
|
|
343
|
+
* @see https://docs.discord.com/developers/resources/channel#add-thread-member
|
|
344
|
+
*/
|
|
345
|
+
addMember(user: Snowflake | {
|
|
346
|
+
id: Snowflake;
|
|
347
|
+
}): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Removes a member from the thread.
|
|
350
|
+
* @see https://docs.discord.com/developers/resources/channel#remove-thread-member
|
|
351
|
+
*/
|
|
352
|
+
removeMember(user: Snowflake | {
|
|
353
|
+
id: Snowflake;
|
|
354
|
+
}): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* Who is in the thread (100 at most per call).
|
|
357
|
+
* @see https://docs.discord.com/developers/resources/channel#list-thread-members
|
|
358
|
+
*/
|
|
359
|
+
fetchMembers(options?: {
|
|
360
|
+
limit?: number;
|
|
361
|
+
after?: Snowflake;
|
|
362
|
+
}): Promise<ThreadMember[]>;
|
|
363
|
+
}
|
|
364
|
+
export interface ThreadChannel extends TextBasedMethods {
|
|
365
|
+
}
|
|
366
|
+
/** A private conversation between the bot and a user. */
|
|
367
|
+
export declare class DMChannel extends Channel {
|
|
368
|
+
/** The id of the user the bot talks to. */
|
|
369
|
+
get recipientId(): Snowflake | null;
|
|
370
|
+
/** The user the bot talks to, when it is known. */
|
|
371
|
+
get recipient(): User | null;
|
|
372
|
+
}
|
|
373
|
+
export interface DMChannel extends TextBasedMethods {
|
|
374
|
+
}
|
|
375
|
+
/** Any channel of a server messages can be sent in. */
|
|
376
|
+
export type GuildTextBasedChannel = TextChannel | VoiceChannel | ThreadChannel;
|
|
377
|
+
/** Any channel messages can be sent in. */
|
|
378
|
+
export type TextBasedChannel = GuildTextBasedChannel | DMChannel;
|
|
379
|
+
/** The class that represents a channel of a given type. */
|
|
380
|
+
export declare function channelClass(data: RawChannel): typeof Channel;
|