disgroove 1.3.3-dev.2 → 1.3.3-dev.3
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,193 +0,0 @@
|
|
1
|
-
import { User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints } from "../rest";
|
4
|
-
import type {
|
5
|
-
JSONGuildMember,
|
6
|
-
JSONGuildMemberAddEventExtraFields,
|
7
|
-
RawGuildMember,
|
8
|
-
RawGuildMemberAddEventExtraFields,
|
9
|
-
} from "../types";
|
10
|
-
import type { GuildMemberFlags } from "../constants";
|
11
|
-
|
12
|
-
/** https://discord.com/developers/docs/resources/guild */
|
13
|
-
export class GuildMember {
|
14
|
-
private client: Client;
|
15
|
-
private raw: RawGuildMember & Partial<RawGuildMemberAddEventExtraFields>;
|
16
|
-
user?: User;
|
17
|
-
nick?: string | null;
|
18
|
-
avatar?: string | null;
|
19
|
-
roles: Array<string>;
|
20
|
-
joinedAt: string;
|
21
|
-
premiumSince?: number | null;
|
22
|
-
deaf: boolean;
|
23
|
-
mute: boolean;
|
24
|
-
flags: GuildMemberFlags;
|
25
|
-
pending?: boolean;
|
26
|
-
permissions?: string;
|
27
|
-
communicationDisabledUntil?: number | null;
|
28
|
-
guildId?: string;
|
29
|
-
|
30
|
-
constructor(
|
31
|
-
data: RawGuildMember & Partial<RawGuildMemberAddEventExtraFields>,
|
32
|
-
client: Client
|
33
|
-
) {
|
34
|
-
this.client = client;
|
35
|
-
this.raw = data;
|
36
|
-
this.roles = data.roles;
|
37
|
-
this.joinedAt = data.joined_at;
|
38
|
-
this.deaf = data.deaf;
|
39
|
-
this.mute = data.mute;
|
40
|
-
this.flags = data.flags;
|
41
|
-
|
42
|
-
this.patch(data);
|
43
|
-
}
|
44
|
-
|
45
|
-
private patch(
|
46
|
-
data: RawGuildMember & Partial<RawGuildMemberAddEventExtraFields>
|
47
|
-
): void {
|
48
|
-
if (data.user !== undefined) this.user = new User(data.user, this.client);
|
49
|
-
if (data.nick !== undefined) this.nick = data.nick;
|
50
|
-
if (data.avatar !== undefined) this.avatar = data.avatar;
|
51
|
-
if (data.premium_since !== undefined)
|
52
|
-
this.premiumSince = data.premium_since;
|
53
|
-
if (data.pending !== undefined) this.pending = data.pending;
|
54
|
-
if (data.permissions !== undefined) this.permissions = data.permissions;
|
55
|
-
if (data.communication_disabled_until !== undefined)
|
56
|
-
this.communicationDisabledUntil = data.communication_disabled_until;
|
57
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
58
|
-
}
|
59
|
-
|
60
|
-
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
61
|
-
addRole(roleId: string, reason?: string): void {
|
62
|
-
if (!this.user?.id)
|
63
|
-
throw new Error("[disgroove] Guild member ID not found");
|
64
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
65
|
-
|
66
|
-
this.client.rest.put(
|
67
|
-
Endpoints.guildMemberRole(this.guildId, this.user.id, roleId),
|
68
|
-
{
|
69
|
-
reason,
|
70
|
-
}
|
71
|
-
);
|
72
|
-
}
|
73
|
-
|
74
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
75
|
-
createBan(
|
76
|
-
options?: {
|
77
|
-
deleteMessageDays?: number;
|
78
|
-
deleteMessageSeconds?: number;
|
79
|
-
},
|
80
|
-
reason?: string
|
81
|
-
): void {
|
82
|
-
if (!this.user?.id)
|
83
|
-
throw new Error("[disgroove] Guild member ID not found");
|
84
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
85
|
-
|
86
|
-
this.client.rest.put(Endpoints.guildBan(this.guildId, this.user.id), {
|
87
|
-
json: {
|
88
|
-
delete_message_days: options?.deleteMessageDays,
|
89
|
-
delete_message_seconds: options?.deleteMessageSeconds,
|
90
|
-
},
|
91
|
-
reason,
|
92
|
-
});
|
93
|
-
}
|
94
|
-
|
95
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
96
|
-
async edit(
|
97
|
-
options: {
|
98
|
-
nick?: string | null;
|
99
|
-
roles?: Array<string> | null;
|
100
|
-
mute?: boolean | null;
|
101
|
-
deaf?: boolean | null;
|
102
|
-
channelId?: string | null;
|
103
|
-
communicationDisabledUntil?: number | null;
|
104
|
-
flags?: GuildMemberFlags;
|
105
|
-
},
|
106
|
-
reason?: string
|
107
|
-
): Promise<GuildMember> {
|
108
|
-
if (!this.user?.id)
|
109
|
-
throw new Error("[disgroove] Guild member ID not found");
|
110
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
111
|
-
|
112
|
-
return new GuildMember(
|
113
|
-
await this.client.rest.patch(
|
114
|
-
Endpoints.guildMember(this.guildId, this.user.id),
|
115
|
-
{
|
116
|
-
json: {
|
117
|
-
nick: options.nick,
|
118
|
-
roles: options.roles,
|
119
|
-
mute: options.mute,
|
120
|
-
deaf: options.deaf,
|
121
|
-
channel_id: options.channelId,
|
122
|
-
communication_disabled_until: options.communicationDisabledUntil,
|
123
|
-
flags: options.flags,
|
124
|
-
},
|
125
|
-
reason,
|
126
|
-
}
|
127
|
-
),
|
128
|
-
this.client
|
129
|
-
);
|
130
|
-
}
|
131
|
-
|
132
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member */
|
133
|
-
remove(reason?: string): void {
|
134
|
-
if (!this.user?.id)
|
135
|
-
throw new Error("[disgroove] Guild member ID not found");
|
136
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
137
|
-
|
138
|
-
this.client.rest.delete(Endpoints.guildMember(this.guildId, this.user.id), {
|
139
|
-
reason,
|
140
|
-
});
|
141
|
-
}
|
142
|
-
|
143
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
144
|
-
removeBan(reason?: string): void {
|
145
|
-
if (!this.user?.id)
|
146
|
-
throw new Error("[disgroove] Guild member ID not found");
|
147
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
148
|
-
|
149
|
-
this.client.rest.delete(Endpoints.guildBan(this.guildId, this.user.id), {
|
150
|
-
reason,
|
151
|
-
});
|
152
|
-
}
|
153
|
-
|
154
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
155
|
-
removeRole(roleId: string, reason?: string): void {
|
156
|
-
if (!this.user?.id)
|
157
|
-
throw new Error("[disgroove] Guild member ID not found");
|
158
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
159
|
-
|
160
|
-
this.client.rest.delete(
|
161
|
-
Endpoints.guildMemberRole(this.guildId, this.user.id, roleId),
|
162
|
-
{
|
163
|
-
reason,
|
164
|
-
}
|
165
|
-
);
|
166
|
-
}
|
167
|
-
|
168
|
-
toString(): string {
|
169
|
-
return `[${this.constructor.name}]`;
|
170
|
-
}
|
171
|
-
|
172
|
-
toRaw(): RawGuildMember & Partial<RawGuildMemberAddEventExtraFields> {
|
173
|
-
return this.raw;
|
174
|
-
}
|
175
|
-
|
176
|
-
toJSON(): JSONGuildMember & Partial<JSONGuildMemberAddEventExtraFields> {
|
177
|
-
return {
|
178
|
-
user: this.user?.toJSON(),
|
179
|
-
nick: this.nick,
|
180
|
-
avatar: this.avatar,
|
181
|
-
roles: this.roles,
|
182
|
-
joinedAt: this.joinedAt,
|
183
|
-
premiumSince: this.premiumSince,
|
184
|
-
deaf: this.deaf,
|
185
|
-
mute: this.mute,
|
186
|
-
flags: this.flags,
|
187
|
-
pending: this.pending,
|
188
|
-
permissions: this.permissions,
|
189
|
-
communicationDisabledUntil: this.communicationDisabledUntil,
|
190
|
-
guildId: this.guildId,
|
191
|
-
};
|
192
|
-
}
|
193
|
-
}
|
@@ -1,164 +0,0 @@
|
|
1
|
-
import { Base, GuildMember, User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints } from "../rest";
|
4
|
-
import type {
|
5
|
-
JSONGuildScheduledEvent,
|
6
|
-
JSONGuildScheduledEventEntityMetadata,
|
7
|
-
JSONGuildScheduledEventUser,
|
8
|
-
RawGuildScheduledEvent,
|
9
|
-
RawGuildScheduledEventUser,
|
10
|
-
} from "../types";
|
11
|
-
import type {
|
12
|
-
GuildScheduledEventEntityTypes,
|
13
|
-
GuildScheduledEventPrivacyLevel,
|
14
|
-
GuildScheduledEventStatus,
|
15
|
-
} from "../constants";
|
16
|
-
|
17
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event */
|
18
|
-
export class GuildScheduledEvent extends Base {
|
19
|
-
protected override raw: RawGuildScheduledEvent;
|
20
|
-
guildId: string;
|
21
|
-
channelId: string | null;
|
22
|
-
creatorId?: string | null;
|
23
|
-
name: string;
|
24
|
-
description?: string | null;
|
25
|
-
scheduledStartTime: string;
|
26
|
-
scheduledEndTime: string | null;
|
27
|
-
privacyLevel: GuildScheduledEventPrivacyLevel;
|
28
|
-
status: GuildScheduledEventStatus;
|
29
|
-
entityType: GuildScheduledEventEntityTypes;
|
30
|
-
entityId?: string;
|
31
|
-
entityMetadata: JSONGuildScheduledEventEntityMetadata | null;
|
32
|
-
creator?: User;
|
33
|
-
userCount?: number;
|
34
|
-
image?: string;
|
35
|
-
|
36
|
-
constructor(data: RawGuildScheduledEvent, client: Client) {
|
37
|
-
super(data.id, client);
|
38
|
-
|
39
|
-
this.raw = data;
|
40
|
-
this.guildId = data.guild_id;
|
41
|
-
this.channelId = data.channel_id;
|
42
|
-
this.name = data.name;
|
43
|
-
this.scheduledStartTime = data.scheduled_start_time;
|
44
|
-
this.scheduledEndTime = data.scheduled_end_time;
|
45
|
-
this.privacyLevel = data.privacy_level;
|
46
|
-
this.status = data.status;
|
47
|
-
this.entityType = data.entity_type;
|
48
|
-
this.entityMetadata = data.entity_metadata;
|
49
|
-
|
50
|
-
this.patch(data);
|
51
|
-
}
|
52
|
-
|
53
|
-
protected override patch(data: RawGuildScheduledEvent): void {
|
54
|
-
if (data.creator_id !== undefined) this.creatorId = data.creator_id;
|
55
|
-
if (data.description !== undefined) this.description = data.description;
|
56
|
-
if (data.entity_id !== undefined) this.entityId = data.entity_id;
|
57
|
-
if (data.creator !== undefined)
|
58
|
-
this.creator = new User(data.creator, this.client);
|
59
|
-
if (data.user_count !== undefined) this.userCount = data.user_count;
|
60
|
-
if (data.image !== undefined) this.image = data.image;
|
61
|
-
}
|
62
|
-
|
63
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
64
|
-
delete(): void {
|
65
|
-
this.client.rest.delete(
|
66
|
-
Endpoints.guildScheduledEvent(this.guildId, this.id)
|
67
|
-
);
|
68
|
-
}
|
69
|
-
|
70
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
71
|
-
async edit(
|
72
|
-
options: {
|
73
|
-
channelId?: string | null;
|
74
|
-
entityMetadata?: JSONGuildScheduledEventEntityMetadata | null;
|
75
|
-
name?: string;
|
76
|
-
privacyLevel?: GuildScheduledEventPrivacyLevel;
|
77
|
-
scheduledStartTime?: string;
|
78
|
-
scheduledEndTime?: string;
|
79
|
-
description?: string | null;
|
80
|
-
entityType?: GuildScheduledEventEntityTypes;
|
81
|
-
status?: GuildScheduledEventStatus;
|
82
|
-
image?: string;
|
83
|
-
},
|
84
|
-
reason?: string
|
85
|
-
): Promise<GuildScheduledEvent> {
|
86
|
-
return new GuildScheduledEvent(
|
87
|
-
await this.client.rest.patch<RawGuildScheduledEvent>(
|
88
|
-
Endpoints.guildScheduledEvent(this.guildId, this.id),
|
89
|
-
{
|
90
|
-
json: {
|
91
|
-
channel_id: options.channelId,
|
92
|
-
entity_metadata: options.entityMetadata,
|
93
|
-
name: options.name,
|
94
|
-
privacy_level: options.privacyLevel,
|
95
|
-
scheduled_start_time: options.scheduledStartTime,
|
96
|
-
scheduled_end_time: options.scheduledEndTime,
|
97
|
-
description: options.description,
|
98
|
-
entityType: options.entityType,
|
99
|
-
status: options.status,
|
100
|
-
image: options.image,
|
101
|
-
},
|
102
|
-
reason,
|
103
|
-
}
|
104
|
-
),
|
105
|
-
this.client
|
106
|
-
);
|
107
|
-
}
|
108
|
-
|
109
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
110
|
-
async getUsers(options?: {
|
111
|
-
limit?: number;
|
112
|
-
withMember?: boolean;
|
113
|
-
before?: string;
|
114
|
-
after?: string;
|
115
|
-
}): Promise<Array<JSONGuildScheduledEventUser>> {
|
116
|
-
return this.client.rest
|
117
|
-
.get<Array<RawGuildScheduledEventUser>>(
|
118
|
-
Endpoints.guildScheduledEvent(this.guildId, this.id),
|
119
|
-
{
|
120
|
-
query: {
|
121
|
-
limit: options?.limit,
|
122
|
-
with_member: options?.withMember,
|
123
|
-
before: options?.before,
|
124
|
-
after: options?.after,
|
125
|
-
},
|
126
|
-
}
|
127
|
-
)
|
128
|
-
.then((response) =>
|
129
|
-
response.map((data) => ({
|
130
|
-
guildScheduledEventId: data.guild_scheduled_event_id,
|
131
|
-
user: new User(data.user, this.client).toJSON(),
|
132
|
-
member:
|
133
|
-
data.member !== undefined
|
134
|
-
? new GuildMember(data.member, this.client).toJSON()
|
135
|
-
: undefined,
|
136
|
-
}))
|
137
|
-
);
|
138
|
-
}
|
139
|
-
|
140
|
-
override toRaw(): RawGuildScheduledEvent {
|
141
|
-
return this.raw;
|
142
|
-
}
|
143
|
-
|
144
|
-
override toJSON(): JSONGuildScheduledEvent {
|
145
|
-
return {
|
146
|
-
...super.toJSON(),
|
147
|
-
guildId: this.guildId,
|
148
|
-
channelId: this.channelId,
|
149
|
-
creatorId: this.creatorId,
|
150
|
-
name: this.name,
|
151
|
-
description: this.description,
|
152
|
-
scheduledStartTime: this.scheduledStartTime,
|
153
|
-
scheduledEndTime: this.scheduledEndTime,
|
154
|
-
privacyLevel: this.privacyLevel,
|
155
|
-
status: this.status,
|
156
|
-
entityType: this.entityType,
|
157
|
-
entityId: this.entityId,
|
158
|
-
entityMetadata: this.entityMetadata,
|
159
|
-
creator: this.creator?.toJSON(),
|
160
|
-
userCount: this.userCount,
|
161
|
-
image: this.image,
|
162
|
-
};
|
163
|
-
}
|
164
|
-
}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import { Guild, User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints } from "../rest";
|
4
|
-
import type { JSONGuildTemplate, RawGuildTemplate } from "../types";
|
5
|
-
|
6
|
-
/** https://discord.com/developers/docs/resources/guild-template */
|
7
|
-
export class GuildTemplate {
|
8
|
-
private client: Client;
|
9
|
-
private raw: RawGuildTemplate;
|
10
|
-
code: string;
|
11
|
-
name: string;
|
12
|
-
description: string | null;
|
13
|
-
usageCount: number;
|
14
|
-
creatorId: string;
|
15
|
-
creator: User;
|
16
|
-
createdAt: string;
|
17
|
-
updatedAt: string;
|
18
|
-
sourceGuildId: string;
|
19
|
-
serializedSourceGuild: Guild;
|
20
|
-
isDirty: boolean | null;
|
21
|
-
|
22
|
-
constructor(data: RawGuildTemplate, client: Client) {
|
23
|
-
this.client = client;
|
24
|
-
this.raw = data;
|
25
|
-
this.code = data.code;
|
26
|
-
this.name = data.name;
|
27
|
-
this.description = data.description;
|
28
|
-
this.usageCount = data.usage_count;
|
29
|
-
this.creatorId = data.creator_id;
|
30
|
-
this.createdAt = data.created_at;
|
31
|
-
this.creator = new User(data.creator, client);
|
32
|
-
this.updatedAt = data.updated_at;
|
33
|
-
this.sourceGuildId = data.source_guild_id;
|
34
|
-
this.serializedSourceGuild = new Guild(
|
35
|
-
data.serialized_source_guild,
|
36
|
-
client
|
37
|
-
);
|
38
|
-
this.isDirty = data.is_dirty;
|
39
|
-
}
|
40
|
-
|
41
|
-
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
42
|
-
async delete(): Promise<JSONGuildTemplate> {
|
43
|
-
return new GuildTemplate(
|
44
|
-
await this.client.rest.delete<RawGuildTemplate>(
|
45
|
-
Endpoints.guildTemplate(this.sourceGuildId, this.code)
|
46
|
-
),
|
47
|
-
this.client
|
48
|
-
).toJSON();
|
49
|
-
}
|
50
|
-
|
51
|
-
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
52
|
-
async edit(options: {
|
53
|
-
name?: string;
|
54
|
-
description?: string | null;
|
55
|
-
}): Promise<GuildTemplate> {
|
56
|
-
return new GuildTemplate(
|
57
|
-
await this.client.rest.patch<RawGuildTemplate>(
|
58
|
-
Endpoints.guildTemplate(this.sourceGuildId, this.code),
|
59
|
-
{
|
60
|
-
json: {
|
61
|
-
name: options.name,
|
62
|
-
description: options.description,
|
63
|
-
},
|
64
|
-
}
|
65
|
-
),
|
66
|
-
this.client
|
67
|
-
);
|
68
|
-
}
|
69
|
-
|
70
|
-
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
71
|
-
async sync(): Promise<GuildTemplate> {
|
72
|
-
return new GuildTemplate(
|
73
|
-
await this.client.rest.put<RawGuildTemplate>(
|
74
|
-
Endpoints.guildTemplate(this.sourceGuildId, this.code)
|
75
|
-
),
|
76
|
-
this.client
|
77
|
-
);
|
78
|
-
}
|
79
|
-
|
80
|
-
toString(): string {
|
81
|
-
return `[${this.constructor.name}]`;
|
82
|
-
}
|
83
|
-
|
84
|
-
toRaw(): RawGuildTemplate {
|
85
|
-
return this.raw;
|
86
|
-
}
|
87
|
-
|
88
|
-
toJSON(): JSONGuildTemplate {
|
89
|
-
return {
|
90
|
-
code: this.code,
|
91
|
-
name: this.name,
|
92
|
-
description: this.description,
|
93
|
-
usageCount: this.usageCount,
|
94
|
-
creatorId: this.creatorId,
|
95
|
-
creator: this.creator.toJSON(),
|
96
|
-
createdAt: this.createdAt,
|
97
|
-
updatedAt: this.updatedAt,
|
98
|
-
sourceGuildId: this.sourceGuildId,
|
99
|
-
serializedSourceGuild: this.serializedSourceGuild.toJSON(),
|
100
|
-
isDirty: this.isDirty,
|
101
|
-
};
|
102
|
-
}
|
103
|
-
}
|
@@ -1,136 +0,0 @@
|
|
1
|
-
import { Base, User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints } from "../rest";
|
4
|
-
import type {
|
5
|
-
JSONIntegration,
|
6
|
-
JSONIntegrationAccount,
|
7
|
-
JSONIntegrationApplication,
|
8
|
-
JSONIntegrationCreateEventExtraFields,
|
9
|
-
JSONIntegrationUpdateEventExtraFields,
|
10
|
-
RawIntegration,
|
11
|
-
RawIntegrationCreateEventExtraFields,
|
12
|
-
RawIntegrationUpdateEventExtraFields,
|
13
|
-
} from "../types";
|
14
|
-
import type { IntegrationExpireBehaviors, OAuth2Scopes } from "../constants";
|
15
|
-
|
16
|
-
/** https://discord.com/developers/docs/resources/guild */
|
17
|
-
export class Integration extends Base {
|
18
|
-
protected override raw: RawIntegration &
|
19
|
-
Partial<
|
20
|
-
| RawIntegrationCreateEventExtraFields
|
21
|
-
| RawIntegrationUpdateEventExtraFields
|
22
|
-
>;
|
23
|
-
name: string;
|
24
|
-
type: string;
|
25
|
-
enabled: boolean;
|
26
|
-
syncing?: boolean;
|
27
|
-
roleId?: string;
|
28
|
-
enableEmoticons?: boolean;
|
29
|
-
expireBehavior?: IntegrationExpireBehaviors;
|
30
|
-
expireGracePeriod?: number;
|
31
|
-
user?: User;
|
32
|
-
account: JSONIntegrationAccount;
|
33
|
-
syncedAt?: string;
|
34
|
-
subscriberCount?: number;
|
35
|
-
revoked?: boolean;
|
36
|
-
application?: JSONIntegrationApplication;
|
37
|
-
scopes?: Array<OAuth2Scopes>;
|
38
|
-
guildId?: string;
|
39
|
-
|
40
|
-
constructor(
|
41
|
-
data: RawIntegration &
|
42
|
-
Partial<
|
43
|
-
| RawIntegrationCreateEventExtraFields
|
44
|
-
| RawIntegrationUpdateEventExtraFields
|
45
|
-
>,
|
46
|
-
client: Client
|
47
|
-
) {
|
48
|
-
super(data.id, client);
|
49
|
-
|
50
|
-
this.raw = data;
|
51
|
-
this.name = data.name;
|
52
|
-
this.type = data.type;
|
53
|
-
this.enabled = data.enabled;
|
54
|
-
this.account = data.account;
|
55
|
-
|
56
|
-
this.patch(data);
|
57
|
-
}
|
58
|
-
|
59
|
-
protected override patch(
|
60
|
-
data: RawIntegration &
|
61
|
-
Partial<
|
62
|
-
| RawIntegrationCreateEventExtraFields
|
63
|
-
| RawIntegrationUpdateEventExtraFields
|
64
|
-
>
|
65
|
-
): void {
|
66
|
-
if (data.syncing !== undefined) this.syncing = data.syncing;
|
67
|
-
if (data.role_id !== undefined) this.roleId = data.role_id;
|
68
|
-
if (data.enable_emoticons !== undefined)
|
69
|
-
this.enableEmoticons = data.enable_emoticons;
|
70
|
-
if (data.expire_behavior !== undefined)
|
71
|
-
this.expireBehavior = data.expire_behavior;
|
72
|
-
if (data.expire_grace_period !== undefined)
|
73
|
-
this.expireGracePeriod = data.expire_grace_period;
|
74
|
-
if (data.user !== undefined) this.user = new User(data.user, this.client);
|
75
|
-
if (data.synced_at !== undefined) this.syncedAt = data.synced_at;
|
76
|
-
if (data.subscriber_count !== undefined)
|
77
|
-
this.subscriberCount = data.subscriber_count;
|
78
|
-
if (data.revoked !== undefined) this.revoked = data.revoked;
|
79
|
-
if (data.application !== undefined)
|
80
|
-
this.application = {
|
81
|
-
id: data.application.id,
|
82
|
-
name: data.application.name,
|
83
|
-
icon: data.application.icon,
|
84
|
-
description: data.application.description,
|
85
|
-
bot:
|
86
|
-
data.application.bot !== undefined
|
87
|
-
? new User(data.application.bot, this.client).toJSON()
|
88
|
-
: undefined,
|
89
|
-
};
|
90
|
-
if (data.scopes !== undefined) this.scopes = data.scopes;
|
91
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
92
|
-
}
|
93
|
-
|
94
|
-
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
95
|
-
delete(reason?: string): void {
|
96
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
97
|
-
|
98
|
-
this.client.rest.delete(Endpoints.guildIntegration(this.guildId, this.id), {
|
99
|
-
reason,
|
100
|
-
});
|
101
|
-
}
|
102
|
-
|
103
|
-
override toRaw(): RawIntegration &
|
104
|
-
Partial<
|
105
|
-
| RawIntegrationCreateEventExtraFields
|
106
|
-
| RawIntegrationUpdateEventExtraFields
|
107
|
-
> {
|
108
|
-
return this.raw;
|
109
|
-
}
|
110
|
-
|
111
|
-
override toJSON(): JSONIntegration &
|
112
|
-
Partial<
|
113
|
-
| JSONIntegrationCreateEventExtraFields
|
114
|
-
| JSONIntegrationUpdateEventExtraFields
|
115
|
-
> {
|
116
|
-
return {
|
117
|
-
...super.toJSON(),
|
118
|
-
name: this.name,
|
119
|
-
type: this.type,
|
120
|
-
enabled: this.enabled,
|
121
|
-
syncing: this.syncing,
|
122
|
-
roleId: this.roleId,
|
123
|
-
enableEmoticons: this.enableEmoticons,
|
124
|
-
expireBehavior: this.expireBehavior,
|
125
|
-
expireGracePeriod: this.expireGracePeriod,
|
126
|
-
user: this.user?.toJSON(),
|
127
|
-
account: this.account,
|
128
|
-
syncedAt: this.syncedAt,
|
129
|
-
subscriberCount: this.subscriberCount,
|
130
|
-
revoked: this.revoked,
|
131
|
-
application: this.application,
|
132
|
-
scopes: this.scopes,
|
133
|
-
guildId: this.guildId,
|
134
|
-
};
|
135
|
-
}
|
136
|
-
}
|