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,100 +0,0 @@
|
|
1
|
-
import { Base, User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import type { StickerFormatTypes, StickerTypes } from "../constants";
|
4
|
-
import { Endpoints } from "../rest";
|
5
|
-
import type { JSONSticker, RawSticker } from "../types";
|
6
|
-
|
7
|
-
/** https://discord.com/developers/docs/resources/sticker */
|
8
|
-
export class Sticker extends Base {
|
9
|
-
protected override raw: RawSticker;
|
10
|
-
packId?: string;
|
11
|
-
name: string;
|
12
|
-
description: string | null;
|
13
|
-
tags: string;
|
14
|
-
asset?: string;
|
15
|
-
type: StickerTypes;
|
16
|
-
formatType: StickerFormatTypes;
|
17
|
-
available?: boolean;
|
18
|
-
guildId?: string;
|
19
|
-
user?: User;
|
20
|
-
sortValue?: number;
|
21
|
-
|
22
|
-
constructor(data: RawSticker, client: Client) {
|
23
|
-
super(data.id, client);
|
24
|
-
|
25
|
-
this.raw = data;
|
26
|
-
this.name = data.name;
|
27
|
-
this.description = data.description;
|
28
|
-
this.tags = data.tags;
|
29
|
-
this.type = data.type;
|
30
|
-
this.formatType = data.format_type;
|
31
|
-
|
32
|
-
this.patch(data);
|
33
|
-
}
|
34
|
-
|
35
|
-
protected override patch(data: RawSticker) {
|
36
|
-
if (data.pack_id !== undefined) this.packId = data.pack_id;
|
37
|
-
if (data.asset != undefined) this.asset = data.asset;
|
38
|
-
if (data.available !== undefined) this.available = data.available;
|
39
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
40
|
-
if (data.user !== undefined) this.user = new User(data.user, this.client);
|
41
|
-
if (data.sort_value !== undefined) this.sortValue = data.sort_value;
|
42
|
-
}
|
43
|
-
|
44
|
-
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
45
|
-
delete(reason?: string): void {
|
46
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
47
|
-
|
48
|
-
this.client.rest.delete(Endpoints.guildSticker(this.guildId, this.id), {
|
49
|
-
reason,
|
50
|
-
});
|
51
|
-
}
|
52
|
-
|
53
|
-
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
54
|
-
async edit(
|
55
|
-
options: {
|
56
|
-
name?: string;
|
57
|
-
description?: string | null;
|
58
|
-
tags?: string;
|
59
|
-
},
|
60
|
-
reason?: string
|
61
|
-
): Promise<Sticker> {
|
62
|
-
if (!this.guildId) throw new Error("[disgroove] Guild ID not found");
|
63
|
-
|
64
|
-
return new Sticker(
|
65
|
-
await this.client.rest.patch<RawSticker>(
|
66
|
-
Endpoints.guildSticker(this.guildId, this.id),
|
67
|
-
{
|
68
|
-
json: {
|
69
|
-
name: options.name,
|
70
|
-
description: options.description,
|
71
|
-
tags: options.tags,
|
72
|
-
},
|
73
|
-
reason,
|
74
|
-
}
|
75
|
-
),
|
76
|
-
this.client
|
77
|
-
);
|
78
|
-
}
|
79
|
-
|
80
|
-
override toRaw(): RawSticker {
|
81
|
-
return this.raw;
|
82
|
-
}
|
83
|
-
|
84
|
-
override toJSON(): JSONSticker {
|
85
|
-
return {
|
86
|
-
...super.toJSON(),
|
87
|
-
packId: this.packId,
|
88
|
-
name: this.name,
|
89
|
-
description: this.description,
|
90
|
-
tags: this.tags,
|
91
|
-
asset: this.asset,
|
92
|
-
type: this.type,
|
93
|
-
formatType: this.formatType,
|
94
|
-
available: this.available,
|
95
|
-
guildId: this.guildId,
|
96
|
-
user: this.user?.toJSON(),
|
97
|
-
sortValue: this.sortValue,
|
98
|
-
};
|
99
|
-
}
|
100
|
-
}
|
package/lib/structures/Team.ts
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
import { Base, User } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import type { JSONTeam, JSONTeamMember, RawTeam } from "../types";
|
4
|
-
|
5
|
-
/** https://discord.com/developers/docs/topics/teams */
|
6
|
-
export class Team extends Base {
|
7
|
-
protected override raw: RawTeam;
|
8
|
-
icon: string | null;
|
9
|
-
members: Array<JSONTeamMember>;
|
10
|
-
name: string;
|
11
|
-
ownerUserId: string;
|
12
|
-
|
13
|
-
constructor(data: RawTeam, client: Client) {
|
14
|
-
super(data.id, client);
|
15
|
-
|
16
|
-
this.raw = data;
|
17
|
-
this.icon = data.icon;
|
18
|
-
this.members = data.members.map((teamMember) => ({
|
19
|
-
membershipState: teamMember.membership_state,
|
20
|
-
teamId: teamMember.team_id,
|
21
|
-
user: new User(teamMember.user, client).toJSON(),
|
22
|
-
role: teamMember.role,
|
23
|
-
}));
|
24
|
-
this.name = data.name;
|
25
|
-
this.ownerUserId = data.owner_user_id;
|
26
|
-
}
|
27
|
-
|
28
|
-
override toRaw(): RawTeam {
|
29
|
-
return this.raw;
|
30
|
-
}
|
31
|
-
|
32
|
-
override toJSON(): JSONTeam {
|
33
|
-
return {
|
34
|
-
icon: this.icon,
|
35
|
-
...super.toJSON(),
|
36
|
-
members: this.members,
|
37
|
-
name: this.name,
|
38
|
-
ownerUserId: this.ownerUserId,
|
39
|
-
};
|
40
|
-
}
|
41
|
-
}
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import type { Client } from "../Client";
|
2
|
-
import { Endpoints } from "../rest";
|
3
|
-
import type { JSONEntitlement, RawEntitlement } from "../types";
|
4
|
-
import { Base } from ".";
|
5
|
-
import type { EntitlementTypes } from "../constants";
|
6
|
-
|
7
|
-
/** https://discord.com/developers/docs/monetization/entitlements */
|
8
|
-
export class TestEntitlement extends Base {
|
9
|
-
protected override raw: Omit<
|
10
|
-
RawEntitlement,
|
11
|
-
"starts_at" | "ends_at" | "subscription_id"
|
12
|
-
>;
|
13
|
-
skuId: string;
|
14
|
-
applicationId: string;
|
15
|
-
userId?: string;
|
16
|
-
promotionId?: string | null; // Undocumented
|
17
|
-
type: EntitlementTypes;
|
18
|
-
deleted: boolean;
|
19
|
-
giftCodeFlags?: number; // Undocumented
|
20
|
-
consumed?: boolean; // Undocumented
|
21
|
-
guildId?: string;
|
22
|
-
|
23
|
-
constructor(
|
24
|
-
data: Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">,
|
25
|
-
client: Client
|
26
|
-
) {
|
27
|
-
super(data.id, client);
|
28
|
-
|
29
|
-
this.raw = data;
|
30
|
-
this.skuId = data.sku_id;
|
31
|
-
this.applicationId = data.application_id;
|
32
|
-
this.type = data.type;
|
33
|
-
this.deleted = data.deleted;
|
34
|
-
}
|
35
|
-
|
36
|
-
protected override patch(
|
37
|
-
data: Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">
|
38
|
-
): void {
|
39
|
-
if (data.user_id !== undefined) this.userId = data.user_id;
|
40
|
-
if (data.promotion_id !== undefined) this.promotionId = data.promotion_id;
|
41
|
-
if (data.gift_code_flags !== undefined)
|
42
|
-
this.giftCodeFlags = data.gift_code_flags;
|
43
|
-
if (data.consumed !== undefined) this.consumed = data.consumed;
|
44
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
45
|
-
}
|
46
|
-
|
47
|
-
/** https://discord.com/developers/docs/monetization/entitlements */
|
48
|
-
delete(): void {
|
49
|
-
this.client.rest.delete(
|
50
|
-
Endpoints.applicationEntitlement(this.applicationId, this.id)
|
51
|
-
);
|
52
|
-
}
|
53
|
-
|
54
|
-
override toRaw(): Omit<
|
55
|
-
RawEntitlement,
|
56
|
-
"starts_at" | "ends_at" | "subscription_id"
|
57
|
-
> {
|
58
|
-
return this.raw;
|
59
|
-
}
|
60
|
-
|
61
|
-
override toJSON(): Omit<
|
62
|
-
JSONEntitlement,
|
63
|
-
"startsAt" | "endsAt" | "subscriptionId"
|
64
|
-
> {
|
65
|
-
return {
|
66
|
-
id: this.id,
|
67
|
-
skuId: this.skuId,
|
68
|
-
applicationId: this.applicationId,
|
69
|
-
userId: this.userId,
|
70
|
-
promotionId: this.promotionId,
|
71
|
-
type: this.type,
|
72
|
-
deleted: this.deleted,
|
73
|
-
giftCodeFlags: this.giftCodeFlags,
|
74
|
-
consumed: this.consumed,
|
75
|
-
guildId: this.guildId,
|
76
|
-
};
|
77
|
-
}
|
78
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { Base } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import type { RawUnavailableGuild, JSONUnavailableGuild } from "../types";
|
4
|
-
|
5
|
-
/** https://discord.com/developers/docs/resources/guild */
|
6
|
-
export class UnavailableGuild extends Base {
|
7
|
-
protected override raw: RawUnavailableGuild;
|
8
|
-
unavailable: boolean;
|
9
|
-
|
10
|
-
constructor(data: RawUnavailableGuild, client: Client) {
|
11
|
-
super(data.id, client);
|
12
|
-
|
13
|
-
this.raw = data;
|
14
|
-
this.unavailable = data.unavailable;
|
15
|
-
}
|
16
|
-
|
17
|
-
override toRaw(): RawUnavailableGuild {
|
18
|
-
return this.raw;
|
19
|
-
}
|
20
|
-
|
21
|
-
override toJSON(): JSONUnavailableGuild {
|
22
|
-
return {
|
23
|
-
...super.toJSON(),
|
24
|
-
unavailable: this.unavailable,
|
25
|
-
};
|
26
|
-
}
|
27
|
-
}
|
package/lib/structures/User.ts
DELETED
@@ -1,233 +0,0 @@
|
|
1
|
-
import { Base, Channel, GuildMember, Integration } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import { Endpoints } from "../rest";
|
4
|
-
import type {
|
5
|
-
JSONApplicationRoleConnection,
|
6
|
-
JSONConnection,
|
7
|
-
JSONUser,
|
8
|
-
RawApplicationRoleConnection,
|
9
|
-
RawChannel,
|
10
|
-
RawConnection,
|
11
|
-
RawGuildMember,
|
12
|
-
RawUser,
|
13
|
-
} from "../types";
|
14
|
-
import type {
|
15
|
-
ApplicationRoleConnectionMetadataType,
|
16
|
-
Locale,
|
17
|
-
PremiumTypes,
|
18
|
-
UserFlags,
|
19
|
-
} from "../constants";
|
20
|
-
|
21
|
-
/** https://discord.com/developers/docs/resources/user */
|
22
|
-
export class User extends Base {
|
23
|
-
protected override raw: RawUser;
|
24
|
-
username: string;
|
25
|
-
discriminator: string;
|
26
|
-
avatar: string;
|
27
|
-
globalName: string | null;
|
28
|
-
bot?: boolean;
|
29
|
-
system?: boolean;
|
30
|
-
mfaEnabled?: boolean;
|
31
|
-
banner?: string;
|
32
|
-
accentColor?: number;
|
33
|
-
locale?: string;
|
34
|
-
verified?: boolean;
|
35
|
-
email?: string;
|
36
|
-
flags?: UserFlags;
|
37
|
-
premiumType?: PremiumTypes;
|
38
|
-
publicFlags?: UserFlags;
|
39
|
-
avatarDecoration?: string | null;
|
40
|
-
|
41
|
-
constructor(data: RawUser, client: Client) {
|
42
|
-
super(data.id, client);
|
43
|
-
|
44
|
-
this.raw = data;
|
45
|
-
this.username = data.username;
|
46
|
-
this.discriminator = data.discriminator;
|
47
|
-
this.globalName = data.global_name;
|
48
|
-
this.avatar = data.avatar;
|
49
|
-
|
50
|
-
this.patch(data);
|
51
|
-
}
|
52
|
-
|
53
|
-
protected override patch(data: RawUser): void {
|
54
|
-
if (data.bot !== undefined) this.bot = data.bot;
|
55
|
-
if (data.system !== undefined) this.system = data.system;
|
56
|
-
if (data.mfa_enabled !== undefined) this.mfaEnabled = data.mfa_enabled;
|
57
|
-
if (data.banner !== undefined) this.banner = data.banner;
|
58
|
-
if (data.accent_color !== undefined) this.accentColor = data.accent_color;
|
59
|
-
if (data.locale !== undefined) this.locale = data.locale;
|
60
|
-
if (data.verified !== undefined) this.verified = data.verified;
|
61
|
-
if (data.email !== undefined) this.email = data.email;
|
62
|
-
if (data.flags !== undefined) this.flags = data.flags;
|
63
|
-
if (data.premium_type !== undefined) this.premiumType = data.premium_type;
|
64
|
-
if (data.public_flags !== undefined) this.publicFlags = data.public_flags;
|
65
|
-
if (data.avatar_decoration !== undefined)
|
66
|
-
this.avatarDecoration = data.avatar_decoration;
|
67
|
-
}
|
68
|
-
|
69
|
-
/** https://discord.com/developers/docs/resources/user#create-dm */
|
70
|
-
async createDM(options: { recipientId: string }): Promise<Channel> {
|
71
|
-
return new Channel(
|
72
|
-
await this.client.rest.post<RawChannel>(Endpoints.userChannels(), {
|
73
|
-
json: {
|
74
|
-
recipient_id: options.recipientId,
|
75
|
-
},
|
76
|
-
}),
|
77
|
-
this.client
|
78
|
-
);
|
79
|
-
}
|
80
|
-
|
81
|
-
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
82
|
-
async createGroupDM(options: {
|
83
|
-
accessTokens: Array<string>;
|
84
|
-
nicks: Array<string>;
|
85
|
-
}): Promise<Channel> {
|
86
|
-
return new Channel(
|
87
|
-
await this.client.rest.post<RawChannel>(Endpoints.userChannels(), {
|
88
|
-
json: {
|
89
|
-
access_tokens: options.accessTokens,
|
90
|
-
nicks: options.nicks,
|
91
|
-
},
|
92
|
-
}),
|
93
|
-
this.client
|
94
|
-
);
|
95
|
-
}
|
96
|
-
|
97
|
-
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
98
|
-
async edit(options: {
|
99
|
-
username?: string;
|
100
|
-
avatar?: string | null;
|
101
|
-
}): Promise<User> {
|
102
|
-
return new User(
|
103
|
-
await this.client.rest.patch<RawUser>(Endpoints.user(), {
|
104
|
-
json: {
|
105
|
-
username: options.username,
|
106
|
-
avatar: options.avatar,
|
107
|
-
},
|
108
|
-
}),
|
109
|
-
this.client
|
110
|
-
);
|
111
|
-
}
|
112
|
-
|
113
|
-
/** https://discord.com/developers/docs/resources/user#get-user-application-role-connection */
|
114
|
-
async getApplicationRoleConnection(): Promise<JSONApplicationRoleConnection> {
|
115
|
-
return this.client.rest
|
116
|
-
.get<RawApplicationRoleConnection>(
|
117
|
-
Endpoints.userApplicationRoleConnection(this.client.application.id)
|
118
|
-
)
|
119
|
-
.then((response) => ({
|
120
|
-
platformName: response.platform_name,
|
121
|
-
platformUsername: response.platform_username,
|
122
|
-
metadata: {
|
123
|
-
type: response.metadata.type,
|
124
|
-
key: response.metadata.key,
|
125
|
-
name: response.metadata.name,
|
126
|
-
nameLocalizations: response.metadata.name_localizations,
|
127
|
-
description: response.metadata.description,
|
128
|
-
descriptionLocalizations: response.metadata.description_localizations,
|
129
|
-
},
|
130
|
-
}));
|
131
|
-
}
|
132
|
-
|
133
|
-
/** https://discord.com/developers/docs/resources/user#get-user-connections */
|
134
|
-
async getConnections(): Promise<Array<JSONConnection>> {
|
135
|
-
return this.client.rest
|
136
|
-
.get<Array<RawConnection>>(Endpoints.userConnections())
|
137
|
-
.then((response) =>
|
138
|
-
response.map((data) => ({
|
139
|
-
id: data.id,
|
140
|
-
name: data.name,
|
141
|
-
type: data.type,
|
142
|
-
revoked: data.revoked,
|
143
|
-
integrations: data.integrations?.map((integration) =>
|
144
|
-
new Integration(integration, this.client).toJSON()
|
145
|
-
),
|
146
|
-
verified: data.verified,
|
147
|
-
friendSync: data.friend_sync,
|
148
|
-
showActivity: data.show_activity,
|
149
|
-
twoWayLink: data.two_way_link,
|
150
|
-
visibility: data.visibility,
|
151
|
-
}))
|
152
|
-
);
|
153
|
-
}
|
154
|
-
|
155
|
-
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
156
|
-
async getGuildMember(guildId: string): Promise<GuildMember> {
|
157
|
-
return new GuildMember(
|
158
|
-
await this.client.rest.get<RawGuildMember>(
|
159
|
-
Endpoints.guildMember(guildId)
|
160
|
-
),
|
161
|
-
this.client
|
162
|
-
);
|
163
|
-
}
|
164
|
-
|
165
|
-
/** https://discord.com/developers/docs/resources/user#leave-guild */
|
166
|
-
leaveGuild(guildId: string): void {
|
167
|
-
this.client.rest.delete(Endpoints.userGuild(guildId));
|
168
|
-
}
|
169
|
-
|
170
|
-
/** https://discord.com/developers/docs/resources/user#update-user-application-role-connection */
|
171
|
-
async updateApplicationRoleConnection(options: {
|
172
|
-
platformName?: string;
|
173
|
-
platformUsername?: string;
|
174
|
-
metadata?: {
|
175
|
-
type: ApplicationRoleConnectionMetadataType;
|
176
|
-
key: string;
|
177
|
-
name: string;
|
178
|
-
nameLocalizations?: Partial<Record<Locale, string>> | null;
|
179
|
-
description: string;
|
180
|
-
descriptionLocalizations?: Partial<Record<Locale, string>> | null;
|
181
|
-
};
|
182
|
-
}): Promise<JSONApplicationRoleConnection> {
|
183
|
-
return this.client.rest
|
184
|
-
.put<RawApplicationRoleConnection>(
|
185
|
-
Endpoints.userApplicationRoleConnection(this.client.application.id),
|
186
|
-
{
|
187
|
-
json: {
|
188
|
-
platform_name: options.platformName,
|
189
|
-
platform_username: options.platformUsername,
|
190
|
-
metadata: options.metadata,
|
191
|
-
},
|
192
|
-
}
|
193
|
-
)
|
194
|
-
.then((response) => ({
|
195
|
-
platformName: response.platform_name,
|
196
|
-
platformUsername: response.platform_username,
|
197
|
-
metadata: {
|
198
|
-
type: response.metadata.type,
|
199
|
-
key: response.metadata.key,
|
200
|
-
name: response.metadata.name,
|
201
|
-
nameLocalizations: response.metadata.name_localizations,
|
202
|
-
description: response.metadata.description,
|
203
|
-
descriptionLocalizations: response.metadata.description_localizations,
|
204
|
-
},
|
205
|
-
}));
|
206
|
-
}
|
207
|
-
|
208
|
-
override toRaw(): RawUser {
|
209
|
-
return this.raw;
|
210
|
-
}
|
211
|
-
|
212
|
-
override toJSON(): JSONUser {
|
213
|
-
return {
|
214
|
-
...super.toJSON(),
|
215
|
-
username: this.username,
|
216
|
-
discriminator: this.discriminator,
|
217
|
-
globalName: this.globalName,
|
218
|
-
avatar: this.avatar,
|
219
|
-
bot: this.bot,
|
220
|
-
system: this.system,
|
221
|
-
mfaEnabled: this.mfaEnabled,
|
222
|
-
banner: this.banner,
|
223
|
-
accentColor: this.accentColor,
|
224
|
-
locale: this.locale,
|
225
|
-
verified: this.verified,
|
226
|
-
email: this.email,
|
227
|
-
flags: this.flags,
|
228
|
-
premiumType: this.premiumType,
|
229
|
-
publicFlags: this.publicFlags,
|
230
|
-
avatarDecoration: this.avatarDecoration,
|
231
|
-
};
|
232
|
-
}
|
233
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import { GuildMember } from ".";
|
2
|
-
import type { Client } from "../Client";
|
3
|
-
import type { JSONVoiceState, RawVoiceState } from "../types";
|
4
|
-
|
5
|
-
/** https://discord.com/developers/docs/resources/voice */
|
6
|
-
export class VoiceState {
|
7
|
-
private client: Client;
|
8
|
-
private raw: RawVoiceState;
|
9
|
-
guildId?: string;
|
10
|
-
channelId: string | null;
|
11
|
-
userId: string;
|
12
|
-
member?: GuildMember;
|
13
|
-
sessionId: string;
|
14
|
-
deaf: boolean;
|
15
|
-
mute: boolean;
|
16
|
-
selfDeaf: boolean;
|
17
|
-
selfMute: boolean;
|
18
|
-
selfStream?: boolean;
|
19
|
-
selfVideo: boolean;
|
20
|
-
suppress: boolean;
|
21
|
-
requestToSpeakTimestamp: string | null;
|
22
|
-
|
23
|
-
constructor(data: RawVoiceState, client: Client) {
|
24
|
-
this.client = client;
|
25
|
-
this.raw = data;
|
26
|
-
this.channelId = data.channel_id;
|
27
|
-
this.userId = data.user_id;
|
28
|
-
this.sessionId = data.session_id;
|
29
|
-
this.deaf = data.deaf;
|
30
|
-
this.mute = data.mute;
|
31
|
-
this.selfDeaf = data.self_deaf;
|
32
|
-
this.selfMute = data.self_mute;
|
33
|
-
this.selfVideo = data.self_video;
|
34
|
-
this.suppress = data.suppress;
|
35
|
-
this.requestToSpeakTimestamp = data.request_to_speak_timestamp;
|
36
|
-
|
37
|
-
this.patch(data);
|
38
|
-
}
|
39
|
-
|
40
|
-
private patch(data: RawVoiceState) {
|
41
|
-
if (data.guild_id !== undefined) this.guildId = data.guild_id;
|
42
|
-
if (data.member !== undefined)
|
43
|
-
this.member = new GuildMember(data.member, this.client);
|
44
|
-
if (data.self_stream !== undefined) this.selfStream = data.self_stream;
|
45
|
-
}
|
46
|
-
|
47
|
-
toString(): string {
|
48
|
-
return `[${this.constructor.name}]`;
|
49
|
-
}
|
50
|
-
|
51
|
-
toRaw(): RawVoiceState {
|
52
|
-
return this.raw;
|
53
|
-
}
|
54
|
-
|
55
|
-
toJSON(): JSONVoiceState {
|
56
|
-
return {
|
57
|
-
guildId: this.guildId,
|
58
|
-
channelId: this.channelId,
|
59
|
-
userId: this.userId,
|
60
|
-
member: this.member?.toJSON(),
|
61
|
-
sessionId: this.sessionId,
|
62
|
-
deaf: this.deaf,
|
63
|
-
mute: this.mute,
|
64
|
-
selfDeaf: this.selfDeaf,
|
65
|
-
selfMute: this.selfMute,
|
66
|
-
selfStream: this.selfStream,
|
67
|
-
selfVideo: this.selfVideo,
|
68
|
-
suppress: this.suppress,
|
69
|
-
requestToSpeakTimestamp: this.requestToSpeakTimestamp,
|
70
|
-
};
|
71
|
-
}
|
72
|
-
}
|