disgroove 1.3.3-dev.2 → 1.3.3-test.1
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 +1 -1
- package/package.json +1 -1
- package/dist/lib/Client.d.ts +0 -234
- package/dist/lib/Client.js +0 -256
- package/dist/lib/Client.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -1084
- package/dist/lib/constants.js +0 -1163
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/gateway/Shard.d.ts +0 -25
- package/dist/lib/gateway/Shard.js +0 -522
- package/dist/lib/gateway/Shard.js.map +0 -1
- package/dist/lib/gateway/ShardsManager.d.ts +0 -5
- package/dist/lib/gateway/ShardsManager.js +0 -13
- package/dist/lib/gateway/ShardsManager.js.map +0 -1
- package/dist/lib/gateway/index.d.ts +0 -2
- package/dist/lib/gateway/index.js +0 -19
- package/dist/lib/gateway/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.js +0 -24
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/rest/CDN.d.ts +0 -21
- package/dist/lib/rest/CDN.js +0 -46
- package/dist/lib/rest/CDN.js.map +0 -1
- package/dist/lib/rest/Endpoints.d.ts +0 -94
- package/dist/lib/rest/Endpoints.js +0 -211
- package/dist/lib/rest/Endpoints.js.map +0 -1
- package/dist/lib/rest/REST.d.ts +0 -22
- package/dist/lib/rest/REST.js +0 -35
- package/dist/lib/rest/REST.js.map +0 -1
- package/dist/lib/rest/RequestsManager.d.ts +0 -17
- package/dist/lib/rest/RequestsManager.js +0 -124
- package/dist/lib/rest/RequestsManager.js.map +0 -1
- package/dist/lib/rest/index.d.ts +0 -4
- package/dist/lib/rest/index.js +0 -34
- package/dist/lib/rest/index.js.map +0 -1
- package/dist/lib/structures/Application.d.ts +0 -174
- package/dist/lib/structures/Application.js +0 -328
- package/dist/lib/structures/Application.js.map +0 -1
- package/dist/lib/structures/ApplicationCommand.d.ts +0 -45
- package/dist/lib/structures/ApplicationCommand.js +0 -127
- package/dist/lib/structures/ApplicationCommand.js.map +0 -1
- package/dist/lib/structures/AuditLog.d.ts +0 -20
- package/dist/lib/structures/AuditLog.js +0 -76
- package/dist/lib/structures/AuditLog.js.map +0 -1
- package/dist/lib/structures/AutoModerationRule.d.ts +0 -34
- package/dist/lib/structures/AutoModerationRule.js +0 -96
- package/dist/lib/structures/AutoModerationRule.js.map +0 -1
- package/dist/lib/structures/Base.d.ts +0 -17
- package/dist/lib/structures/Base.js +0 -31
- package/dist/lib/structures/Base.js.map +0 -1
- package/dist/lib/structures/Channel.d.ts +0 -253
- package/dist/lib/structures/Channel.js +0 -591
- package/dist/lib/structures/Channel.js.map +0 -1
- package/dist/lib/structures/ClientApplication.d.ts +0 -150
- package/dist/lib/structures/ClientApplication.js +0 -241
- package/dist/lib/structures/ClientApplication.js.map +0 -1
- package/dist/lib/structures/Emoji.d.ts +0 -28
- package/dist/lib/structures/Emoji.js +0 -79
- package/dist/lib/structures/Emoji.js.map +0 -1
- package/dist/lib/structures/Entitlement.d.ts +0 -24
- package/dist/lib/structures/Entitlement.js +0 -68
- package/dist/lib/structures/Entitlement.js.map +0 -1
- package/dist/lib/structures/Guild.d.ts +0 -462
- package/dist/lib/structures/Guild.js +0 -1095
- package/dist/lib/structures/Guild.js.map +0 -1
- package/dist/lib/structures/GuildMember.d.ts +0 -50
- package/dist/lib/structures/GuildMember.js +0 -149
- package/dist/lib/structures/GuildMember.js.map +0 -1
- package/dist/lib/structures/GuildScheduledEvent.d.ts +0 -49
- package/dist/lib/structures/GuildScheduledEvent.js +0 -118
- package/dist/lib/structures/GuildScheduledEvent.js.map +0 -1
- package/dist/lib/structures/GuildTemplate.d.ts +0 -32
- package/dist/lib/structures/GuildTemplate.js +0 -76
- package/dist/lib/structures/GuildTemplate.js.map +0 -1
- package/dist/lib/structures/Integration.d.ts +0 -30
- package/dist/lib/structures/Integration.js +0 -102
- package/dist/lib/structures/Integration.js.map +0 -1
- package/dist/lib/structures/Interaction.d.ts +0 -76
- package/dist/lib/structures/Interaction.js +0 -345
- package/dist/lib/structures/Interaction.js.map +0 -1
- package/dist/lib/structures/Invite.d.ts +0 -28
- package/dist/lib/structures/Invite.js +0 -86
- package/dist/lib/structures/Invite.js.map +0 -1
- package/dist/lib/structures/Message.d.ts +0 -84
- package/dist/lib/structures/Message.js +0 -300
- package/dist/lib/structures/Message.js.map +0 -1
- package/dist/lib/structures/Role.d.ts +0 -37
- package/dist/lib/structures/Role.js +0 -90
- package/dist/lib/structures/Role.js.map +0 -1
- package/dist/lib/structures/SKU.d.ts +0 -23
- package/dist/lib/structures/SKU.js +0 -63
- package/dist/lib/structures/SKU.js.map +0 -1
- package/dist/lib/structures/StageInstance.d.ts +0 -24
- package/dist/lib/structures/StageInstance.js +0 -57
- package/dist/lib/structures/StageInstance.js.map +0 -1
- package/dist/lib/structures/Sticker.d.ts +0 -31
- package/dist/lib/structures/Sticker.js +0 -86
- package/dist/lib/structures/Sticker.js.map +0 -1
- package/dist/lib/structures/Team.d.ts +0 -14
- package/dist/lib/structures/Team.js +0 -39
- package/dist/lib/structures/Team.js.map +0 -1
- package/dist/lib/structures/TestEntitlement.d.ts +0 -23
- package/dist/lib/structures/TestEntitlement.js +0 -61
- package/dist/lib/structures/TestEntitlement.js.map +0 -1
- package/dist/lib/structures/UnavailableGuild.d.ts +0 -11
- package/dist/lib/structures/UnavailableGuild.js +0 -25
- package/dist/lib/structures/UnavailableGuild.js.map +0 -1
- package/dist/lib/structures/User.d.ts +0 -63
- package/dist/lib/structures/User.js +0 -177
- package/dist/lib/structures/User.js.map +0 -1
- package/dist/lib/structures/VoiceState.d.ts +0 -26
- package/dist/lib/structures/VoiceState.js +0 -70
- package/dist/lib/structures/VoiceState.js.map +0 -1
- package/dist/lib/structures/Webhook.d.ts +0 -84
- package/dist/lib/structures/Webhook.js +0 -239
- package/dist/lib/structures/Webhook.js.map +0 -1
- package/dist/lib/structures/index.d.ts +0 -27
- package/dist/lib/structures/index.js +0 -44
- package/dist/lib/structures/index.js.map +0 -1
- package/dist/lib/types/application-command.d.ts +0 -102
- package/dist/lib/types/application-command.js +0 -3
- package/dist/lib/types/application-command.js.map +0 -1
- package/dist/lib/types/application-role-connection-metadata.d.ts +0 -18
- package/dist/lib/types/application-role-connection-metadata.js +0 -3
- package/dist/lib/types/application-role-connection-metadata.js.map +0 -1
- package/dist/lib/types/application.d.ts +0 -66
- package/dist/lib/types/application.js +0 -3
- package/dist/lib/types/application.js.map +0 -1
- package/dist/lib/types/audit-log.d.ts +0 -82
- package/dist/lib/types/audit-log.js +0 -3
- package/dist/lib/types/audit-log.js.map +0 -1
- package/dist/lib/types/auto-moderation.d.ts +0 -65
- package/dist/lib/types/auto-moderation.js +0 -3
- package/dist/lib/types/auto-moderation.js.map +0 -1
- package/dist/lib/types/channel.d.ts +0 -456
- package/dist/lib/types/channel.js +0 -3
- package/dist/lib/types/channel.js.map +0 -1
- package/dist/lib/types/emoji.d.ts +0 -22
- package/dist/lib/types/emoji.js +0 -3
- package/dist/lib/types/emoji.js.map +0 -1
- package/dist/lib/types/entitlements.d.ts +0 -32
- package/dist/lib/types/entitlements.js +0 -3
- package/dist/lib/types/entitlements.js.map +0 -1
- package/dist/lib/types/gateway-events.d.ts +0 -805
- package/dist/lib/types/gateway-events.js +0 -3
- package/dist/lib/types/gateway-events.js.map +0 -1
- package/dist/lib/types/guild-scheduled-event.d.ts +0 -57
- package/dist/lib/types/guild-scheduled-event.js +0 -3
- package/dist/lib/types/guild-scheduled-event.js.map +0 -1
- package/dist/lib/types/guild-template.d.ts +0 -28
- package/dist/lib/types/guild-template.js +0 -3
- package/dist/lib/types/guild-template.js.map +0 -1
- package/dist/lib/types/guild.d.ts +0 -333
- package/dist/lib/types/guild.js +0 -3
- package/dist/lib/types/guild.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -23
- package/dist/lib/types/index.js +0 -40
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/interaction.d.ts +0 -170
- package/dist/lib/types/interaction.js +0 -3
- package/dist/lib/types/interaction.js.map +0 -1
- package/dist/lib/types/invite.d.ts +0 -59
- package/dist/lib/types/invite.js +0 -3
- package/dist/lib/types/invite.js.map +0 -1
- package/dist/lib/types/message-components.d.ts +0 -100
- package/dist/lib/types/message-components.js +0 -3
- package/dist/lib/types/message-components.js.map +0 -1
- package/dist/lib/types/role.d.ts +0 -47
- package/dist/lib/types/role.js +0 -3
- package/dist/lib/types/role.js.map +0 -1
- package/dist/lib/types/sku.d.ts +0 -30
- package/dist/lib/types/sku.js +0 -3
- package/dist/lib/types/sku.js.map +0 -1
- package/dist/lib/types/stage-instance.d.ts +0 -20
- package/dist/lib/types/stage-instance.js +0 -3
- package/dist/lib/types/stage-instance.js.map +0 -1
- package/dist/lib/types/sticker.d.ts +0 -61
- package/dist/lib/types/sticker.js +0 -3
- package/dist/lib/types/sticker.js.map +0 -1
- package/dist/lib/types/team.d.ts +0 -30
- package/dist/lib/types/team.js +0 -3
- package/dist/lib/types/team.js.map +0 -1
- package/dist/lib/types/user.d.ts +0 -77
- package/dist/lib/types/user.js +0 -3
- package/dist/lib/types/user.js.map +0 -1
- package/dist/lib/types/voice.d.ts +0 -47
- package/dist/lib/types/voice.js +0 -3
- package/dist/lib/types/voice.js.map +0 -1
- package/dist/lib/types/webhook.d.ts +0 -31
- package/dist/lib/types/webhook.js +0 -3
- package/dist/lib/types/webhook.js.map +0 -1
- package/dist/lib/utils/Util.d.ts +0 -15
- package/dist/lib/utils/Util.js +0 -543
- package/dist/lib/utils/Util.js.map +0 -1
- package/dist/lib/utils/errors.d.ts +0 -12
- package/dist/lib/utils/errors.js +0 -25
- package/dist/lib/utils/errors.js.map +0 -1
- package/dist/lib/utils/index.d.ts +0 -2
- package/dist/lib/utils/index.js +0 -19
- package/dist/lib/utils/index.js.map +0 -1
- package/examples/applicationCommands.js +0 -43
- package/examples/buttons.js +0 -70
- package/examples/embeds.js +0 -36
- package/examples/ephemeralMessages.js +0 -32
- package/examples/files.js +0 -36
- package/examples/modalSubmit.js +0 -62
- package/examples/permissions.js +0 -41
- package/examples/selectMenus.js +0 -160
- package/examples/text.txt +0 -1
- package/lib/Client.ts +0 -616
- package/lib/constants.ts +0 -1173
- package/lib/gateway/Shard.ts +0 -704
- package/lib/gateway/ShardsManager.ts +0 -11
- package/lib/gateway/index.ts +0 -2
- package/lib/index.ts +0 -7
- package/lib/rest/CDN.ts +0 -56
- package/lib/rest/Endpoints.ts +0 -241
- package/lib/rest/REST.ts +0 -45
- package/lib/rest/RequestsManager.ts +0 -134
- package/lib/rest/index.ts +0 -4
- package/lib/structures/Application.ts +0 -599
- package/lib/structures/ApplicationCommand.ts +0 -187
- package/lib/structures/AuditLog.ts +0 -112
- package/lib/structures/AutoModerationRule.ts +0 -127
- package/lib/structures/Base.ts +0 -39
- package/lib/structures/Channel.ts +0 -921
- package/lib/structures/ClientApplication.ts +0 -515
- package/lib/structures/Emoji.ts +0 -95
- package/lib/structures/Entitlement.ts +0 -65
- package/lib/structures/Guild.ts +0 -1842
- package/lib/structures/GuildMember.ts +0 -193
- package/lib/structures/GuildScheduledEvent.ts +0 -164
- package/lib/structures/GuildTemplate.ts +0 -103
- package/lib/structures/Integration.ts +0 -136
- package/lib/structures/Interaction.ts +0 -506
- package/lib/structures/Invite.ts +0 -108
- package/lib/structures/Message.ts +0 -421
- package/lib/structures/Role.ts +0 -116
- package/lib/structures/SKU.ts +0 -63
- package/lib/structures/StageInstance.ts +0 -74
- package/lib/structures/Sticker.ts +0 -100
- package/lib/structures/Team.ts +0 -41
- package/lib/structures/TestEntitlement.ts +0 -78
- package/lib/structures/UnavailableGuild.ts +0 -27
- package/lib/structures/User.ts +0 -233
- package/lib/structures/VoiceState.ts +0 -72
- package/lib/structures/Webhook.ts +0 -341
- package/lib/structures/index.ts +0 -27
- package/lib/types/application-command.ts +0 -118
- package/lib/types/application-role-connection-metadata.ts +0 -23
- package/lib/types/application.ts +0 -77
- package/lib/types/audit-log.ts +0 -105
- package/lib/types/auto-moderation.ts +0 -78
- package/lib/types/channel.ts +0 -534
- package/lib/types/emoji.ts +0 -24
- package/lib/types/entitlements.ts +0 -34
- package/lib/types/gateway-events.ts +0 -970
- package/lib/types/guild-scheduled-event.ts +0 -67
- package/lib/types/guild-template.ts +0 -30
- package/lib/types/guild.ts +0 -388
- package/lib/types/index.ts +0 -23
- package/lib/types/interaction.ts +0 -224
- package/lib/types/invite.ts +0 -78
- package/lib/types/message-components.ts +0 -127
- package/lib/types/role.ts +0 -51
- package/lib/types/sku.ts +0 -32
- package/lib/types/stage-instance.ts +0 -22
- package/lib/types/sticker.ts +0 -67
- package/lib/types/team.ts +0 -34
- package/lib/types/user.ts +0 -93
- package/lib/types/voice.ts +0 -51
- package/lib/types/webhook.ts +0 -40
- package/lib/utils/Util.ts +0 -600
- package/lib/utils/errors.ts +0 -23
- package/lib/utils/index.ts +0 -2
- package/test/basic.js +0 -8
- package/tsconfig.json +0 -107
@@ -1,921 +0,0 @@
|
|
1
|
-
import { Base, GuildMember, Invite, Message, User, Webhook } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints, type File } from "../rest";
|
4
|
-
import type {
|
5
|
-
JSONActionRow,
|
6
|
-
JSONAllowedMentions,
|
7
|
-
JSONAttachment,
|
8
|
-
JSONChannel,
|
9
|
-
JSONDefaultReaction,
|
10
|
-
JSONEmbed,
|
11
|
-
JSONFollowedChannel,
|
12
|
-
JSONForumTag,
|
13
|
-
JSONMessageReference,
|
14
|
-
JSONOverwrite,
|
15
|
-
JSONThreadMember,
|
16
|
-
JSONThreadMetadata,
|
17
|
-
RawChannel,
|
18
|
-
RawFollowedChannel,
|
19
|
-
RawInvite,
|
20
|
-
RawMessage,
|
21
|
-
RawThreadMember,
|
22
|
-
RawUser,
|
23
|
-
RawWebhook,
|
24
|
-
} from "../types";
|
25
|
-
import {
|
26
|
-
type ChannelTypes,
|
27
|
-
type InviteTargetTypes,
|
28
|
-
type MessageFlags,
|
29
|
-
ChannelFlags,
|
30
|
-
VideoQualityModes,
|
31
|
-
SortOrderTypes,
|
32
|
-
ForumLayoutTypes,
|
33
|
-
} from "../constants";
|
34
|
-
|
35
|
-
/** https://discord.com/developers/docs/resources/channel */
|
36
|
-
export class Channel extends Base {
|
37
|
-
protected override raw: RawChannel & {
|
38
|
-
newly_created?: boolean;
|
39
|
-
};
|
40
|
-
type: ChannelTypes;
|
41
|
-
guildId?: string;
|
42
|
-
position?: number;
|
43
|
-
permissionOverwrites?: Array<JSONOverwrite>;
|
44
|
-
name?: string | null;
|
45
|
-
topic?: string | null;
|
46
|
-
nsfw?: boolean;
|
47
|
-
lastMessageId?: string | null;
|
48
|
-
bitrate?: number;
|
49
|
-
userLimit?: number;
|
50
|
-
rateLimitPerUser?: number;
|
51
|
-
recipients?: Array<User>;
|
52
|
-
icon?: string | null;
|
53
|
-
ownerId?: string;
|
54
|
-
applicationId?: string;
|
55
|
-
managed?: boolean;
|
56
|
-
parentId?: string | null;
|
57
|
-
lastPinTimestamp?: string | null;
|
58
|
-
rtcRegion?: string | null;
|
59
|
-
videoQualityMode?: VideoQualityModes;
|
60
|
-
messageCount?: number;
|
61
|
-
memberCount?: number;
|
62
|
-
threadMetadata?: JSONThreadMetadata;
|
63
|
-
member?: JSONThreadMember;
|
64
|
-
defaultAutoArchiveDuration?: number;
|
65
|
-
permissions?: string;
|
66
|
-
flags?: ChannelFlags;
|
67
|
-
totalMessageSent?: number;
|
68
|
-
availableTags?: Array<JSONForumTag>;
|
69
|
-
appliedTags?: Array<string>;
|
70
|
-
defaultReactionEmoji?: JSONDefaultReaction | null;
|
71
|
-
defaultThreadRateLimitPerUser?: number;
|
72
|
-
defaultSortOrder?: SortOrderTypes | null;
|
73
|
-
defaultForumLayout?: ForumLayoutTypes;
|
74
|
-
newlyCreated?: boolean;
|
75
|
-
|
76
|
-
constructor(
|
77
|
-
data: RawChannel & {
|
78
|
-
newly_created?: boolean;
|
79
|
-
},
|
80
|
-
client: Client
|
81
|
-
) {
|
82
|
-
super(data.id, client);
|
83
|
-
|
84
|
-
this.raw = data;
|
85
|
-
this.type = data.type;
|
86
|
-
|
87
|
-
this.patch(data);
|
88
|
-
}
|
89
|
-
|
90
|
-
protected override patch(
|
91
|
-
data: RawChannel & {
|
92
|
-
newly_created?: boolean;
|
93
|
-
}
|
94
|
-
): void {
|
95
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
96
|
-
if (data.position !== undefined) this.position = data.position;
|
97
|
-
if (data.permission_overwrites !== undefined)
|
98
|
-
this.permissionOverwrites = data.permission_overwrites;
|
99
|
-
if (data.name !== undefined) this.name = data.name;
|
100
|
-
if (data.topic !== undefined) this.topic = data.topic;
|
101
|
-
if (data.nsfw !== undefined) this.nsfw = data.nsfw;
|
102
|
-
if (data.last_message_id !== undefined)
|
103
|
-
this.lastMessageId = data.last_message_id;
|
104
|
-
if (data.bitrate !== undefined) this.bitrate = data.bitrate;
|
105
|
-
if (data.user_limit !== undefined) this.userLimit = data.user_limit;
|
106
|
-
if (data.rate_limit_per_user !== undefined)
|
107
|
-
this.rateLimitPerUser = data.rate_limit_per_user;
|
108
|
-
if (data.recipients !== undefined)
|
109
|
-
this.recipients = data.recipients.map(
|
110
|
-
(user) => new User(user, this.client)
|
111
|
-
);
|
112
|
-
if (data.icon !== undefined) this.icon = data.icon;
|
113
|
-
if (data.owner_id !== undefined) this.ownerId = data.owner_id;
|
114
|
-
if (data.application_id !== undefined)
|
115
|
-
this.applicationId = data.application_id;
|
116
|
-
if (data.managed !== undefined) this.managed = data.managed;
|
117
|
-
if (data.parent_id !== undefined) this.parentId = data.parent_id;
|
118
|
-
if (data.last_pin_timestamp !== undefined)
|
119
|
-
this.lastPinTimestamp = data.last_pin_timestamp;
|
120
|
-
if (data.rtc_region !== undefined) this.rtcRegion = data.rtc_region;
|
121
|
-
if (data.video_quality_mode !== undefined)
|
122
|
-
this.videoQualityMode = data.video_quality_mode;
|
123
|
-
if (data.message_count !== undefined)
|
124
|
-
this.messageCount = data.message_count;
|
125
|
-
if (data.member_count !== undefined) this.memberCount = data.member_count;
|
126
|
-
if (data.thread_metadata !== undefined)
|
127
|
-
this.threadMetadata = {
|
128
|
-
archived: data.thread_metadata.archived,
|
129
|
-
autoArchiveDuration: data.thread_metadata.auto_archive_duration,
|
130
|
-
archiveTimestamp: data.thread_metadata.archive_timestamp,
|
131
|
-
locked: data.thread_metadata.locked,
|
132
|
-
invitable: data.thread_metadata.invitable,
|
133
|
-
createTimestamp: data.thread_metadata.create_timestamp,
|
134
|
-
};
|
135
|
-
if (data.member !== undefined)
|
136
|
-
this.member = {
|
137
|
-
id: data.member.id,
|
138
|
-
userId: data.member.user_id,
|
139
|
-
joinTimestamp: data.member.join_timestamp,
|
140
|
-
flags: data.member.flags,
|
141
|
-
member:
|
142
|
-
data.member.member !== undefined
|
143
|
-
? new GuildMember(data.member.member, this.client).toJSON()
|
144
|
-
: undefined,
|
145
|
-
};
|
146
|
-
if (data.default_auto_archive_duration !== undefined)
|
147
|
-
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
148
|
-
if (data.permissions !== undefined) this.permissions = data.permissions;
|
149
|
-
if (data.flags !== undefined) this.flags = data.flags;
|
150
|
-
if (data.total_message_sent !== undefined)
|
151
|
-
this.totalMessageSent = data.total_message_sent;
|
152
|
-
if (data.available_tags !== undefined)
|
153
|
-
this.availableTags = data.available_tags.map((tag) => ({
|
154
|
-
id: tag.id,
|
155
|
-
name: tag.name,
|
156
|
-
moderated: tag.moderated,
|
157
|
-
emojiId: tag.emoji_id,
|
158
|
-
emojiName: tag.emoji_name,
|
159
|
-
}));
|
160
|
-
if (data.applied_tags !== undefined) this.appliedTags = data.applied_tags;
|
161
|
-
if (data.default_reaction_emoji !== undefined)
|
162
|
-
this.defaultReactionEmoji =
|
163
|
-
data.default_reaction_emoji !== null
|
164
|
-
? {
|
165
|
-
emojiId: data.default_reaction_emoji.emoji_id,
|
166
|
-
emojiName: data.default_reaction_emoji.emoji_name,
|
167
|
-
}
|
168
|
-
: null;
|
169
|
-
if (data.default_thread_rate_limit_per_user !== undefined)
|
170
|
-
this.defaultThreadRateLimitPerUser =
|
171
|
-
data.default_thread_rate_limit_per_user;
|
172
|
-
if (data.default_sort_order !== undefined)
|
173
|
-
this.defaultSortOrder = data.default_sort_order;
|
174
|
-
if (data.default_forum_layout !== undefined)
|
175
|
-
this.defaultForumLayout = data.default_forum_layout;
|
176
|
-
if (data.newly_created !== undefined)
|
177
|
-
this.newlyCreated = data.newly_created;
|
178
|
-
}
|
179
|
-
|
180
|
-
/** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient */
|
181
|
-
addRecipient(
|
182
|
-
userId: string,
|
183
|
-
options: {
|
184
|
-
accessToken: string;
|
185
|
-
nick: string;
|
186
|
-
}
|
187
|
-
): void {
|
188
|
-
this.client.rest.put(Endpoints.channelRecipient(this.id, userId), {
|
189
|
-
json: {
|
190
|
-
access_token: options.accessToken,
|
191
|
-
nick: options.nick,
|
192
|
-
},
|
193
|
-
});
|
194
|
-
}
|
195
|
-
|
196
|
-
/** https://discord.com/developers/docs/resources/channel#add-thread-member */
|
197
|
-
addThreadMember(userId: string): void {
|
198
|
-
this.client.rest.put(Endpoints.threadMembers(this.id, userId));
|
199
|
-
}
|
200
|
-
|
201
|
-
/** https://discord.com/developers/docs/resources/channel#bulk-delete-messages */
|
202
|
-
bulkDeleteMessages(
|
203
|
-
options?: {
|
204
|
-
messagesIds?: Array<string>;
|
205
|
-
},
|
206
|
-
reason?: string
|
207
|
-
): void {
|
208
|
-
this.client.rest.post(Endpoints.channelBulkDelete(this.id), {
|
209
|
-
json: {
|
210
|
-
messages: options?.messagesIds,
|
211
|
-
},
|
212
|
-
reason,
|
213
|
-
});
|
214
|
-
}
|
215
|
-
|
216
|
-
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
217
|
-
async createInvite(
|
218
|
-
options: {
|
219
|
-
maxAge?: number;
|
220
|
-
maxUses?: number;
|
221
|
-
temporary?: boolean;
|
222
|
-
unique?: boolean;
|
223
|
-
targetType?: InviteTargetTypes;
|
224
|
-
targetUserId?: string;
|
225
|
-
targetApplicationId?: string;
|
226
|
-
},
|
227
|
-
reason?: string
|
228
|
-
): Promise<Invite> {
|
229
|
-
return new Invite(
|
230
|
-
await this.client.rest.post<RawInvite>(
|
231
|
-
Endpoints.channelInvites(this.id),
|
232
|
-
{
|
233
|
-
json: {
|
234
|
-
max_age: options.maxAge,
|
235
|
-
max_uses: options.maxUses,
|
236
|
-
temporary: options.temporary,
|
237
|
-
unique: options.unique,
|
238
|
-
target_type: options.targetType,
|
239
|
-
target_user_id: options.targetUserId,
|
240
|
-
target_application_id: options.targetApplicationId,
|
241
|
-
},
|
242
|
-
reason,
|
243
|
-
}
|
244
|
-
),
|
245
|
-
this.client
|
246
|
-
);
|
247
|
-
}
|
248
|
-
|
249
|
-
/** https://discord.com/developers/docs/resources/channel#create-message */
|
250
|
-
async createMessage(options: {
|
251
|
-
content?: string;
|
252
|
-
nonce?: string | number;
|
253
|
-
tts?: boolean;
|
254
|
-
embeds?: Array<JSONEmbed>;
|
255
|
-
allowedMentions?: JSONAllowedMentions;
|
256
|
-
messageReference?: JSONMessageReference;
|
257
|
-
components?: Array<JSONActionRow>;
|
258
|
-
stickersIds?: Array<string>;
|
259
|
-
files?: Array<File>;
|
260
|
-
attachments?: Array<JSONAttachment>;
|
261
|
-
flags?: MessageFlags;
|
262
|
-
enforceNonce?: boolean;
|
263
|
-
}): Promise<Message> {
|
264
|
-
return new Message(
|
265
|
-
await this.client.rest.post<RawMessage>(
|
266
|
-
Endpoints.channelMessages(this.id),
|
267
|
-
{
|
268
|
-
json: {
|
269
|
-
content: options.content,
|
270
|
-
nonce: options.nonce,
|
271
|
-
tts: options.tts,
|
272
|
-
embeds:
|
273
|
-
options.embeds !== undefined
|
274
|
-
? this.client.util.embedsToRaw(options.embeds)
|
275
|
-
: undefined,
|
276
|
-
allowed_mentions: {
|
277
|
-
parse: options.allowedMentions?.parse,
|
278
|
-
roles: options.allowedMentions?.roles,
|
279
|
-
users: options.allowedMentions?.users,
|
280
|
-
replied_user: options.allowedMentions?.repliedUser,
|
281
|
-
},
|
282
|
-
message_reference: options.messageReference,
|
283
|
-
components:
|
284
|
-
options.components !== undefined
|
285
|
-
? this.client.util.messageComponentsToRaw(options.components)
|
286
|
-
: undefined,
|
287
|
-
stickers_ids: options.stickersIds,
|
288
|
-
attachments: options.attachments,
|
289
|
-
flags: options.flags,
|
290
|
-
enforce_nonce: options.enforceNonce,
|
291
|
-
},
|
292
|
-
files: options.files,
|
293
|
-
}
|
294
|
-
),
|
295
|
-
this.client
|
296
|
-
);
|
297
|
-
}
|
298
|
-
|
299
|
-
/** https://discord.com/developers/docs/resources/channel#create-reaction */
|
300
|
-
createMessageReaction(messageId: string, emoji: string): void {
|
301
|
-
this.client.rest.put(
|
302
|
-
Endpoints.channelMessageReaction(this.id, messageId, emoji)
|
303
|
-
);
|
304
|
-
}
|
305
|
-
|
306
|
-
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
307
|
-
async createThreadFromMessage(
|
308
|
-
messageId: string,
|
309
|
-
options: {
|
310
|
-
name: string;
|
311
|
-
autoArchiveDuration?: number;
|
312
|
-
rateLimitPerUser?: number | null;
|
313
|
-
},
|
314
|
-
reason?: string
|
315
|
-
): Promise<Channel> {
|
316
|
-
return new Channel(
|
317
|
-
await this.client.rest.post<RawChannel>(
|
318
|
-
Endpoints.threads(this.id, messageId),
|
319
|
-
{
|
320
|
-
json: {
|
321
|
-
name: options.name,
|
322
|
-
auto_archive_duration: options.autoArchiveDuration,
|
323
|
-
rate_limit_per_user: options.rateLimitPerUser,
|
324
|
-
},
|
325
|
-
reason,
|
326
|
-
}
|
327
|
-
),
|
328
|
-
this.client
|
329
|
-
);
|
330
|
-
}
|
331
|
-
|
332
|
-
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel */
|
333
|
-
async createThreadInForumOrMediaChannel(
|
334
|
-
options: {
|
335
|
-
name: string;
|
336
|
-
autoArchiveDuration?: number;
|
337
|
-
rateLimitPerUser?: number | null;
|
338
|
-
message: {
|
339
|
-
content?: string | null;
|
340
|
-
embeds?: Array<JSONEmbed> | null;
|
341
|
-
allowedMentions?: JSONAllowedMentions | null;
|
342
|
-
components?: Array<JSONActionRow> | null;
|
343
|
-
attachments?: Array<JSONAttachment> | null;
|
344
|
-
flags?: MessageFlags | null;
|
345
|
-
};
|
346
|
-
appliedTags?: Array<string>;
|
347
|
-
files?: Array<File> | null;
|
348
|
-
},
|
349
|
-
reason?: string
|
350
|
-
): Promise<Channel> {
|
351
|
-
return new Channel(
|
352
|
-
await this.client.rest.post<RawChannel>(Endpoints.threads(this.id), {
|
353
|
-
json: {
|
354
|
-
name: options.name,
|
355
|
-
auto_archive_duration: options.autoArchiveDuration,
|
356
|
-
rate_limit_per_user: options.rateLimitPerUser,
|
357
|
-
message: {
|
358
|
-
content: options.message.content,
|
359
|
-
embeds: options.message.embeds,
|
360
|
-
flags: options.message.flags,
|
361
|
-
allowed_mentions: {
|
362
|
-
parse: options.message.allowedMentions?.parse,
|
363
|
-
roles: options.message.allowedMentions?.roles,
|
364
|
-
users: options.message.allowedMentions?.users,
|
365
|
-
replied_user: options.message.allowedMentions?.repliedUser,
|
366
|
-
},
|
367
|
-
components:
|
368
|
-
options.message.components !== undefined
|
369
|
-
? options.message.components !== null
|
370
|
-
? this.client.util.messageComponentsToRaw(
|
371
|
-
options.message.components
|
372
|
-
)
|
373
|
-
: null
|
374
|
-
: undefined,
|
375
|
-
attachments: options.message.attachments,
|
376
|
-
},
|
377
|
-
applied_tags: options.appliedTags,
|
378
|
-
},
|
379
|
-
files: options.files,
|
380
|
-
reason,
|
381
|
-
}),
|
382
|
-
this.client
|
383
|
-
);
|
384
|
-
}
|
385
|
-
|
386
|
-
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message */
|
387
|
-
async createThreadWithoutMessage(
|
388
|
-
options: {
|
389
|
-
name: string;
|
390
|
-
autoArchiveDuration?: number;
|
391
|
-
type?: ChannelTypes;
|
392
|
-
invitable?: boolean;
|
393
|
-
rateLimitPerUser?: number | null;
|
394
|
-
},
|
395
|
-
reason?: string
|
396
|
-
): Promise<Channel> {
|
397
|
-
return new Channel(
|
398
|
-
await this.client.rest.post<RawChannel>(Endpoints.threads(this.id), {
|
399
|
-
json: {
|
400
|
-
name: options.name,
|
401
|
-
auto_archive_duration: options.autoArchiveDuration,
|
402
|
-
type: options.type,
|
403
|
-
invitable: options.invitable,
|
404
|
-
rate_limit_per_user: options.rateLimitPerUser,
|
405
|
-
},
|
406
|
-
reason,
|
407
|
-
}),
|
408
|
-
this.client
|
409
|
-
);
|
410
|
-
}
|
411
|
-
|
412
|
-
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
413
|
-
async createWebhook(
|
414
|
-
options: {
|
415
|
-
name: string;
|
416
|
-
avatar?: string | null;
|
417
|
-
},
|
418
|
-
reason?: string
|
419
|
-
): Promise<Webhook> {
|
420
|
-
return new Webhook(
|
421
|
-
await this.client.rest.post<RawWebhook>(
|
422
|
-
Endpoints.channelWebhooks(this.id),
|
423
|
-
{
|
424
|
-
json: {
|
425
|
-
name: options.name,
|
426
|
-
avatar: options.avatar,
|
427
|
-
},
|
428
|
-
reason,
|
429
|
-
}
|
430
|
-
),
|
431
|
-
this.client
|
432
|
-
);
|
433
|
-
}
|
434
|
-
|
435
|
-
/** https://discord.com/developers/docs/resources/channel#crosspost-message */
|
436
|
-
async crosspostMessage(messageId: string): Promise<Message> {
|
437
|
-
return new Message(
|
438
|
-
await this.client.rest.post<RawMessage>(
|
439
|
-
Endpoints.channelMessage(this.id, messageId)
|
440
|
-
),
|
441
|
-
this.client
|
442
|
-
);
|
443
|
-
}
|
444
|
-
|
445
|
-
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
446
|
-
async delete(reason?: string): Promise<JSONChannel> {
|
447
|
-
return new Channel(
|
448
|
-
await this.client.rest.delete<RawChannel>(Endpoints.channel(this.id), {
|
449
|
-
reason,
|
450
|
-
}),
|
451
|
-
this.client
|
452
|
-
).toJSON();
|
453
|
-
}
|
454
|
-
|
455
|
-
/** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
|
456
|
-
deleteAllMessageReactions(messageId: string, emoji?: string): void {
|
457
|
-
this.client.rest.delete(
|
458
|
-
Endpoints.channelMessageAllReactions(this.id, messageId, emoji)
|
459
|
-
);
|
460
|
-
}
|
461
|
-
|
462
|
-
/** https://discord.com/developers/docs/resources/channel#delete-message */
|
463
|
-
deleteMessage(messageId: string, reason?: string): void {
|
464
|
-
this.client.rest.delete(Endpoints.channelMessage(this.id, messageId), {
|
465
|
-
reason,
|
466
|
-
});
|
467
|
-
}
|
468
|
-
|
469
|
-
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
470
|
-
deletePermission(overwriteId: string, reason?: string): void {
|
471
|
-
this.client.rest.delete(Endpoints.channelPermission(this.id, overwriteId), {
|
472
|
-
reason,
|
473
|
-
});
|
474
|
-
}
|
475
|
-
|
476
|
-
/** https://discord.com/developers/docs/resources/channel#delete-user-reaction */
|
477
|
-
deleteMessageReaction(
|
478
|
-
messageId: string,
|
479
|
-
emoji: string,
|
480
|
-
userId?: string
|
481
|
-
): void {
|
482
|
-
this.client.rest.delete(
|
483
|
-
Endpoints.channelMessageReaction(this.id, messageId, emoji, userId)
|
484
|
-
);
|
485
|
-
}
|
486
|
-
|
487
|
-
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
488
|
-
async edit(
|
489
|
-
options: {
|
490
|
-
name?: string | null;
|
491
|
-
type?: ChannelTypes;
|
492
|
-
position?: number;
|
493
|
-
topic?: string | null;
|
494
|
-
nsfw?: boolean;
|
495
|
-
rateLimitPerUser?: number;
|
496
|
-
icon?: string | null;
|
497
|
-
bitrate?: number;
|
498
|
-
userLimit?: number;
|
499
|
-
permissionOverwrites?: Array<JSONOverwrite>;
|
500
|
-
parentId?: string | null;
|
501
|
-
rtcRegion?: string | null;
|
502
|
-
videoQualityMode?: VideoQualityModes;
|
503
|
-
defaultAutoArchiveDuration?: number;
|
504
|
-
flags?: ChannelFlags;
|
505
|
-
availableTags?: Array<JSONForumTag>;
|
506
|
-
defaultReactionEmoji?: JSONDefaultReaction | null;
|
507
|
-
defaultThreadRateLimitPerUser?: number;
|
508
|
-
defaultSortOrder?: SortOrderTypes | null;
|
509
|
-
defaultForumLayout?: ForumLayoutTypes;
|
510
|
-
archived?: boolean;
|
511
|
-
autoArchiveDuration?: number;
|
512
|
-
locked?: boolean;
|
513
|
-
invitable?: boolean;
|
514
|
-
appliedTags?: Array<string>;
|
515
|
-
},
|
516
|
-
reason?: string
|
517
|
-
): Promise<Channel> {
|
518
|
-
return new Channel(
|
519
|
-
await this.client.rest.patch<RawChannel>(Endpoints.channel(this.id), {
|
520
|
-
json: {
|
521
|
-
name: options.name,
|
522
|
-
type: options.type,
|
523
|
-
position: options.position,
|
524
|
-
topic: options.topic,
|
525
|
-
nsfw: options.nsfw,
|
526
|
-
rate_limit_per_user: options.rateLimitPerUser,
|
527
|
-
bitrate: options.bitrate,
|
528
|
-
permission_overwrites: options.permissionOverwrites,
|
529
|
-
parent_id: options.parentId,
|
530
|
-
rtc_region: options.rtcRegion,
|
531
|
-
video_quality_mode: options.videoQualityMode,
|
532
|
-
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
533
|
-
flags: options.flags,
|
534
|
-
available_tags: options.availableTags,
|
535
|
-
default_reaction_emoji: options.defaultReactionEmoji,
|
536
|
-
default_thread_rate_limit_per_user:
|
537
|
-
options.defaultThreadRateLimitPerUser,
|
538
|
-
default_sort_order: options.defaultSortOrder,
|
539
|
-
default_forum_layout: options.defaultForumLayout,
|
540
|
-
archived: options.archived,
|
541
|
-
auto_archive_duration: options.autoArchiveDuration,
|
542
|
-
locked: options.locked,
|
543
|
-
invitable: options.invitable,
|
544
|
-
applied_tags: options.appliedTags,
|
545
|
-
},
|
546
|
-
reason,
|
547
|
-
}),
|
548
|
-
this.client
|
549
|
-
);
|
550
|
-
}
|
551
|
-
|
552
|
-
/** https://discord.com/developers/docs/resources/channel#edit-message */
|
553
|
-
async editMessage(
|
554
|
-
messageId: string,
|
555
|
-
options: {
|
556
|
-
content?: string | null;
|
557
|
-
embeds?: Array<JSONEmbed> | null;
|
558
|
-
flags?: MessageFlags | null;
|
559
|
-
allowedMentions?: JSONAllowedMentions | null;
|
560
|
-
components?: Array<JSONActionRow> | null;
|
561
|
-
files?: Array<File> | null;
|
562
|
-
attachments?: Array<JSONAttachment> | null;
|
563
|
-
}
|
564
|
-
): Promise<Message> {
|
565
|
-
return new Message(
|
566
|
-
await this.client.rest.patch<RawMessage>(
|
567
|
-
Endpoints.channelMessage(this.id, messageId),
|
568
|
-
{
|
569
|
-
json: {
|
570
|
-
content: options.content,
|
571
|
-
embeds:
|
572
|
-
options.embeds !== undefined
|
573
|
-
? options.embeds !== null
|
574
|
-
? this.client.util.embedsToRaw(options.embeds)
|
575
|
-
: null
|
576
|
-
: undefined,
|
577
|
-
allowed_mentions: options.allowedMentions,
|
578
|
-
components:
|
579
|
-
options.components !== undefined
|
580
|
-
? options.components !== null
|
581
|
-
? this.client.util.messageComponentsToRaw(options.components)
|
582
|
-
: null
|
583
|
-
: undefined,
|
584
|
-
attachments: options.attachments,
|
585
|
-
flags: options.flags,
|
586
|
-
},
|
587
|
-
files: options.files,
|
588
|
-
}
|
589
|
-
),
|
590
|
-
this.client
|
591
|
-
);
|
592
|
-
}
|
593
|
-
|
594
|
-
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
|
595
|
-
editPermissions(
|
596
|
-
overwriteId: string,
|
597
|
-
options: {
|
598
|
-
allow?: string | null;
|
599
|
-
deny?: string | null;
|
600
|
-
type: number;
|
601
|
-
},
|
602
|
-
reason?: string
|
603
|
-
): void {
|
604
|
-
this.client.rest.put(Endpoints.channelPermission(this.id, overwriteId), {
|
605
|
-
json: options,
|
606
|
-
reason,
|
607
|
-
});
|
608
|
-
}
|
609
|
-
|
610
|
-
/** https://discord.com/developers/docs/resources/channel#follow-announcement-channel */
|
611
|
-
async follow(options: {
|
612
|
-
webhookChannelId: string;
|
613
|
-
}): Promise<JSONFollowedChannel> {
|
614
|
-
return this.client.rest
|
615
|
-
.post<RawFollowedChannel>(Endpoints.channelFollowers(this.id), {
|
616
|
-
json: {
|
617
|
-
webhook_channel_id: options.webhookChannelId,
|
618
|
-
},
|
619
|
-
})
|
620
|
-
.then((response) => ({
|
621
|
-
channelId: response.channel_id,
|
622
|
-
webhookId: response.webhook_id,
|
623
|
-
}));
|
624
|
-
}
|
625
|
-
|
626
|
-
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
|
627
|
-
async getArchivedThreads(
|
628
|
-
archivedStatus: "public" | "private",
|
629
|
-
options?: {
|
630
|
-
before?: string;
|
631
|
-
limit?: number;
|
632
|
-
}
|
633
|
-
): Promise<{
|
634
|
-
threads: Array<Channel>;
|
635
|
-
members: Array<JSONThreadMember>;
|
636
|
-
hasMore: boolean;
|
637
|
-
}> {
|
638
|
-
return this.client.rest
|
639
|
-
.get<{
|
640
|
-
threads: Array<RawChannel>;
|
641
|
-
members: Array<RawThreadMember>;
|
642
|
-
has_more: boolean;
|
643
|
-
}>(Endpoints.channelThreads(this.id, archivedStatus, false), {
|
644
|
-
query: {
|
645
|
-
before: options?.before,
|
646
|
-
limit: options?.limit,
|
647
|
-
},
|
648
|
-
})
|
649
|
-
.then((response) => ({
|
650
|
-
threads: response.threads.map((data) => new Channel(data, this.client)),
|
651
|
-
members: response.members.map((data) => ({
|
652
|
-
id: data.id,
|
653
|
-
userId: data.user_id,
|
654
|
-
joinTimestamp: data.join_timestamp,
|
655
|
-
flags: data.flags,
|
656
|
-
member:
|
657
|
-
data.member !== undefined
|
658
|
-
? new GuildMember(data.member, this.client)
|
659
|
-
: undefined,
|
660
|
-
})),
|
661
|
-
hasMore: response.has_more,
|
662
|
-
}));
|
663
|
-
}
|
664
|
-
|
665
|
-
/** https://discord.com/developers/docs/resources/channel#get-channel-invites */
|
666
|
-
async getInvites(): Promise<Array<Invite>> {
|
667
|
-
return this.client.rest
|
668
|
-
.get<Array<RawInvite>>(Endpoints.channelInvites(this.id))
|
669
|
-
.then((response) =>
|
670
|
-
response.map((data) => new Invite(data, this.client))
|
671
|
-
);
|
672
|
-
}
|
673
|
-
|
674
|
-
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
675
|
-
async getJoinedPrivateArchivedThreads(options?: {
|
676
|
-
before?: string;
|
677
|
-
limit?: number;
|
678
|
-
}): Promise<{
|
679
|
-
threads: Array<Channel>;
|
680
|
-
members: Array<JSONThreadMember>;
|
681
|
-
hasMore: boolean;
|
682
|
-
}> {
|
683
|
-
return this.client.rest
|
684
|
-
.get<{
|
685
|
-
threads: Array<RawChannel>;
|
686
|
-
members: Array<RawThreadMember>;
|
687
|
-
has_more: boolean;
|
688
|
-
}>(Endpoints.channelThreads(this.id, "private", true), {
|
689
|
-
query: {
|
690
|
-
before: options?.before,
|
691
|
-
limit: options?.limit,
|
692
|
-
},
|
693
|
-
})
|
694
|
-
.then((response) => ({
|
695
|
-
threads: response.threads.map((data) => new Channel(data, this.client)),
|
696
|
-
members: response.members.map((data) => ({
|
697
|
-
id: data.id,
|
698
|
-
userId: data.user_id,
|
699
|
-
joinTimestamp: data.join_timestamp,
|
700
|
-
flags: data.flags,
|
701
|
-
member:
|
702
|
-
data.member !== undefined
|
703
|
-
? new GuildMember(data.member, this.client)
|
704
|
-
: undefined,
|
705
|
-
})),
|
706
|
-
hasMore: response.has_more,
|
707
|
-
}));
|
708
|
-
}
|
709
|
-
|
710
|
-
/** https://discord.com/developers/docs/resources/channel#get-channel-message */
|
711
|
-
async getMessage(messageId: string): Promise<Message> {
|
712
|
-
return new Message(
|
713
|
-
await this.client.rest.get<RawMessage>(
|
714
|
-
Endpoints.channelMessage(this.id, messageId)
|
715
|
-
),
|
716
|
-
this.client
|
717
|
-
);
|
718
|
-
}
|
719
|
-
|
720
|
-
/** https://discord.com/developers/docs/resources/channel#get-channel-messages */
|
721
|
-
async getMessages(options: {
|
722
|
-
around?: string;
|
723
|
-
before?: string;
|
724
|
-
after?: string;
|
725
|
-
limit?: number;
|
726
|
-
}): Promise<Array<Message>> {
|
727
|
-
return this.client.rest
|
728
|
-
.get<Array<RawMessage>>(Endpoints.channelMessages(this.id), {
|
729
|
-
query: {
|
730
|
-
around: options.around,
|
731
|
-
before: options.before,
|
732
|
-
after: options.after,
|
733
|
-
limit: options.limit,
|
734
|
-
},
|
735
|
-
})
|
736
|
-
.then((response) =>
|
737
|
-
response.map((data) => new Message(data, this.client))
|
738
|
-
);
|
739
|
-
}
|
740
|
-
|
741
|
-
/** https://discord.com/developers/docs/resources/channel#get-pinned-messages */
|
742
|
-
async getPinnedMessages(): Promise<Array<Message>> {
|
743
|
-
return this.client.rest
|
744
|
-
.get<Array<RawMessage>>(Endpoints.channelPins(this.id))
|
745
|
-
.then((response) =>
|
746
|
-
response.map((data) => new Message(data, this.client))
|
747
|
-
);
|
748
|
-
}
|
749
|
-
|
750
|
-
/** https://discord.com/developers/docs/resources/channel#get-reactions */
|
751
|
-
async getMessageReactions(
|
752
|
-
messageId: string,
|
753
|
-
emoji: string,
|
754
|
-
options?: {
|
755
|
-
after?: string;
|
756
|
-
limit?: number;
|
757
|
-
}
|
758
|
-
): Promise<Array<User>> {
|
759
|
-
return this.client.rest
|
760
|
-
.get<Array<RawUser>>(
|
761
|
-
Endpoints.channelMessageAllReactions(this.id, messageId, emoji),
|
762
|
-
{
|
763
|
-
query: {
|
764
|
-
after: options?.after,
|
765
|
-
limit: options?.limit,
|
766
|
-
},
|
767
|
-
}
|
768
|
-
)
|
769
|
-
.then((response) => response.map((data) => new User(data, this.client)));
|
770
|
-
}
|
771
|
-
|
772
|
-
/** https://discord.com/developers/docs/resources/channel#get-thread-member */
|
773
|
-
async getThreadMember(
|
774
|
-
userId: string,
|
775
|
-
options?: {
|
776
|
-
withMember?: boolean;
|
777
|
-
}
|
778
|
-
): Promise<JSONThreadMember> {
|
779
|
-
return this.client.rest
|
780
|
-
.get<RawThreadMember>(Endpoints.threadMembers(this.id, userId), {
|
781
|
-
query: {
|
782
|
-
with_member: options?.withMember,
|
783
|
-
},
|
784
|
-
})
|
785
|
-
.then((response) => ({
|
786
|
-
id: response.id,
|
787
|
-
userId: response.user_id,
|
788
|
-
joinTimestamp: response.join_timestamp,
|
789
|
-
flags: response.flags,
|
790
|
-
member:
|
791
|
-
response.member !== undefined
|
792
|
-
? new GuildMember(response.member, this.client)
|
793
|
-
: undefined,
|
794
|
-
}));
|
795
|
-
}
|
796
|
-
|
797
|
-
/** https://discord.com/developers/docs/resources/channel#list-thread-members */
|
798
|
-
async getThreadMembers(options?: {
|
799
|
-
withMember?: boolean;
|
800
|
-
after?: string;
|
801
|
-
limit?: number;
|
802
|
-
}): Promise<Array<JSONThreadMember>> {
|
803
|
-
return this.client.rest
|
804
|
-
.get<Array<RawThreadMember>>(Endpoints.threadMembers(this.id), {
|
805
|
-
query: {
|
806
|
-
with_member: options?.withMember,
|
807
|
-
after: options?.after,
|
808
|
-
limit: options?.limit,
|
809
|
-
},
|
810
|
-
})
|
811
|
-
.then((response) =>
|
812
|
-
response.map((data) => ({
|
813
|
-
id: data.id,
|
814
|
-
userId: data.user_id,
|
815
|
-
joinTimestamp: data.join_timestamp,
|
816
|
-
flags: data.flags,
|
817
|
-
member:
|
818
|
-
data.member !== undefined
|
819
|
-
? new GuildMember(data.member, this.client).toJSON()
|
820
|
-
: undefined,
|
821
|
-
}))
|
822
|
-
);
|
823
|
-
}
|
824
|
-
|
825
|
-
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
826
|
-
async getWebhooks(): Promise<Array<Webhook>> {
|
827
|
-
return this.client.rest
|
828
|
-
.get<Array<RawWebhook>>(Endpoints.channelWebhooks(this.id))
|
829
|
-
.then((response) =>
|
830
|
-
response.map((data) => new Webhook(data, this.client))
|
831
|
-
);
|
832
|
-
}
|
833
|
-
|
834
|
-
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
835
|
-
join(): void {
|
836
|
-
this.client.rest.put(Endpoints.threadMembers(this.id, "@me"));
|
837
|
-
}
|
838
|
-
|
839
|
-
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
840
|
-
leave(): void {
|
841
|
-
this.client.rest.delete(Endpoints.threadMembers(this.id, "@me"));
|
842
|
-
}
|
843
|
-
|
844
|
-
/** https://discord.com/developers/docs/resources/channel#pin-message */
|
845
|
-
pinMessage(messageId: string, reason?: string): void {
|
846
|
-
this.client.rest.put(Endpoints.channelPin(this.id, messageId), {
|
847
|
-
reason,
|
848
|
-
});
|
849
|
-
}
|
850
|
-
|
851
|
-
/** https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient */
|
852
|
-
removeRecipient(userId: string): void {
|
853
|
-
this.client.rest.delete(Endpoints.channelRecipient(this.id, userId));
|
854
|
-
}
|
855
|
-
|
856
|
-
/** https://discord.com/developers/docs/resources/channel#remove-thread-member */
|
857
|
-
removeThreadMember(userId: string): void {
|
858
|
-
this.client.rest.delete(Endpoints.threadMembers(this.id, userId));
|
859
|
-
}
|
860
|
-
|
861
|
-
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
862
|
-
triggerTypingIndicator(): void {
|
863
|
-
this.client.rest.post(Endpoints.channelTyping(this.id));
|
864
|
-
}
|
865
|
-
|
866
|
-
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
867
|
-
unpinMessage(messageId: string, reason?: string): void {
|
868
|
-
this.client.rest.delete(Endpoints.channelPin(this.id, messageId), {
|
869
|
-
reason,
|
870
|
-
});
|
871
|
-
}
|
872
|
-
|
873
|
-
override toRaw(): RawChannel & {
|
874
|
-
newly_created?: boolean;
|
875
|
-
} {
|
876
|
-
return this.raw;
|
877
|
-
}
|
878
|
-
|
879
|
-
override toJSON(): JSONChannel & {
|
880
|
-
newlyCreated?: boolean;
|
881
|
-
} {
|
882
|
-
return {
|
883
|
-
...super.toJSON(),
|
884
|
-
type: this.type,
|
885
|
-
guildId: this.guildId,
|
886
|
-
position: this.position,
|
887
|
-
permissionOverwrites: this.permissionOverwrites,
|
888
|
-
name: this.name,
|
889
|
-
topic: this.topic,
|
890
|
-
nsfw: this.nsfw,
|
891
|
-
lastMessageId: this.lastMessageId,
|
892
|
-
bitrate: this.bitrate,
|
893
|
-
userLimit: this.userLimit,
|
894
|
-
rateLimitPerUser: this.rateLimitPerUser,
|
895
|
-
recipients: this.recipients,
|
896
|
-
icon: this.icon,
|
897
|
-
ownerId: this.ownerId,
|
898
|
-
applicationId: this.applicationId,
|
899
|
-
managed: this.managed,
|
900
|
-
parentId: this.parentId,
|
901
|
-
lastPinTimestamp: this.lastPinTimestamp,
|
902
|
-
rtcRegion: this.rtcRegion,
|
903
|
-
videoQualityMode: this.videoQualityMode,
|
904
|
-
messageCount: this.messageCount,
|
905
|
-
memberCount: this.memberCount,
|
906
|
-
threadMetadata: this.threadMetadata,
|
907
|
-
member: this.member,
|
908
|
-
defaultAutoArchiveDuration: this.defaultAutoArchiveDuration,
|
909
|
-
permissions: this.permissions,
|
910
|
-
flags: this.flags,
|
911
|
-
totalMessageSent: this.totalMessageSent,
|
912
|
-
availableTags: this.availableTags,
|
913
|
-
appliedTags: this.appliedTags,
|
914
|
-
defaultReactionEmoji: this.defaultReactionEmoji,
|
915
|
-
defaultThreadRateLimitPerUser: this.defaultThreadRateLimitPerUser,
|
916
|
-
defaultSortOrder: this.defaultSortOrder,
|
917
|
-
defaultForumLayout: this.defaultForumLayout,
|
918
|
-
newlyCreated: this.newlyCreated,
|
919
|
-
};
|
920
|
-
}
|
921
|
-
}
|