@buape/carbon 0.1.3 → 0.3.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/dist/package.json +7 -2
- package/dist/src/abstracts/BaseCommand.d.ts +1 -6
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -1
- package/dist/src/abstracts/BaseCommand.js +0 -5
- package/dist/src/abstracts/BaseCommand.js.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +6 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.js +12 -0
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +14 -7
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +29 -8
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- package/dist/src/classes/Client.d.ts +11 -0
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +43 -11
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/classes/Modal.d.ts +21 -0
- package/dist/src/classes/Modal.d.ts.map +1 -0
- package/dist/src/classes/Modal.js +14 -0
- package/dist/src/classes/Modal.js.map +1 -0
- package/dist/src/classes/Row.d.ts +7 -9
- package/dist/src/classes/Row.d.ts.map +1 -1
- package/dist/src/classes/Row.js +5 -4
- package/dist/src/classes/Row.js.map +1 -1
- package/dist/src/classes/TextInput.d.ts +40 -0
- package/dist/src/classes/TextInput.d.ts.map +1 -0
- package/dist/src/classes/TextInput.js +44 -0
- package/dist/src/classes/TextInput.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +1 -1
- package/dist/src/internals/CommandHandler.d.ts +4 -0
- package/dist/src/internals/CommandHandler.d.ts.map +1 -1
- package/dist/src/internals/CommandHandler.js +4 -0
- package/dist/src/internals/CommandHandler.js.map +1 -1
- package/dist/src/internals/ComponentHandler.d.ts +11 -0
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -1
- package/dist/src/internals/ComponentHandler.js +15 -4
- package/dist/src/internals/ComponentHandler.js.map +1 -1
- package/dist/src/internals/FieldsHandler.d.ts +27 -0
- package/dist/src/internals/FieldsHandler.d.ts.map +1 -0
- package/dist/src/internals/FieldsHandler.js +37 -0
- package/dist/src/internals/FieldsHandler.js.map +1 -0
- package/dist/src/internals/ModalHandler.d.ts +17 -0
- package/dist/src/internals/ModalHandler.d.ts.map +1 -0
- package/dist/src/internals/ModalHandler.js +25 -0
- package/dist/src/internals/ModalHandler.js.map +1 -0
- package/dist/src/internals/ModalInteraction.d.ts +10 -0
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -0
- package/dist/src/internals/ModalInteraction.js +12 -0
- package/dist/src/internals/ModalInteraction.js.map +1 -0
- package/dist/src/internals/OptionsHandler.d.ts +33 -17
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +52 -58
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +54 -0
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-dev.log +0 -175
- package/.turbo/turbo-docs.log +0 -12
- package/CHANGELOG.md +0 -34
- package/dist/src/abstracts/ButtonInteraction.d.ts +0 -8
- package/dist/src/abstracts/ButtonInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/ButtonInteraction.js +0 -18
- package/dist/src/abstracts/ButtonInteraction.js.map +0 -1
- package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts +0 -7
- package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/ChannelSelectMenuInteraction.js +0 -11
- package/dist/src/abstracts/ChannelSelectMenuInteraction.js.map +0 -1
- package/dist/src/abstracts/CommandHandler.d.ts +0 -6
- package/dist/src/abstracts/CommandHandler.d.ts.map +0 -1
- package/dist/src/abstracts/CommandHandler.js +0 -65
- package/dist/src/abstracts/CommandHandler.js.map +0 -1
- package/dist/src/abstracts/CommandInteraction.d.ts +0 -15
- package/dist/src/abstracts/CommandInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/CommandInteraction.js +0 -60
- package/dist/src/abstracts/CommandInteraction.js.map +0 -1
- package/dist/src/abstracts/ComponentHandler.d.ts +0 -6
- package/dist/src/abstracts/ComponentHandler.d.ts.map +0 -1
- package/dist/src/abstracts/ComponentHandler.js +0 -64
- package/dist/src/abstracts/ComponentHandler.js.map +0 -1
- package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts +0 -8
- package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/MentionableSelectMenuInteraction.js +0 -15
- package/dist/src/abstracts/MentionableSelectMenuInteraction.js.map +0 -1
- package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts +0 -8
- package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/RoleSelectMenuInteraction.js +0 -14
- package/dist/src/abstracts/RoleSelectMenuInteraction.js.map +0 -1
- package/dist/src/abstracts/StringSelectMenuInteraction.d.ts +0 -8
- package/dist/src/abstracts/StringSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/StringSelectMenuInteraction.js +0 -14
- package/dist/src/abstracts/StringSelectMenuInteraction.js.map +0 -1
- package/dist/src/abstracts/UserSelectMenuInteraction.d.ts +0 -8
- package/dist/src/abstracts/UserSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/abstracts/UserSelectMenuInteraction.js +0 -14
- package/dist/src/abstracts/UserSelectMenuInteraction.js.map +0 -1
- package/dist/src/classes/Paginator.d.ts +0 -3
- package/dist/src/classes/Paginator.d.ts.map +0 -1
- package/dist/src/classes/Paginator.js +0 -3
- package/dist/src/classes/Paginator.js.map +0 -1
- package/dist/src/structures/AnySelectMenu.d.ts +0 -31
- package/dist/src/structures/AnySelectMenu.d.ts.map +0 -1
- package/dist/src/structures/AnySelectMenu.js +0 -19
- package/dist/src/structures/AnySelectMenu.js.map +0 -1
- package/dist/src/structures/AnySelectMenuInteraction.d.ts +0 -12
- package/dist/src/structures/AnySelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/AnySelectMenuInteraction.js +0 -21
- package/dist/src/structures/AnySelectMenuInteraction.js.map +0 -1
- package/dist/src/structures/Base.d.ts +0 -10
- package/dist/src/structures/Base.d.ts.map +0 -1
- package/dist/src/structures/Base.js +0 -11
- package/dist/src/structures/Base.js.map +0 -1
- package/dist/src/structures/BaseCommand.d.ts +0 -64
- package/dist/src/structures/BaseCommand.d.ts.map +0 -1
- package/dist/src/structures/BaseCommand.js +0 -58
- package/dist/src/structures/BaseCommand.js.map +0 -1
- package/dist/src/structures/BaseComponent.d.ts +0 -34
- package/dist/src/structures/BaseComponent.d.ts.map +0 -1
- package/dist/src/structures/BaseComponent.js +0 -30
- package/dist/src/structures/BaseComponent.js.map +0 -1
- package/dist/src/structures/BaseComponentInteraction.d.ts +0 -9
- package/dist/src/structures/BaseComponentInteraction.d.ts.map +0 -1
- package/dist/src/structures/BaseComponentInteraction.js +0 -14
- package/dist/src/structures/BaseComponentInteraction.js.map +0 -1
- package/dist/src/structures/BaseInteraction.d.ts +0 -81
- package/dist/src/structures/BaseInteraction.d.ts.map +0 -1
- package/dist/src/structures/BaseInteraction.js +0 -99
- package/dist/src/structures/BaseInteraction.js.map +0 -1
- package/dist/src/structures/ButtonInteraction.d.ts +0 -8
- package/dist/src/structures/ButtonInteraction.d.ts.map +0 -1
- package/dist/src/structures/ButtonInteraction.js +0 -18
- package/dist/src/structures/ButtonInteraction.js.map +0 -1
- package/dist/src/structures/ChannelSelectMenuInteraction.d.ts +0 -7
- package/dist/src/structures/ChannelSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/ChannelSelectMenuInteraction.js +0 -11
- package/dist/src/structures/ChannelSelectMenuInteraction.js.map +0 -1
- package/dist/src/structures/CommandHandler.d.ts +0 -6
- package/dist/src/structures/CommandHandler.d.ts.map +0 -1
- package/dist/src/structures/CommandHandler.js +0 -70
- package/dist/src/structures/CommandHandler.js.map +0 -1
- package/dist/src/structures/CommandInteraction.d.ts +0 -15
- package/dist/src/structures/CommandInteraction.d.ts.map +0 -1
- package/dist/src/structures/CommandInteraction.js +0 -60
- package/dist/src/structures/CommandInteraction.js.map +0 -1
- package/dist/src/structures/ComponentHandler.d.ts +0 -6
- package/dist/src/structures/ComponentHandler.d.ts.map +0 -1
- package/dist/src/structures/ComponentHandler.js +0 -64
- package/dist/src/structures/ComponentHandler.js.map +0 -1
- package/dist/src/structures/MentionableSelectMenuInteraction.d.ts +0 -8
- package/dist/src/structures/MentionableSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/MentionableSelectMenuInteraction.js +0 -15
- package/dist/src/structures/MentionableSelectMenuInteraction.js.map +0 -1
- package/dist/src/structures/RoleSelectMenuInteraction.d.ts +0 -8
- package/dist/src/structures/RoleSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/RoleSelectMenuInteraction.js +0 -14
- package/dist/src/structures/RoleSelectMenuInteraction.js.map +0 -1
- package/dist/src/structures/StringSelectMenuInteraction.d.ts +0 -8
- package/dist/src/structures/StringSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/StringSelectMenuInteraction.js +0 -14
- package/dist/src/structures/StringSelectMenuInteraction.js.map +0 -1
- package/dist/src/structures/UserSelectMenuInteraction.d.ts +0 -8
- package/dist/src/structures/UserSelectMenuInteraction.d.ts.map +0 -1
- package/dist/src/structures/UserSelectMenuInteraction.js +0 -14
- package/dist/src/structures/UserSelectMenuInteraction.js.map +0 -1
- package/dist/src/types.d.ts +0 -31
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -33
- package/dist/src/types.js.map +0 -1
- package/docs/classes/AnySelectMenu.mdx +0 -114
- package/docs/classes/AnySelectMenuInteraction.mdx +0 -175
- package/docs/classes/AutocompleteInteraction.mdx +0 -166
- package/docs/classes/AutocompleteOptionsHandler.mdx +0 -243
- package/docs/classes/BaseChannel.mdx +0 -97
- package/docs/classes/BaseCommand.mdx +0 -61
- package/docs/classes/BaseComponent.mdx +0 -55
- package/docs/classes/BaseComponentInteraction.mdx +0 -160
- package/docs/classes/BaseGuildChannel.mdx +0 -262
- package/docs/classes/BaseGuildTextChannel.mdx +0 -360
- package/docs/classes/BaseInteraction.mdx +0 -137
- package/docs/classes/Button.mdx +0 -99
- package/docs/classes/ButtonInteraction.mdx +0 -155
- package/docs/classes/ChannelSelectMenu.mdx +0 -122
- package/docs/classes/ChannelSelectMenuInteraction.mdx +0 -171
- package/docs/classes/Client.mdx +0 -48
- package/docs/classes/Command.mdx +0 -111
- package/docs/classes/CommandHandler.mdx +0 -65
- package/docs/classes/CommandInteraction.mdx +0 -155
- package/docs/classes/CommandWithSubcommandGroups.mdx +0 -73
- package/docs/classes/CommandWithSubcommands.mdx +0 -76
- package/docs/classes/ComponentHandler.mdx +0 -49
- package/docs/classes/DmChannel.mdx +0 -118
- package/docs/classes/GroupDmChannel.mdx +0 -197
- package/docs/classes/Guild.mdx +0 -157
- package/docs/classes/GuildAnnouncementChannel.mdx +0 -377
- package/docs/classes/GuildCategoryChannel.mdx +0 -272
- package/docs/classes/GuildForumChannel.mdx +0 -333
- package/docs/classes/GuildMediaChannel.mdx +0 -327
- package/docs/classes/GuildStageChannel.mdx +0 -276
- package/docs/classes/GuildStageOrVoiceChannel.mdx +0 -292
- package/docs/classes/GuildTextChannel.mdx +0 -367
- package/docs/classes/GuildThreadChannel.mdx +0 -425
- package/docs/classes/GuildThreadOnlyChannel.mdx +0 -333
- package/docs/classes/GuildVoiceChannel.mdx +0 -276
- package/docs/classes/LinkButton.mdx +0 -84
- package/docs/classes/MentionableSelectMenu.mdx +0 -120
- package/docs/classes/MentionableSelectMenuInteraction.mdx +0 -171
- package/docs/classes/Message.mdx +0 -126
- package/docs/classes/OptionsHandler.mdx +0 -203
- package/docs/classes/PremiumButton.mdx +0 -84
- package/docs/classes/Role.mdx +0 -228
- package/docs/classes/RoleSelectMenu.mdx +0 -120
- package/docs/classes/RoleSelectMenuInteraction.mdx +0 -171
- package/docs/classes/Row.mdx +0 -88
- package/docs/classes/StringSelectMenu.mdx +0 -120
- package/docs/classes/StringSelectMenuInteraction.mdx +0 -171
- package/docs/classes/User.mdx +0 -119
- package/docs/classes/UserSelectMenu.mdx +0 -120
- package/docs/classes/UserSelectMenuInteraction.mdx +0 -171
- package/docs/enumerations/ClientMode.mdx +0 -16
- package/docs/functions/channelFactory.mdx +0 -16
- package/docs/index.mdx +0 -83
- package/docs/type-aliases/AnySelectMenuComponentType.mdx +0 -5
- package/docs/type-aliases/ClientOptions.mdx +0 -20
- package/docs/type-aliases/CommandOptions.mdx +0 -5
- package/docs/type-aliases/ComponentAdditionalData.mdx +0 -9
- package/docs/type-aliases/InteractionFileData.mdx +0 -15
- package/docs/type-aliases/InteractionReplyData.mdx +0 -14
- package/docs/type-aliases/InteractionReplyOptions.mdx +0 -13
- package/docs/type-aliases/RawOptions.mdx +0 -9
- package/docs/type-aliases/meta.json +0 -3
- package/src/README.md +0 -7
- package/src/abstracts/AnySelectMenu.ts +0 -63
- package/src/abstracts/AnySelectMenuInteraction.ts +0 -29
- package/src/abstracts/Base.ts +0 -12
- package/src/abstracts/BaseChannel.ts +0 -73
- package/src/abstracts/BaseCommand.ts +0 -99
- package/src/abstracts/BaseComponent.ts +0 -49
- package/src/abstracts/BaseComponentInteraction.ts +0 -19
- package/src/abstracts/BaseGuildChannel.ts +0 -152
- package/src/abstracts/BaseGuildTextChannel.ts +0 -77
- package/src/abstracts/BaseInteraction.ts +0 -177
- package/src/abstracts/GuildThreadOnlyChannel.ts +0 -71
- package/src/classes/Button.ts +0 -95
- package/src/classes/ChannelSelectMenu.ts +0 -21
- package/src/classes/Client.ts +0 -254
- package/src/classes/Command.ts +0 -53
- package/src/classes/CommandWithSubcommandGroups.ts +0 -47
- package/src/classes/CommandWithSubcommands.ts +0 -35
- package/src/classes/MentionableSelectMenu.ts +0 -19
- package/src/classes/RoleSelectMenu.ts +0 -19
- package/src/classes/Row.ts +0 -44
- package/src/classes/StringSelectMenu.ts +0 -19
- package/src/classes/UserSelectMenu.ts +0 -19
- package/src/factories/channelFactory.ts +0 -43
- package/src/index.ts +0 -59
- package/src/internals/AutocompleteInteraction.ts +0 -107
- package/src/internals/ButtonInteraction.ts +0 -26
- package/src/internals/ChannelSelectMenuInteraction.ts +0 -15
- package/src/internals/CommandHandler.ts +0 -123
- package/src/internals/CommandInteraction.ts +0 -49
- package/src/internals/ComponentHandler.ts +0 -81
- package/src/internals/MentionableSelectMenuInteraction.ts +0 -21
- package/src/internals/OptionsHandler.ts +0 -148
- package/src/internals/RoleSelectMenuInteraction.ts +0 -20
- package/src/internals/StringSelectMenuInteraction.ts +0 -20
- package/src/internals/UserSelectMenuInteraction.ts +0 -20
- package/src/structures/DmChannel.ts +0 -31
- package/src/structures/GroupDmChannel.ts +0 -132
- package/src/structures/Guild.ts +0 -154
- package/src/structures/GuildAnnouncementChannel.ts +0 -20
- package/src/structures/GuildCategoryChannel.ts +0 -16
- package/src/structures/GuildForumChannel.ts +0 -20
- package/src/structures/GuildMediaChannel.ts +0 -13
- package/src/structures/GuildMember.ts +0 -231
- package/src/structures/GuildStageOrVoiceChannel.ts +0 -46
- package/src/structures/GuildTextChannel.ts +0 -21
- package/src/structures/GuildThreadChannel.ts +0 -150
- package/src/structures/Message.ts +0 -124
- package/src/structures/Role.ts +0 -201
- package/src/structures/User.ts +0 -153
- package/src/utils.ts +0 -13
- package/tests/index.test.ts +0 -4
- package/tsconfig.json +0 -12
- package/typedoc.json +0 -9
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIMessageComponentSelectMenuInteraction,
|
|
3
|
-
type APIMessageUserSelectInteractionData,
|
|
4
|
-
ComponentType
|
|
5
|
-
} from "discord-api-types/v10"
|
|
6
|
-
import { AnySelectMenuInteraction } from "../abstracts/AnySelectMenuInteraction.js"
|
|
7
|
-
import type { Client } from "../classes/Client.js"
|
|
8
|
-
|
|
9
|
-
export class UserSelectMenuInteraction extends AnySelectMenuInteraction {
|
|
10
|
-
constructor(client: Client, data: APIMessageComponentSelectMenuInteraction) {
|
|
11
|
-
super(client, data)
|
|
12
|
-
if (data.data.component_type !== ComponentType.UserSelect) {
|
|
13
|
-
throw new Error("Invalid component type was used to create this class")
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get values(): string[] {
|
|
18
|
-
return (this.rawData.data as APIMessageUserSelectInteractionData).values
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIDMChannel,
|
|
3
|
-
type APIMessage,
|
|
4
|
-
ChannelType,
|
|
5
|
-
Routes
|
|
6
|
-
} from "discord-api-types/v10"
|
|
7
|
-
import { BaseChannel } from "../abstracts/BaseChannel.js"
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Represents a DM between two users.
|
|
11
|
-
*/
|
|
12
|
-
export class DmChannel extends BaseChannel<ChannelType.DM> {
|
|
13
|
-
/**
|
|
14
|
-
* The name of the channel. This is always null for DM channels.
|
|
15
|
-
*/
|
|
16
|
-
name?: null = null
|
|
17
|
-
type: ChannelType.DM = ChannelType.DM
|
|
18
|
-
|
|
19
|
-
protected setSpecificData(data: APIDMChannel) {
|
|
20
|
-
this.name = data.name
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Send a message to the channel
|
|
25
|
-
*/
|
|
26
|
-
async send(message: APIMessage) {
|
|
27
|
-
this.client.rest.post(Routes.channelMessages(this.id), {
|
|
28
|
-
body: { ...message }
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIGroupDMChannel,
|
|
3
|
-
ChannelType,
|
|
4
|
-
Routes
|
|
5
|
-
} from "discord-api-types/v10"
|
|
6
|
-
import { BaseChannel } from "../abstracts/BaseChannel.js"
|
|
7
|
-
import { Message } from "./Message.js"
|
|
8
|
-
import { User } from "./User.js"
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents a group DM channel.
|
|
12
|
-
*/
|
|
13
|
-
export class GroupDmChannel extends BaseChannel<ChannelType.GroupDM> {
|
|
14
|
-
/**
|
|
15
|
-
* The name of the channel.
|
|
16
|
-
*/
|
|
17
|
-
name?: string | null
|
|
18
|
-
/**
|
|
19
|
-
* The recipients of the channel.
|
|
20
|
-
*/
|
|
21
|
-
recipients?: User[]
|
|
22
|
-
type: ChannelType.GroupDM = ChannelType.GroupDM
|
|
23
|
-
/**
|
|
24
|
-
* The ID of the application that created the channel, if it was created by a bot.
|
|
25
|
-
*/
|
|
26
|
-
applicationId?: string | null
|
|
27
|
-
/**
|
|
28
|
-
* The icon hash of the channel.
|
|
29
|
-
*/
|
|
30
|
-
icon?: string | null
|
|
31
|
-
/**
|
|
32
|
-
* The ID of the user who created the channel.
|
|
33
|
-
*/
|
|
34
|
-
ownerId?: string | null
|
|
35
|
-
/**
|
|
36
|
-
* The ID of the last message sent in the channel.
|
|
37
|
-
*
|
|
38
|
-
* @remarks
|
|
39
|
-
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
40
|
-
*/
|
|
41
|
-
lastMessageId?: string | null
|
|
42
|
-
/**
|
|
43
|
-
* Whether the channel is managed by an Oauth2 application.
|
|
44
|
-
*/
|
|
45
|
-
managed?: boolean | null
|
|
46
|
-
|
|
47
|
-
protected setSpecificData(data: APIGroupDMChannel) {
|
|
48
|
-
this.name = data.name
|
|
49
|
-
this.recipients = data.recipients?.map((x) => new User(this.client, x))
|
|
50
|
-
this.applicationId = data.application_id
|
|
51
|
-
this.icon = data.icon
|
|
52
|
-
this.ownerId = data.owner_id
|
|
53
|
-
this.lastMessageId = data.last_message_id
|
|
54
|
-
this.managed = data.managed
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Get the URL of the channel's icon.
|
|
59
|
-
*/
|
|
60
|
-
get iconUrl(): string | null {
|
|
61
|
-
return this.icon
|
|
62
|
-
? `https://cdn.discordapp.com/channel-icons/${this.id}/${this.icon}.png`
|
|
63
|
-
: null
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Get the owner of the channel.
|
|
68
|
-
*/
|
|
69
|
-
get owner(): User {
|
|
70
|
-
if (!this.ownerId) throw new Error("Cannot get owner without owner ID")
|
|
71
|
-
return new User(this.client, this.ownerId)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The last message sent in the channel.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
79
|
-
* This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
|
|
80
|
-
*
|
|
81
|
-
*/
|
|
82
|
-
get lastMessage() {
|
|
83
|
-
if (!this.lastMessageId) return null
|
|
84
|
-
return new Message(this.client, {
|
|
85
|
-
id: this.lastMessageId,
|
|
86
|
-
channel_id: this.id
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Set the name of the channel
|
|
92
|
-
* @param name The new name of the channel
|
|
93
|
-
*/
|
|
94
|
-
async setName(name: string) {
|
|
95
|
-
await this.client.rest.patch(Routes.channel(this.id), {
|
|
96
|
-
body: {
|
|
97
|
-
name
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
this.name = name
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async addRecipient(user: User | string) {
|
|
104
|
-
await this.client.rest.put(
|
|
105
|
-
Routes.channelRecipient(
|
|
106
|
-
this.id,
|
|
107
|
-
typeof user === "string" ? user : user.id
|
|
108
|
-
)
|
|
109
|
-
)
|
|
110
|
-
if (this.recipients)
|
|
111
|
-
this.recipients.push(
|
|
112
|
-
typeof user === "string" ? new User(this.client, user) : user
|
|
113
|
-
)
|
|
114
|
-
else
|
|
115
|
-
this.recipients = [
|
|
116
|
-
typeof user === "string" ? new User(this.client, user) : user
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async removeRecipient(user: User | string) {
|
|
121
|
-
await this.client.rest.delete(
|
|
122
|
-
Routes.channelRecipient(
|
|
123
|
-
this.id,
|
|
124
|
-
typeof user === "string" ? user : user.id
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
if (this.recipients)
|
|
128
|
-
this.recipients = this.recipients.filter(
|
|
129
|
-
(x) => x.id !== (typeof user === "string" ? user : user.id)
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
}
|
package/src/structures/Guild.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIChannel,
|
|
3
|
-
type APIGuild,
|
|
4
|
-
type APIGuildMember,
|
|
5
|
-
type APIRole,
|
|
6
|
-
type RESTPostAPIGuildRoleJSONBody,
|
|
7
|
-
Routes
|
|
8
|
-
} from "discord-api-types/v10"
|
|
9
|
-
import { Base } from "../abstracts/Base.js"
|
|
10
|
-
import type { Client } from "../classes/Client.js"
|
|
11
|
-
import { channelFactory } from "../factories/channelFactory.js"
|
|
12
|
-
import { GuildMember } from "./GuildMember.js"
|
|
13
|
-
import { Role } from "./Role.js"
|
|
14
|
-
|
|
15
|
-
export class Guild extends Base {
|
|
16
|
-
/**
|
|
17
|
-
* The ID of the guild
|
|
18
|
-
*/
|
|
19
|
-
id: string
|
|
20
|
-
/**
|
|
21
|
-
* The name of the guild.
|
|
22
|
-
*/
|
|
23
|
-
name?: string
|
|
24
|
-
/**
|
|
25
|
-
* The description of the guild.
|
|
26
|
-
*/
|
|
27
|
-
description?: string | null
|
|
28
|
-
/**
|
|
29
|
-
* The icon hash of the guild.
|
|
30
|
-
* You can use {@link Guild.iconUrl} to get the URL of the icon.
|
|
31
|
-
*/
|
|
32
|
-
icon?: string | null
|
|
33
|
-
/**
|
|
34
|
-
* The splash hash of the guild.
|
|
35
|
-
* You can use {@link Guild.splashUrl} to get the URL of the splash.
|
|
36
|
-
*/
|
|
37
|
-
splash?: string | null
|
|
38
|
-
/**
|
|
39
|
-
* The ID of the owner of the guild.
|
|
40
|
-
*/
|
|
41
|
-
ownerId?: string
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Whether the guild is a partial guild (meaning it does not have all the data).
|
|
45
|
-
* If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
|
|
46
|
-
*/
|
|
47
|
-
partial: boolean
|
|
48
|
-
|
|
49
|
-
private rawData: APIGuild | null = null
|
|
50
|
-
|
|
51
|
-
constructor(client: Client, rawDataOrId: APIGuild | string) {
|
|
52
|
-
super(client)
|
|
53
|
-
if (typeof rawDataOrId === "string") {
|
|
54
|
-
this.id = rawDataOrId
|
|
55
|
-
this.partial = true
|
|
56
|
-
} else {
|
|
57
|
-
this.rawData = rawDataOrId
|
|
58
|
-
this.id = rawDataOrId.id
|
|
59
|
-
this.partial = false
|
|
60
|
-
this.setData(rawDataOrId)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private setData(data: typeof this.rawData) {
|
|
65
|
-
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
66
|
-
this.rawData = data
|
|
67
|
-
this.name = data.name
|
|
68
|
-
this.description = data.description
|
|
69
|
-
this.icon = data.icon
|
|
70
|
-
this.splash = data.splash
|
|
71
|
-
this.ownerId = data.owner_id
|
|
72
|
-
this.partial = false
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Fetch updated data for this guild.
|
|
77
|
-
* If the guild is partial, this will fetch all the data for the guild and populate the fields.
|
|
78
|
-
* If the guild is not partial, all fields will be updated with new values from Discord.
|
|
79
|
-
*/
|
|
80
|
-
async fetch() {
|
|
81
|
-
const newData = (await this.client.rest.get(
|
|
82
|
-
Routes.guild(this.id)
|
|
83
|
-
)) as APIGuild
|
|
84
|
-
if (!newData) throw new Error(`Guild ${this.id}not found`)
|
|
85
|
-
|
|
86
|
-
this.setData(newData)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Leave the guild
|
|
91
|
-
*/
|
|
92
|
-
async leave() {
|
|
93
|
-
return await this.client.rest.delete(Routes.guild(this.id))
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Create a role in the guild
|
|
98
|
-
*/
|
|
99
|
-
async createRole(data: RESTPostAPIGuildRoleJSONBody) {
|
|
100
|
-
const role = (await this.client.rest.post(Routes.guildRoles(this.id), {
|
|
101
|
-
body: {
|
|
102
|
-
...data
|
|
103
|
-
}
|
|
104
|
-
})) as APIRole
|
|
105
|
-
return new Role(this.client, role)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Get a member in the guild by ID
|
|
110
|
-
*/
|
|
111
|
-
async fetchMember(memberId: string) {
|
|
112
|
-
const member = (await this.client.rest.get(
|
|
113
|
-
Routes.guildMember(this.id, memberId)
|
|
114
|
-
)) as APIGuildMember
|
|
115
|
-
return new GuildMember(this.client, member, this)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Get the URL of the guild's icon
|
|
120
|
-
*/
|
|
121
|
-
get iconUrl(): string | null {
|
|
122
|
-
return this.icon
|
|
123
|
-
? `https://cdn.discordapp.com/icons/${this.id}/${this.icon}.png`
|
|
124
|
-
: null
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Get the URL of the guild's splash
|
|
129
|
-
*/
|
|
130
|
-
get splashUrl(): string | null {
|
|
131
|
-
return this.splash
|
|
132
|
-
? `https://cdn.discordapp.com/splashes/${this.id}/${this.splash}.png`
|
|
133
|
-
: null
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Get all roles in the guild
|
|
138
|
-
*/
|
|
139
|
-
get roles() {
|
|
140
|
-
const roles = this.rawData?.roles
|
|
141
|
-
if (!roles) throw new Error("Cannot get roles without having data... smh")
|
|
142
|
-
return roles.map((role) => new Role(this.client, role))
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Fetch a channel from the guild by ID
|
|
147
|
-
*/
|
|
148
|
-
async fetchChannel(channelId: string) {
|
|
149
|
-
const channel = (await this.client.rest.get(
|
|
150
|
-
Routes.channel(channelId)
|
|
151
|
-
)) as APIChannel
|
|
152
|
-
return channelFactory(this.client, channel)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ChannelType, Routes } from "discord-api-types/v10"
|
|
2
|
-
import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
|
|
3
|
-
import type { GuildTextChannel } from "./GuildTextChannel.js"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a guild announcement channel.
|
|
7
|
-
*/
|
|
8
|
-
export class GuildAnnouncementChannel extends BaseGuildTextChannel<ChannelType.GuildAnnouncement> {
|
|
9
|
-
type: ChannelType.GuildAnnouncement = ChannelType.GuildAnnouncement
|
|
10
|
-
protected setMoreSpecificData() {}
|
|
11
|
-
|
|
12
|
-
async follow(targetChannel: GuildTextChannel | string) {
|
|
13
|
-
await this.client.rest.put(Routes.channelFollowers(this.id), {
|
|
14
|
-
body: {
|
|
15
|
-
webhook_channel_id:
|
|
16
|
-
typeof targetChannel === "string" ? targetChannel : targetChannel.id
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ChannelType } from "discord-api-types/v10"
|
|
2
|
-
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents a guild category channel.
|
|
6
|
-
*/
|
|
7
|
-
export class GuildCategoryChannel extends BaseGuildChannel<ChannelType.GuildCategory> {
|
|
8
|
-
protected setSpecificData() {}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* You cannot send a message to a category channel, so this method throws an error
|
|
12
|
-
*/
|
|
13
|
-
override async send(): Promise<void> {
|
|
14
|
-
throw new Error("Category channels cannot be sent to")
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
APIGuildForumChannel,
|
|
3
|
-
ChannelType,
|
|
4
|
-
ForumLayoutType
|
|
5
|
-
} from "discord-api-types/v10"
|
|
6
|
-
import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Represents a guild forum channel.
|
|
10
|
-
*/
|
|
11
|
-
export class GuildForumChannel extends GuildThreadOnlyChannel<ChannelType.GuildForum> {
|
|
12
|
-
/**
|
|
13
|
-
* The default forum layout of the channel.
|
|
14
|
-
*/
|
|
15
|
-
defaultForumLayout?: ForumLayoutType
|
|
16
|
-
|
|
17
|
-
protected setMoreSpecificData(data: APIGuildForumChannel) {
|
|
18
|
-
this.defaultForumLayout = data.default_forum_layout
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ChannelType, ForumLayoutType } from "discord-api-types/v10"
|
|
2
|
-
import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents a guild media channel (a forum channel )
|
|
6
|
-
*/
|
|
7
|
-
export class GuildMediaChannel extends GuildThreadOnlyChannel<ChannelType.GuildMedia> {
|
|
8
|
-
/**
|
|
9
|
-
* The default forum layout of the channel.
|
|
10
|
-
*/
|
|
11
|
-
defaultForumLayout?: ForumLayoutType
|
|
12
|
-
protected setMoreSpecificData() {}
|
|
13
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import type { APIGuildMember, GuildMemberFlags } from "discord-api-types/v10"
|
|
2
|
-
import { Base } from "../abstracts/Base.js"
|
|
3
|
-
import type { Client } from "../classes/Client.js"
|
|
4
|
-
import type { Guild } from "./Guild.js"
|
|
5
|
-
import { Role } from "./Role.js"
|
|
6
|
-
import { User } from "./User.js"
|
|
7
|
-
|
|
8
|
-
export class GuildMember extends Base {
|
|
9
|
-
/**
|
|
10
|
-
* The guild-specific nickname of the member.
|
|
11
|
-
*/
|
|
12
|
-
nickname?: string | null
|
|
13
|
-
/**
|
|
14
|
-
* The guild-specific avatar hash of the member.
|
|
15
|
-
* You can use {@link GuildMember.avatarUrl} to get the URL of the avatar.
|
|
16
|
-
*/
|
|
17
|
-
avatar?: string | null
|
|
18
|
-
/**
|
|
19
|
-
* Is this member muted in Voice Channels?
|
|
20
|
-
*/
|
|
21
|
-
mute?: boolean | null
|
|
22
|
-
/**
|
|
23
|
-
* Is this member deafened in Voice Channels?
|
|
24
|
-
*/
|
|
25
|
-
deaf?: boolean | null
|
|
26
|
-
/**
|
|
27
|
-
* The date since this member boosted the guild, if applicable.
|
|
28
|
-
*/
|
|
29
|
-
premiumSince?: string | null
|
|
30
|
-
/**
|
|
31
|
-
* The flags of the member.
|
|
32
|
-
* @see https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags
|
|
33
|
-
*/
|
|
34
|
-
flags?: GuildMemberFlags | null
|
|
35
|
-
/**
|
|
36
|
-
* The roles of the member
|
|
37
|
-
*/
|
|
38
|
-
roles?: Role[] | null
|
|
39
|
-
/**
|
|
40
|
-
* The joined date of the member
|
|
41
|
-
*/
|
|
42
|
-
joinedAt?: string | null
|
|
43
|
-
/**
|
|
44
|
-
* The date when the member's communication privileges (timeout) will be reinstated
|
|
45
|
-
*/
|
|
46
|
-
communicationDisabledUntil?: string | null
|
|
47
|
-
/**
|
|
48
|
-
* Is this member yet to pass the guild's Membership Screening requirements?
|
|
49
|
-
*/
|
|
50
|
-
pending?: boolean | null
|
|
51
|
-
/**
|
|
52
|
-
* The guild object of the member
|
|
53
|
-
*/
|
|
54
|
-
guild: Guild
|
|
55
|
-
/**
|
|
56
|
-
* The user object of the member
|
|
57
|
-
*/
|
|
58
|
-
user?: User | null
|
|
59
|
-
|
|
60
|
-
private rawData: APIGuildMember | null = null
|
|
61
|
-
|
|
62
|
-
constructor(client: Client, rawData: APIGuildMember, guild: Guild) {
|
|
63
|
-
super(client)
|
|
64
|
-
this.rawData = rawData
|
|
65
|
-
this.guild = guild
|
|
66
|
-
this.setData(rawData)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private setData(data: typeof this.rawData) {
|
|
70
|
-
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
71
|
-
this.rawData = data
|
|
72
|
-
this.nickname = data.nick
|
|
73
|
-
this.avatar = data.avatar
|
|
74
|
-
this.mute = data.mute
|
|
75
|
-
this.deaf = data.deaf
|
|
76
|
-
this.premiumSince = data.premium_since
|
|
77
|
-
this.flags = data.flags
|
|
78
|
-
this.roles = data.roles?.map((roleId) => new Role(this.client, roleId))
|
|
79
|
-
this.joinedAt = data.joined_at
|
|
80
|
-
this.communicationDisabledUntil = data.communication_disabled_until
|
|
81
|
-
this.pending = data.pending
|
|
82
|
-
this.user = data.user ? new User(this.client, data.user) : null
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Set the nickname of the member
|
|
87
|
-
*/
|
|
88
|
-
async setNickname(nickname: string | null): Promise<void> {
|
|
89
|
-
await this.client.rest.patch(
|
|
90
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
91
|
-
{
|
|
92
|
-
body: {
|
|
93
|
-
nick: nickname
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
this.nickname = nickname
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Add a role to the member
|
|
102
|
-
*/
|
|
103
|
-
async addRole(roleId: string): Promise<void> {
|
|
104
|
-
await this.client.rest.put(
|
|
105
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}/roles/${roleId}`,
|
|
106
|
-
{}
|
|
107
|
-
)
|
|
108
|
-
this.roles?.push(new Role(this.client, roleId))
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Remove a role from the member
|
|
113
|
-
*/
|
|
114
|
-
async removeRole(roleId: string): Promise<void> {
|
|
115
|
-
await this.client.rest.delete(
|
|
116
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}/roles/${roleId}`
|
|
117
|
-
)
|
|
118
|
-
this.roles = this.roles?.filter((role) => role.id !== roleId)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Kick the member from the guild
|
|
123
|
-
*/
|
|
124
|
-
async kick(): Promise<void> {
|
|
125
|
-
await this.client.rest.delete(
|
|
126
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Ban the member from the guild
|
|
132
|
-
*/
|
|
133
|
-
async ban(
|
|
134
|
-
options: { reason?: string; deleteMessageDays?: number } = {}
|
|
135
|
-
): Promise<void> {
|
|
136
|
-
await this.client.rest.put(
|
|
137
|
-
`/guilds/${this.guild?.id}/bans/${this.user?.id}`,
|
|
138
|
-
{
|
|
139
|
-
body: {
|
|
140
|
-
reason: options.reason,
|
|
141
|
-
delete_message_days: options.deleteMessageDays
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Mute a member in voice channels
|
|
149
|
-
*/
|
|
150
|
-
async muteMember(): Promise<void> {
|
|
151
|
-
await this.client.rest.patch(
|
|
152
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
153
|
-
{
|
|
154
|
-
body: {
|
|
155
|
-
mute: true
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
this.mute = true
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Unmute a member in voice channels
|
|
164
|
-
*/
|
|
165
|
-
async unmuteMember(): Promise<void> {
|
|
166
|
-
await this.client.rest.patch(
|
|
167
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
168
|
-
{
|
|
169
|
-
body: {
|
|
170
|
-
mute: false
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
this.mute = false
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Deafen a member in voice channels
|
|
179
|
-
*/
|
|
180
|
-
async deafenMember(): Promise<void> {
|
|
181
|
-
await this.client.rest.patch(
|
|
182
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
183
|
-
{
|
|
184
|
-
body: {
|
|
185
|
-
deaf: true
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
)
|
|
189
|
-
this.deaf = true
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Undeafen a member in voice channels
|
|
194
|
-
*/
|
|
195
|
-
async undeafenMember(): Promise<void> {
|
|
196
|
-
await this.client.rest.patch(
|
|
197
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
198
|
-
{
|
|
199
|
-
body: {
|
|
200
|
-
deaf: false
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
)
|
|
204
|
-
this.deaf = false
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Set or remove a timeout for a member in the guild
|
|
209
|
-
*/
|
|
210
|
-
async timeoutMember(communicationDisabledUntil: string): Promise<void> {
|
|
211
|
-
await this.client.rest.patch(
|
|
212
|
-
`/guilds/${this.guild?.id}/members/${this.user?.id}`,
|
|
213
|
-
{
|
|
214
|
-
body: {
|
|
215
|
-
communication_disabled_until: communicationDisabledUntil
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
this.communicationDisabledUntil = communicationDisabledUntil
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Get the URL of the member's guild-specific avatar
|
|
224
|
-
*/
|
|
225
|
-
get avatarUrl(): string | null {
|
|
226
|
-
if (!this.user) return null
|
|
227
|
-
return this.avatar
|
|
228
|
-
? `https://cdn.discordapp.com/guilds/${this.guild.id}/users/${this.user?.id}/${this.avatar}.png`
|
|
229
|
-
: null
|
|
230
|
-
}
|
|
231
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
APIGuildStageVoiceChannel,
|
|
3
|
-
APIGuildVoiceChannel,
|
|
4
|
-
ChannelType,
|
|
5
|
-
VideoQualityMode
|
|
6
|
-
} from "discord-api-types/v10"
|
|
7
|
-
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
8
|
-
|
|
9
|
-
export abstract class GuildStageOrVoiceChannel<
|
|
10
|
-
Type extends ChannelType.GuildStageVoice | ChannelType.GuildVoice
|
|
11
|
-
> extends BaseGuildChannel<Type> {
|
|
12
|
-
/**
|
|
13
|
-
* The bitrate of the channel.
|
|
14
|
-
*/
|
|
15
|
-
bitrate?: number | null
|
|
16
|
-
/**
|
|
17
|
-
* The user limit of the channel.
|
|
18
|
-
*/
|
|
19
|
-
userLimit?: number | null
|
|
20
|
-
/**
|
|
21
|
-
* The RTC region of the channel.
|
|
22
|
-
* This is automatic when set to `null`.
|
|
23
|
-
*/
|
|
24
|
-
rtcRegion?: string | null
|
|
25
|
-
/**
|
|
26
|
-
* The video quality mode of the channel.
|
|
27
|
-
* 1 when not present.
|
|
28
|
-
*/
|
|
29
|
-
videoQualityMode?: VideoQualityMode | null
|
|
30
|
-
|
|
31
|
-
protected setSpecificData(
|
|
32
|
-
data: APIGuildStageVoiceChannel | APIGuildVoiceChannel
|
|
33
|
-
) {
|
|
34
|
-
this.bitrate = data.bitrate
|
|
35
|
-
this.userLimit = data.user_limit
|
|
36
|
-
this.rtcRegion = data.rtc_region
|
|
37
|
-
this.videoQualityMode = data.video_quality_mode
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class GuildStageChannel extends BaseGuildChannel<ChannelType.GuildStageVoice> {
|
|
42
|
-
protected setSpecificData() {}
|
|
43
|
-
}
|
|
44
|
-
export class GuildVoiceChannel extends BaseGuildChannel<ChannelType.GuildVoice> {
|
|
45
|
-
protected setSpecificData() {}
|
|
46
|
-
}
|