@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,21 +0,0 @@
|
|
|
1
|
-
import { type APIGuildTextChannel, ChannelType } from "discord-api-types/v10"
|
|
2
|
-
import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
|
|
3
|
-
|
|
4
|
-
export class GuildTextChannel extends BaseGuildTextChannel<ChannelType.GuildText> {
|
|
5
|
-
type: ChannelType.GuildText = ChannelType.GuildText
|
|
6
|
-
/**
|
|
7
|
-
* The default auto archive duration of threads in the channel.
|
|
8
|
-
*/
|
|
9
|
-
defaultAutoArchiveDuration?: number | null
|
|
10
|
-
/**
|
|
11
|
-
* The default thread rate limit per user of the channel.
|
|
12
|
-
*/
|
|
13
|
-
defaultThreadRateLimitPerUser?: number | null
|
|
14
|
-
|
|
15
|
-
protected setMoreSpecificData(
|
|
16
|
-
data: APIGuildTextChannel<ChannelType.GuildText>
|
|
17
|
-
) {
|
|
18
|
-
this.defaultAutoArchiveDuration = data.default_auto_archive_duration
|
|
19
|
-
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIThreadChannel,
|
|
3
|
-
Routes,
|
|
4
|
-
type ThreadChannelType
|
|
5
|
-
} from "discord-api-types/v10"
|
|
6
|
-
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
7
|
-
|
|
8
|
-
export class GuildThreadChannel<
|
|
9
|
-
Type extends ThreadChannelType
|
|
10
|
-
> extends BaseGuildChannel<Type> {
|
|
11
|
-
/**
|
|
12
|
-
* Whether the thread is archived.
|
|
13
|
-
*/
|
|
14
|
-
archived?: boolean
|
|
15
|
-
/**
|
|
16
|
-
* The duration until the thread is auto archived.
|
|
17
|
-
*/
|
|
18
|
-
autoArchiveDuration?: number
|
|
19
|
-
/**
|
|
20
|
-
* The timestamp of when the thread was archived.
|
|
21
|
-
*/
|
|
22
|
-
archiveTimestamp?: string
|
|
23
|
-
/**
|
|
24
|
-
* Whether the thread is locked.
|
|
25
|
-
*/
|
|
26
|
-
locked?: boolean
|
|
27
|
-
/**
|
|
28
|
-
* Whether non-moderators can add other non-moderators to a thread; only available on private threads
|
|
29
|
-
*/
|
|
30
|
-
invitable?: boolean
|
|
31
|
-
/**
|
|
32
|
-
* The timestamp of when the thread was created.
|
|
33
|
-
*/
|
|
34
|
-
createTimestamp?: string
|
|
35
|
-
/**
|
|
36
|
-
* The number of messages in the thread.
|
|
37
|
-
*/
|
|
38
|
-
messageCount?: number
|
|
39
|
-
/**
|
|
40
|
-
* The number of members in the thread.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* This is only accurate until 50, after that, Discord stops counting.
|
|
44
|
-
*/
|
|
45
|
-
memberCount?: number
|
|
46
|
-
/**
|
|
47
|
-
* The ID of the owner of the thread.
|
|
48
|
-
*/
|
|
49
|
-
ownerId?: string
|
|
50
|
-
/**
|
|
51
|
-
* The number of messages sent in the thread.
|
|
52
|
-
*/
|
|
53
|
-
totalMessageSent?: number
|
|
54
|
-
/**
|
|
55
|
-
* The tags applied to the thread.
|
|
56
|
-
*/
|
|
57
|
-
appliedTags?: string[]
|
|
58
|
-
|
|
59
|
-
protected setSpecificData(data: APIThreadChannel) {
|
|
60
|
-
this.archived = data.thread_metadata?.archived
|
|
61
|
-
this.autoArchiveDuration = data.thread_metadata?.auto_archive_duration
|
|
62
|
-
this.archiveTimestamp = data.thread_metadata?.archive_timestamp
|
|
63
|
-
this.locked = data.thread_metadata?.locked
|
|
64
|
-
this.invitable = data.thread_metadata?.invitable
|
|
65
|
-
this.createTimestamp = data.thread_metadata?.create_timestamp
|
|
66
|
-
this.messageCount = data.message_count
|
|
67
|
-
this.memberCount = data.member_count
|
|
68
|
-
this.ownerId = data.owner_id
|
|
69
|
-
this.totalMessageSent = data.total_message_sent
|
|
70
|
-
this.appliedTags = data.applied_tags
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Join the thread
|
|
75
|
-
*/
|
|
76
|
-
async join() {
|
|
77
|
-
await this.addMember("@me")
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Add a member to the thread
|
|
82
|
-
*/
|
|
83
|
-
async addMember(userId: string) {
|
|
84
|
-
await this.client.rest.put(Routes.threadMembers(this.id, userId))
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Leave the thread
|
|
89
|
-
*/
|
|
90
|
-
async leave() {
|
|
91
|
-
await this.removeMember("@me")
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Get the pinned messages in the thread
|
|
96
|
-
*/
|
|
97
|
-
async removeMember(userId: string) {
|
|
98
|
-
await this.client.rest.delete(Routes.threadMembers(this.id, userId))
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Archive the thread
|
|
103
|
-
*/
|
|
104
|
-
async archive() {
|
|
105
|
-
await this.client.rest.patch(Routes.channel(this.id), {
|
|
106
|
-
body: { archive: true }
|
|
107
|
-
})
|
|
108
|
-
this.archived = true
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Unarchive the thread
|
|
113
|
-
*/
|
|
114
|
-
async unarchive() {
|
|
115
|
-
await this.client.rest.patch(Routes.channel(this.id), {
|
|
116
|
-
body: { archive: false }
|
|
117
|
-
})
|
|
118
|
-
this.archived = false
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Set the auto archive duration of the thread
|
|
123
|
-
*/
|
|
124
|
-
async setAutoArchiveDuration(duration: number) {
|
|
125
|
-
await this.client.rest.patch(Routes.channel(this.id), {
|
|
126
|
-
body: { auto_archive_duration: duration }
|
|
127
|
-
})
|
|
128
|
-
this.autoArchiveDuration = duration
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Lock the thread
|
|
133
|
-
*/
|
|
134
|
-
async lock() {
|
|
135
|
-
await this.client.rest.put(Routes.channel(this.id), {
|
|
136
|
-
body: { locked: true }
|
|
137
|
-
})
|
|
138
|
-
this.locked = true
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Unlock the thread
|
|
143
|
-
*/
|
|
144
|
-
async unlock() {
|
|
145
|
-
await this.client.rest.put(Routes.channel(this.id), {
|
|
146
|
-
body: { locked: false }
|
|
147
|
-
})
|
|
148
|
-
this.locked = false
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIChannel,
|
|
3
|
-
type APIMessage,
|
|
4
|
-
type APIThreadChannel,
|
|
5
|
-
type RESTPostAPIChannelThreadsJSONBody,
|
|
6
|
-
Routes
|
|
7
|
-
} from "discord-api-types/v10"
|
|
8
|
-
import { Base } from "../abstracts/Base.js"
|
|
9
|
-
import type { Client } from "../classes/Client.js"
|
|
10
|
-
import { channelFactory } from "../factories/channelFactory.js"
|
|
11
|
-
import { GuildThreadChannel } from "./GuildThreadChannel.js"
|
|
12
|
-
import { User } from "./User.js"
|
|
13
|
-
|
|
14
|
-
export class Message extends Base {
|
|
15
|
-
/**
|
|
16
|
-
* The ID of the message
|
|
17
|
-
*/
|
|
18
|
-
id: string
|
|
19
|
-
/**
|
|
20
|
-
* The ID of the channel the message is in
|
|
21
|
-
*/
|
|
22
|
-
channelId: string
|
|
23
|
-
/**
|
|
24
|
-
* Whether the message is a partial message (meaning it does not have all the data).
|
|
25
|
-
* If this is true, you should use {@link Message.fetch} to get the full data of the message.
|
|
26
|
-
*/
|
|
27
|
-
partial: boolean
|
|
28
|
-
|
|
29
|
-
private rawData: APIMessage | null = null
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
client: Client,
|
|
33
|
-
rawDataOrIds:
|
|
34
|
-
| APIMessage
|
|
35
|
-
| {
|
|
36
|
-
id: string
|
|
37
|
-
channel_id: string
|
|
38
|
-
}
|
|
39
|
-
) {
|
|
40
|
-
super(client)
|
|
41
|
-
this.id = rawDataOrIds.id
|
|
42
|
-
this.channelId = rawDataOrIds.channel_id
|
|
43
|
-
if (Object.keys(rawDataOrIds).length === 2) {
|
|
44
|
-
this.partial = true
|
|
45
|
-
} else {
|
|
46
|
-
this.partial = false
|
|
47
|
-
this.setData(rawDataOrIds as APIMessage)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private setData(data: typeof this.rawData) {
|
|
52
|
-
this.rawData = data
|
|
53
|
-
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Fetch updated data for this message.
|
|
58
|
-
* If the message is partial, this will fetch all the data for the message and populate the fields.
|
|
59
|
-
* If the message is not partial, all fields will be updated with new values from Discord.
|
|
60
|
-
*/
|
|
61
|
-
async fetch() {
|
|
62
|
-
const newData = (await this.client.rest.get(
|
|
63
|
-
Routes.channelMessage(this.channelId, this.id)
|
|
64
|
-
)) as APIMessage
|
|
65
|
-
if (!newData) throw new Error(`Message ${this.id} not found`)
|
|
66
|
-
|
|
67
|
-
this.setData(newData)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Delete this message from Discord
|
|
72
|
-
*/
|
|
73
|
-
async delete() {
|
|
74
|
-
return await this.client.rest.delete(
|
|
75
|
-
Routes.channelMessage(this.channelId, this.id)
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get author(): User | null {
|
|
80
|
-
if (this.rawData?.webhook_id) return null // TODO: Add webhook user
|
|
81
|
-
// Check if we have an additional property on the author object, in which case we have a full user object
|
|
82
|
-
if (this.rawData?.author.username)
|
|
83
|
-
return new User(this.client, this.rawData.author)
|
|
84
|
-
// This means we only have a partial user object
|
|
85
|
-
if (this.rawData?.author.id)
|
|
86
|
-
return new User(this.client, this.rawData.author.id)
|
|
87
|
-
return null
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async fetchChannel() {
|
|
91
|
-
const data = (await this.client.rest.get(
|
|
92
|
-
Routes.channel(this.channelId)
|
|
93
|
-
)) as APIChannel
|
|
94
|
-
return channelFactory(this.client, data)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Pin this message
|
|
99
|
-
*/
|
|
100
|
-
async pin() {
|
|
101
|
-
await this.client.rest.put(Routes.channelPin(this.channelId, this.id))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Unpin this message
|
|
106
|
-
*/
|
|
107
|
-
async unpin() {
|
|
108
|
-
await this.client.rest.delete(Routes.channelPin(this.channelId, this.id))
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Start a thread with this message as the associated start message.
|
|
113
|
-
* If you want to start a thread without a start message, use {@link BaseGuildTextChannel.startThread}
|
|
114
|
-
*/
|
|
115
|
-
async startThread(data: RESTPostAPIChannelThreadsJSONBody) {
|
|
116
|
-
const thread = (await this.client.rest.post(
|
|
117
|
-
Routes.threads(this.channelId, this.id),
|
|
118
|
-
{
|
|
119
|
-
body: { ...data }
|
|
120
|
-
}
|
|
121
|
-
)) as APIThreadChannel
|
|
122
|
-
return new GuildThreadChannel(this.client, thread)
|
|
123
|
-
}
|
|
124
|
-
}
|
package/src/structures/Role.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIRole,
|
|
3
|
-
type APIRoleTags,
|
|
4
|
-
type RoleFlags,
|
|
5
|
-
Routes
|
|
6
|
-
} from "discord-api-types/v10"
|
|
7
|
-
import { Base } from "../abstracts/Base.js"
|
|
8
|
-
import type { Client } from "../classes/Client.js"
|
|
9
|
-
|
|
10
|
-
export class Role extends Base {
|
|
11
|
-
/**
|
|
12
|
-
* The ID of the role.
|
|
13
|
-
*/
|
|
14
|
-
id: string
|
|
15
|
-
/**
|
|
16
|
-
* The name of the role.
|
|
17
|
-
*/
|
|
18
|
-
name?: string | null
|
|
19
|
-
/**
|
|
20
|
-
* The color of the role.
|
|
21
|
-
*/
|
|
22
|
-
color?: number | null
|
|
23
|
-
/**
|
|
24
|
-
* The icon hash of the role.
|
|
25
|
-
* You can use {@link Role.iconUrl} to get the URL of the icon.
|
|
26
|
-
*/
|
|
27
|
-
icon?: string | null
|
|
28
|
-
/**
|
|
29
|
-
* If this role is mentionable.
|
|
30
|
-
*/
|
|
31
|
-
mentionable?: boolean | null
|
|
32
|
-
/**
|
|
33
|
-
* If this role is hoisted.
|
|
34
|
-
*/
|
|
35
|
-
hoisted?: boolean | null
|
|
36
|
-
/**
|
|
37
|
-
* The position of the role.
|
|
38
|
-
*/
|
|
39
|
-
position?: number | null
|
|
40
|
-
/**
|
|
41
|
-
* The permissions of the role.
|
|
42
|
-
*/
|
|
43
|
-
permissions?: string | null
|
|
44
|
-
/**
|
|
45
|
-
* If this role is managed by an integration.
|
|
46
|
-
*/
|
|
47
|
-
managed?: boolean | null
|
|
48
|
-
/**
|
|
49
|
-
* The unicode emoji for the role.
|
|
50
|
-
*/
|
|
51
|
-
unicodeEmoji?: string | null
|
|
52
|
-
/**
|
|
53
|
-
* The flags of this role.
|
|
54
|
-
* @see https://discord.com/developers/docs/topics/permissions#role-object-role-flags
|
|
55
|
-
*/
|
|
56
|
-
flags?: RoleFlags | null
|
|
57
|
-
/**
|
|
58
|
-
* The tags of this role.
|
|
59
|
-
* @see https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
|
|
60
|
-
*/
|
|
61
|
-
tags?: APIRoleTags | null
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Whether the role is a partial role (meaning it does not have all the data).
|
|
65
|
-
* If this is true, you should use {@link Role.fetch} to get the full data of the role.
|
|
66
|
-
*/
|
|
67
|
-
partial: boolean
|
|
68
|
-
|
|
69
|
-
private rawData: APIRole | null = null
|
|
70
|
-
|
|
71
|
-
constructor(client: Client, rawDataOrId: APIRole | string) {
|
|
72
|
-
super(client)
|
|
73
|
-
if (typeof rawDataOrId === "string") {
|
|
74
|
-
this.id = rawDataOrId
|
|
75
|
-
this.partial = true
|
|
76
|
-
} else {
|
|
77
|
-
this.rawData = rawDataOrId
|
|
78
|
-
this.id = rawDataOrId.id
|
|
79
|
-
this.partial = false
|
|
80
|
-
this.setData(rawDataOrId)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private setData(data: typeof this.rawData) {
|
|
85
|
-
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
86
|
-
this.rawData = data
|
|
87
|
-
this.name = data.name
|
|
88
|
-
this.color = data.color
|
|
89
|
-
this.icon = data.icon
|
|
90
|
-
this.mentionable = data.mentionable
|
|
91
|
-
this.hoisted = data.hoist
|
|
92
|
-
this.position = data.position
|
|
93
|
-
this.permissions = data.permissions
|
|
94
|
-
this.managed = data.managed
|
|
95
|
-
this.unicodeEmoji = data.unicode_emoji
|
|
96
|
-
this.flags = data.flags
|
|
97
|
-
this.tags = data.tags
|
|
98
|
-
this.partial = false
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Fetch updated data for this role.
|
|
103
|
-
* If the role is partial, this will fetch all the data for the role and populate the fields.
|
|
104
|
-
* If the role is not partial, all fields will be updated with new values from Discord.
|
|
105
|
-
*/
|
|
106
|
-
async fetch(guildId: string) {
|
|
107
|
-
const newData = (await this.client.rest.get(
|
|
108
|
-
Routes.guildRole(guildId, this.id)
|
|
109
|
-
)) as APIRole
|
|
110
|
-
if (!newData) throw new Error(`Role ${this.id} not found`)
|
|
111
|
-
|
|
112
|
-
this.setData(newData)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Set the name of the role
|
|
117
|
-
*/
|
|
118
|
-
async setName(guildId: string, name: string) {
|
|
119
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
120
|
-
body: {
|
|
121
|
-
name
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
this.name = name
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Set the color of the role
|
|
129
|
-
*/
|
|
130
|
-
async setColor(guildId: string, color: number) {
|
|
131
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
132
|
-
body: { color }
|
|
133
|
-
})
|
|
134
|
-
this.color = color
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Set the icon of the role
|
|
139
|
-
* @param icon The unicode emoji or icon URL to set
|
|
140
|
-
*/
|
|
141
|
-
async setIcon(guildId: string, icon: string) {
|
|
142
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
143
|
-
body: { icon }
|
|
144
|
-
})
|
|
145
|
-
this.icon = icon
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Set the mentionable status of the role
|
|
150
|
-
*/
|
|
151
|
-
async setMentionable(guildId: string, mentionable: boolean) {
|
|
152
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
153
|
-
body: { mentionable }
|
|
154
|
-
})
|
|
155
|
-
this.mentionable = mentionable
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Set the hoisted status of the role
|
|
160
|
-
*/
|
|
161
|
-
async setHoisted(guildId: string, hoisted: boolean) {
|
|
162
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
163
|
-
body: { hoist: hoisted }
|
|
164
|
-
})
|
|
165
|
-
this.hoisted = hoisted
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Set the position of the role
|
|
170
|
-
*/
|
|
171
|
-
async setPosition(guildId: string, position: number) {
|
|
172
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
173
|
-
body: { position }
|
|
174
|
-
})
|
|
175
|
-
this.position = position
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Set the permissions of the role
|
|
180
|
-
* @param permissions The permissions to set as a BitField string, until a better permission structure is implemented
|
|
181
|
-
*/
|
|
182
|
-
async setPermissions(guildId: string, permissions: string) {
|
|
183
|
-
await this.client.rest.patch(Routes.guildRole(guildId, this.id), {
|
|
184
|
-
body: { permissions }
|
|
185
|
-
})
|
|
186
|
-
this.permissions = permissions
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
async delete(guildId: string) {
|
|
190
|
-
await this.client.rest.delete(Routes.guildRole(guildId, this.id))
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Get the URL of the role's icon
|
|
195
|
-
*/
|
|
196
|
-
get iconUrl(): string | null {
|
|
197
|
-
return this.icon
|
|
198
|
-
? `https://cdn.discordapp.com/role-icons/${this.id}/${this.icon}.png`
|
|
199
|
-
: null
|
|
200
|
-
}
|
|
201
|
-
}
|
package/src/structures/User.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type APIDMChannel,
|
|
3
|
-
type APIMessage,
|
|
4
|
-
type APIUser,
|
|
5
|
-
type RESTPostAPIChannelMessageJSONBody,
|
|
6
|
-
Routes,
|
|
7
|
-
type UserFlags
|
|
8
|
-
} from "discord-api-types/v10"
|
|
9
|
-
import { Base } from "../abstracts/Base.js"
|
|
10
|
-
import type { Client } from "../classes/Client.js"
|
|
11
|
-
import { Message } from "./Message.js"
|
|
12
|
-
|
|
13
|
-
export class User extends Base {
|
|
14
|
-
/**
|
|
15
|
-
* The ID of the user
|
|
16
|
-
*/
|
|
17
|
-
id: string
|
|
18
|
-
/**
|
|
19
|
-
* The username of the user.
|
|
20
|
-
*/
|
|
21
|
-
username?: string
|
|
22
|
-
/**
|
|
23
|
-
* The global name of the user.
|
|
24
|
-
*/
|
|
25
|
-
globalName?: string | null
|
|
26
|
-
/**
|
|
27
|
-
* The discriminator of the user.
|
|
28
|
-
*/
|
|
29
|
-
discriminator?: string
|
|
30
|
-
/**
|
|
31
|
-
* The avatar hash of the user.
|
|
32
|
-
* You can use {@link User.avatarUrl} to get the URL of the avatar.
|
|
33
|
-
*/
|
|
34
|
-
avatar?: string | null
|
|
35
|
-
/**
|
|
36
|
-
* Is this user a bot?
|
|
37
|
-
*/
|
|
38
|
-
bot?: boolean
|
|
39
|
-
/**
|
|
40
|
-
* Is this user a system user?
|
|
41
|
-
*/
|
|
42
|
-
system?: boolean
|
|
43
|
-
/**
|
|
44
|
-
* The public flags of the user. (Bitfield)
|
|
45
|
-
* @see https://discord.com/developers/docs/resources/user#user-object-user-flags
|
|
46
|
-
*/
|
|
47
|
-
flags?: UserFlags
|
|
48
|
-
/**
|
|
49
|
-
* The banner hash of the user.
|
|
50
|
-
* You can use {@link User.bannerUrl} to get the URL of the banner.
|
|
51
|
-
*/
|
|
52
|
-
banner?: string | null
|
|
53
|
-
/**
|
|
54
|
-
* The accent color of the user.
|
|
55
|
-
*/
|
|
56
|
-
accentColor?: number | null
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Whether the user is a partial user (meaning it does not have all the data).
|
|
60
|
-
* If this is true, you should use {@link User.fetch} to get the full data of the user.
|
|
61
|
-
*/
|
|
62
|
-
partial: boolean
|
|
63
|
-
|
|
64
|
-
private rawData: APIUser | null = null
|
|
65
|
-
|
|
66
|
-
constructor(client: Client, rawDataOrId: APIUser | string) {
|
|
67
|
-
super(client)
|
|
68
|
-
if (typeof rawDataOrId === "string") {
|
|
69
|
-
this.id = rawDataOrId
|
|
70
|
-
this.partial = true
|
|
71
|
-
} else {
|
|
72
|
-
this.rawData = rawDataOrId
|
|
73
|
-
this.id = rawDataOrId.id
|
|
74
|
-
this.partial = false
|
|
75
|
-
this.setData(rawDataOrId)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private setData(data: typeof this.rawData) {
|
|
80
|
-
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
81
|
-
this.rawData = data
|
|
82
|
-
this.username = data.username
|
|
83
|
-
this.globalName = data.global_name
|
|
84
|
-
this.discriminator = data.discriminator
|
|
85
|
-
this.avatar = data.avatar
|
|
86
|
-
this.bot = data.bot
|
|
87
|
-
this.system = data.system
|
|
88
|
-
this.flags = data.public_flags
|
|
89
|
-
this.banner = data.banner
|
|
90
|
-
this.accentColor = data.accent_color
|
|
91
|
-
this.partial = false
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Fetch updated data for this user.
|
|
96
|
-
* If the user is partial, this will fetch all the data for the user and populate the fields.
|
|
97
|
-
* If the user is not partial, all fields will be updated with new values from Discord.
|
|
98
|
-
*/
|
|
99
|
-
async fetch() {
|
|
100
|
-
const newData = (await this.client.rest.get(
|
|
101
|
-
Routes.user(this.id)
|
|
102
|
-
)) as APIUser
|
|
103
|
-
if (!newData) throw new Error(`User ${this.id} not found`)
|
|
104
|
-
|
|
105
|
-
this.setData(newData)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Instantiate a new DM channel with this user.
|
|
110
|
-
*/
|
|
111
|
-
async createDm(userId: string) {
|
|
112
|
-
const dmChannel = (await this.client.rest.post(Routes.userChannels(), {
|
|
113
|
-
body: {
|
|
114
|
-
recipient_id: userId
|
|
115
|
-
}
|
|
116
|
-
})) as APIDMChannel
|
|
117
|
-
return dmChannel
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Send a message to this user.
|
|
122
|
-
*/
|
|
123
|
-
async send(data: RESTPostAPIChannelMessageJSONBody) {
|
|
124
|
-
const dmChannel = await this.createDm(this.id)
|
|
125
|
-
const message = (await this.client.rest.post(
|
|
126
|
-
Routes.channelMessages(dmChannel.id),
|
|
127
|
-
{
|
|
128
|
-
body: {
|
|
129
|
-
...data
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
)) as APIMessage
|
|
133
|
-
return new Message(this.client, message)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Get the URL of the user's avatar
|
|
138
|
-
*/
|
|
139
|
-
get avatarUrl(): string | null {
|
|
140
|
-
return this.avatar
|
|
141
|
-
? `https://cdn.discordapp.com/avatars/${this.id}/${this.avatar}.png`
|
|
142
|
-
: null
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Get the URL of the user's banner
|
|
147
|
-
*/
|
|
148
|
-
get bannerUrl(): string | null {
|
|
149
|
-
return this.banner
|
|
150
|
-
? `https://cdn.discordapp.com/banners/${this.id}/${this.banner}.png`
|
|
151
|
-
: null
|
|
152
|
-
}
|
|
153
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const splitCustomId = (
|
|
2
|
-
customId: string
|
|
3
|
-
): [string, Record<string, string>] => {
|
|
4
|
-
const [id, ...args] = customId.split(":")
|
|
5
|
-
if (!id) throw new Error("Invalid custom ID was provided")
|
|
6
|
-
const data = Object.fromEntries(
|
|
7
|
-
args.map((arg) => {
|
|
8
|
-
const [key, value] = arg.split("=")
|
|
9
|
-
return [key, value]
|
|
10
|
-
})
|
|
11
|
-
)
|
|
12
|
-
return [id, data]
|
|
13
|
-
}
|
package/tests/index.test.ts
DELETED
package/tsconfig.json
DELETED
package/typedoc.json
DELETED