disgroove 1.3.3 → 1.3.4-dev.7ed5475

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.
Files changed (88) hide show
  1. package/dist/lib/Client.d.ts +11 -3
  2. package/dist/lib/Client.js +4 -4
  3. package/dist/lib/Client.js.map +1 -1
  4. package/dist/lib/constants.d.ts +2 -2
  5. package/dist/lib/constants.js +36 -36
  6. package/dist/lib/constants.js.map +1 -1
  7. package/dist/lib/gateway/Shard.js +2 -2
  8. package/dist/lib/rest/RequestsManager.d.ts +1 -1
  9. package/dist/lib/rest/RequestsManager.js +3 -4
  10. package/dist/lib/rest/RequestsManager.js.map +1 -1
  11. package/dist/lib/structures/Application.d.ts +13 -13
  12. package/dist/lib/structures/ApplicationCommand.d.ts +5 -5
  13. package/dist/lib/structures/ApplicationCommand.js.map +1 -1
  14. package/dist/lib/structures/ClientApplication.d.ts +13 -13
  15. package/dist/lib/structures/Guild.d.ts +14 -14
  16. package/dist/lib/structures/Guild.js +2 -3
  17. package/dist/lib/structures/Guild.js.map +1 -1
  18. package/dist/lib/structures/User.d.ts +3 -3
  19. package/dist/lib/types/application-command.d.ts +11 -11
  20. package/dist/lib/types/application-role-connection-metadata.d.ts +5 -5
  21. package/dist/package.json +1 -2
  22. package/package.json +1 -2
  23. package/lib/Client.ts +0 -616
  24. package/lib/constants.ts +0 -1173
  25. package/lib/gateway/Shard.ts +0 -704
  26. package/lib/gateway/ShardsManager.ts +0 -11
  27. package/lib/gateway/index.ts +0 -2
  28. package/lib/index.ts +0 -7
  29. package/lib/rest/CDN.ts +0 -56
  30. package/lib/rest/Endpoints.ts +0 -241
  31. package/lib/rest/REST.ts +0 -45
  32. package/lib/rest/RequestsManager.ts +0 -134
  33. package/lib/rest/index.ts +0 -4
  34. package/lib/structures/Application.ts +0 -599
  35. package/lib/structures/ApplicationCommand.ts +0 -187
  36. package/lib/structures/AuditLog.ts +0 -112
  37. package/lib/structures/AutoModerationRule.ts +0 -127
  38. package/lib/structures/Base.ts +0 -39
  39. package/lib/structures/Channel.ts +0 -921
  40. package/lib/structures/ClientApplication.ts +0 -515
  41. package/lib/structures/Emoji.ts +0 -95
  42. package/lib/structures/Entitlement.ts +0 -65
  43. package/lib/structures/Guild.ts +0 -1842
  44. package/lib/structures/GuildMember.ts +0 -193
  45. package/lib/structures/GuildScheduledEvent.ts +0 -164
  46. package/lib/structures/GuildTemplate.ts +0 -103
  47. package/lib/structures/Integration.ts +0 -136
  48. package/lib/structures/Interaction.ts +0 -506
  49. package/lib/structures/Invite.ts +0 -108
  50. package/lib/structures/Message.ts +0 -421
  51. package/lib/structures/Role.ts +0 -116
  52. package/lib/structures/SKU.ts +0 -63
  53. package/lib/structures/StageInstance.ts +0 -74
  54. package/lib/structures/Sticker.ts +0 -100
  55. package/lib/structures/Team.ts +0 -41
  56. package/lib/structures/TestEntitlement.ts +0 -78
  57. package/lib/structures/UnavailableGuild.ts +0 -27
  58. package/lib/structures/User.ts +0 -233
  59. package/lib/structures/VoiceState.ts +0 -72
  60. package/lib/structures/Webhook.ts +0 -341
  61. package/lib/structures/index.ts +0 -27
  62. package/lib/types/application-command.ts +0 -118
  63. package/lib/types/application-role-connection-metadata.ts +0 -23
  64. package/lib/types/application.ts +0 -77
  65. package/lib/types/audit-log.ts +0 -105
  66. package/lib/types/auto-moderation.ts +0 -78
  67. package/lib/types/channel.ts +0 -534
  68. package/lib/types/emoji.ts +0 -24
  69. package/lib/types/entitlements.ts +0 -34
  70. package/lib/types/gateway-events.ts +0 -970
  71. package/lib/types/guild-scheduled-event.ts +0 -67
  72. package/lib/types/guild-template.ts +0 -30
  73. package/lib/types/guild.ts +0 -388
  74. package/lib/types/index.ts +0 -23
  75. package/lib/types/interaction.ts +0 -224
  76. package/lib/types/invite.ts +0 -78
  77. package/lib/types/message-components.ts +0 -127
  78. package/lib/types/role.ts +0 -51
  79. package/lib/types/sku.ts +0 -32
  80. package/lib/types/stage-instance.ts +0 -22
  81. package/lib/types/sticker.ts +0 -67
  82. package/lib/types/team.ts +0 -34
  83. package/lib/types/user.ts +0 -93
  84. package/lib/types/voice.ts +0 -51
  85. package/lib/types/webhook.ts +0 -40
  86. package/lib/utils/Util.ts +0 -600
  87. package/lib/utils/errors.ts +0 -23
  88. package/lib/utils/index.ts +0 -2
@@ -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
- }