discord.js 15.0.0-dev.1736727169-101bef1c5 → 15.0.0-dev.1736769925-18ab0cf62
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/package.json +3 -3
- package/src/client/actions/ActionsManager.js +0 -24
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +16 -2
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +14 -2
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +15 -2
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +18 -2
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +17 -2
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +11 -2
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +15 -2
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +13 -2
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +16 -2
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +12 -2
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +17 -2
- package/src/client/websocket/handlers/GUILD_DELETE.js +32 -2
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +12 -2
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +18 -2
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +14 -2
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +16 -2
- package/src/client/websocket/handlers/INVITE_CREATE.js +17 -2
- package/src/client/websocket/handlers/INVITE_DELETE.js +20 -2
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +40 -2
- package/src/client/websocket/handlers/THREAD_DELETE.js +14 -2
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +46 -2
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +22 -2
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +34 -2
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +13 -2
- package/src/index.js +0 -1
- package/src/structures/ClientApplication.js +0 -20
- package/src/structures/interfaces/Application.js +50 -0
- package/src/util/Components.js +3 -1
- package/src/util/Util.js +1 -1
- package/typings/index.d.mts +5 -54
- package/typings/index.d.ts +5 -54
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +0 -34
- package/src/client/actions/AutoModerationActionExecution.js +0 -26
- package/src/client/actions/AutoModerationRuleCreate.js +0 -27
- package/src/client/actions/AutoModerationRuleDelete.js +0 -31
- package/src/client/actions/AutoModerationRuleUpdate.js +0 -29
- package/src/client/actions/EntitlementCreate.js +0 -23
- package/src/client/actions/EntitlementDelete.js +0 -27
- package/src/client/actions/EntitlementUpdate.js +0 -25
- package/src/client/actions/GuildAuditLogEntryCreate.js +0 -29
- package/src/client/actions/GuildBanAdd.js +0 -20
- package/src/client/actions/GuildBanRemove.js +0 -25
- package/src/client/actions/GuildDelete.js +0 -44
- package/src/client/actions/GuildIntegrationsUpdate.js +0 -19
- package/src/client/actions/GuildRoleUpdate.js +0 -39
- package/src/client/actions/GuildScheduledEventCreate.js +0 -27
- package/src/client/actions/GuildScheduledEventUpdate.js +0 -30
- package/src/client/actions/InviteCreate.js +0 -27
- package/src/client/actions/InviteDelete.js +0 -29
- package/src/client/actions/PresenceUpdate.js +0 -42
- package/src/client/actions/ThreadDelete.js +0 -26
- package/src/client/actions/ThreadListSync.js +0 -60
- package/src/client/actions/ThreadMemberUpdate.js +0 -30
- package/src/client/actions/VoiceStateUpdate.js +0 -43
- package/src/client/actions/WebhooksUpdate.js +0 -22
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1736769925-18ab0cf62",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@discordjs/builders": "^1.9.0",
|
|
56
|
-
"@discordjs/collection": "1.5.3",
|
|
57
56
|
"@sapphire/snowflake": "3.5.5",
|
|
58
57
|
"discord-api-types": "^0.37.114",
|
|
59
58
|
"fast-deep-equal": "3.1.3",
|
|
60
59
|
"lodash.snakecase": "4.1.1",
|
|
61
60
|
"tslib": "^2.8.1",
|
|
62
61
|
"undici": "6.21.0",
|
|
62
|
+
"@discordjs/collection": "^2.1.1",
|
|
63
63
|
"@discordjs/formatters": "^0.5.0",
|
|
64
|
-
"@discordjs/rest": "^2.4.0",
|
|
65
64
|
"@discordjs/util": "^1.1.1",
|
|
65
|
+
"@discordjs/rest": "^2.4.0",
|
|
66
66
|
"@discordjs/ws": "^2.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -11,36 +11,20 @@ class ActionsManager {
|
|
|
11
11
|
constructor(client) {
|
|
12
12
|
this.client = client;
|
|
13
13
|
|
|
14
|
-
this.register(require('./ApplicationCommandPermissionsUpdate'));
|
|
15
|
-
this.register(require('./AutoModerationActionExecution'));
|
|
16
|
-
this.register(require('./AutoModerationRuleCreate'));
|
|
17
|
-
this.register(require('./AutoModerationRuleDelete'));
|
|
18
|
-
this.register(require('./AutoModerationRuleUpdate'));
|
|
19
14
|
this.register(require('./ChannelCreate'));
|
|
20
15
|
this.register(require('./ChannelDelete'));
|
|
21
16
|
this.register(require('./ChannelUpdate'));
|
|
22
|
-
this.register(require('./EntitlementCreate'));
|
|
23
|
-
this.register(require('./EntitlementDelete'));
|
|
24
|
-
this.register(require('./EntitlementUpdate'));
|
|
25
|
-
this.register(require('./GuildAuditLogEntryCreate'));
|
|
26
|
-
this.register(require('./GuildBanAdd'));
|
|
27
|
-
this.register(require('./GuildBanRemove'));
|
|
28
17
|
this.register(require('./GuildChannelsPositionUpdate'));
|
|
29
|
-
this.register(require('./GuildDelete'));
|
|
30
18
|
this.register(require('./GuildEmojiCreate'));
|
|
31
19
|
this.register(require('./GuildEmojiDelete'));
|
|
32
20
|
this.register(require('./GuildEmojiUpdate'));
|
|
33
21
|
this.register(require('./GuildEmojisUpdate'));
|
|
34
|
-
this.register(require('./GuildIntegrationsUpdate'));
|
|
35
22
|
this.register(require('./GuildMemberRemove'));
|
|
36
23
|
this.register(require('./GuildMemberUpdate'));
|
|
37
24
|
this.register(require('./GuildRoleCreate'));
|
|
38
25
|
this.register(require('./GuildRoleDelete'));
|
|
39
|
-
this.register(require('./GuildRoleUpdate'));
|
|
40
26
|
this.register(require('./GuildRolesPositionUpdate'));
|
|
41
|
-
this.register(require('./GuildScheduledEventCreate'));
|
|
42
27
|
this.register(require('./GuildScheduledEventDelete'));
|
|
43
|
-
this.register(require('./GuildScheduledEventUpdate'));
|
|
44
28
|
this.register(require('./GuildScheduledEventUserAdd'));
|
|
45
29
|
this.register(require('./GuildScheduledEventUserRemove'));
|
|
46
30
|
this.register(require('./GuildStickerCreate'));
|
|
@@ -49,8 +33,6 @@ class ActionsManager {
|
|
|
49
33
|
this.register(require('./GuildStickersUpdate'));
|
|
50
34
|
this.register(require('./GuildUpdate'));
|
|
51
35
|
this.register(require('./InteractionCreate'));
|
|
52
|
-
this.register(require('./InviteCreate'));
|
|
53
|
-
this.register(require('./InviteDelete'));
|
|
54
36
|
this.register(require('./MessageCreate'));
|
|
55
37
|
this.register(require('./MessageDelete'));
|
|
56
38
|
this.register(require('./MessageDeleteBulk'));
|
|
@@ -61,19 +43,13 @@ class ActionsManager {
|
|
|
61
43
|
this.register(require('./MessageReactionRemoveAll'));
|
|
62
44
|
this.register(require('./MessageReactionRemoveEmoji'));
|
|
63
45
|
this.register(require('./MessageUpdate'));
|
|
64
|
-
this.register(require('./PresenceUpdate'));
|
|
65
46
|
this.register(require('./StageInstanceCreate'));
|
|
66
47
|
this.register(require('./StageInstanceDelete'));
|
|
67
48
|
this.register(require('./StageInstanceUpdate'));
|
|
68
49
|
this.register(require('./ThreadCreate'));
|
|
69
|
-
this.register(require('./ThreadDelete'));
|
|
70
|
-
this.register(require('./ThreadListSync'));
|
|
71
|
-
this.register(require('./ThreadMemberUpdate'));
|
|
72
50
|
this.register(require('./ThreadMembersUpdate'));
|
|
73
51
|
this.register(require('./TypingStart'));
|
|
74
52
|
this.register(require('./UserUpdate'));
|
|
75
|
-
this.register(require('./VoiceStateUpdate'));
|
|
76
|
-
this.register(require('./WebhooksUpdate'));
|
|
77
53
|
}
|
|
78
54
|
|
|
79
55
|
register(Action) {
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
/**
|
|
7
|
+
* Emitted whenever permissions for an application command in a guild were updated.
|
|
8
|
+
* <warn>This includes permission updates for other applications in addition to the logged in client,
|
|
9
|
+
* check `data.applicationId` to verify which application the update is for</warn>
|
|
10
|
+
* @event Client#applicationCommandPermissionsUpdate
|
|
11
|
+
* @param {ApplicationCommandPermissionsUpdateData} data The updated permissions
|
|
12
|
+
*/
|
|
13
|
+
client.emit(Events.ApplicationCommandPermissionsUpdate, {
|
|
14
|
+
permissions: data.permissions,
|
|
15
|
+
id: data.id,
|
|
16
|
+
guildId: data.guild_id,
|
|
17
|
+
applicationId: data.application_id,
|
|
18
|
+
});
|
|
5
19
|
};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const AutoModerationActionExecution = require('../../../structures/AutoModerationActionExecution.js');
|
|
4
|
+
const Events = require('../../../util/Events.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever an auto moderation rule is triggered.
|
|
12
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
13
|
+
* @event Client#autoModerationActionExecution
|
|
14
|
+
* @param {AutoModerationActionExecution} autoModerationActionExecution The data of the execution
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.AutoModerationActionExecution, new AutoModerationActionExecution(data, guild));
|
|
5
17
|
};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const autoModerationRule = guild.autoModerationRules._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever an auto moderation rule is created.
|
|
13
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
14
|
+
* @event Client#autoModerationRuleCreate
|
|
15
|
+
* @param {AutoModerationRule} autoModerationRule The created auto moderation rule
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.AutoModerationRuleCreate, autoModerationRule);
|
|
5
18
|
};
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const autoModerationRule = guild.autoModerationRules.cache.get(data.id);
|
|
10
|
+
if (!autoModerationRule) return;
|
|
11
|
+
|
|
12
|
+
guild.autoModerationRules.cache.delete(autoModerationRule.id);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Emitted whenever an auto moderation rule is deleted.
|
|
16
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
17
|
+
* @event Client#autoModerationRuleDelete
|
|
18
|
+
* @param {AutoModerationRule} autoModerationRule The deleted auto moderation rule
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.AutoModerationRuleDelete, autoModerationRule);
|
|
5
21
|
};
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const oldAutoModerationRule = guild.autoModerationRules.cache.get(data.id)?._clone() ?? null;
|
|
10
|
+
const newAutoModerationRule = guild.autoModerationRules._add(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever an auto moderation rule gets updated.
|
|
14
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
15
|
+
* @event Client#autoModerationRuleUpdate
|
|
16
|
+
* @param {?AutoModerationRule} oldAutoModerationRule The auto moderation rule before the update
|
|
17
|
+
* @param {AutoModerationRule} newAutoModerationRule The auto moderation rule after the update
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.AutoModerationRuleUpdate, oldAutoModerationRule, newAutoModerationRule);
|
|
5
20
|
};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const entitlement = client.application.entitlements._add(data);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever an entitlement is created.
|
|
10
|
+
* @event Client#entitlementCreate
|
|
11
|
+
* @param {Entitlement} entitlement The entitlement that was created
|
|
12
|
+
*/
|
|
13
|
+
client.emit(Events.EntitlementCreate, entitlement);
|
|
5
14
|
};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const entitlement = client.application.entitlements._add(data, false);
|
|
7
|
+
|
|
8
|
+
client.application.entitlements.cache.delete(entitlement.id);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever an entitlement is deleted.
|
|
12
|
+
* <warn>Entitlements are not deleted when they expire.
|
|
13
|
+
* This is only triggered when Discord issues a refund or deletes the entitlement manually.</warn>
|
|
14
|
+
* @event Client#entitlementDelete
|
|
15
|
+
* @param {Entitlement} entitlement The entitlement that was deleted
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.EntitlementDelete, entitlement);
|
|
5
18
|
};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const oldEntitlement = client.application.entitlements.cache.get(data.id)?._clone() ?? null;
|
|
7
|
+
const newEntitlement = client.application.entitlements._add(data);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever an entitlement is updated - i.e. when a user's subscription renews.
|
|
11
|
+
* @event Client#entitlementUpdate
|
|
12
|
+
* @param {?Entitlement} oldEntitlement The entitlement before the update
|
|
13
|
+
* @param {Entitlement} newEntitlement The entitlement after the update
|
|
14
|
+
*/
|
|
15
|
+
client.emit(Events.EntitlementUpdate, oldEntitlement, newEntitlement);
|
|
5
16
|
};
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const GuildAuditLogsEntry = require('../../../structures/GuildAuditLogsEntry.js');
|
|
4
|
+
const Events = require('../../../util/Events.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
|
|
10
|
+
const auditLogEntry = new GuildAuditLogsEntry(guild, data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild audit log entry is created.
|
|
14
|
+
* @event Client#guildAuditLogEntryCreate
|
|
15
|
+
* @param {GuildAuditLogsEntry} auditLogEntry The entry that was created
|
|
16
|
+
* @param {Guild} guild The guild where the entry was created
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.GuildAuditLogEntryCreate, auditLogEntry, guild);
|
|
5
19
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever a member is banned from a guild.
|
|
11
|
+
* @event Client#guildBanAdd
|
|
12
|
+
* @param {GuildBan} ban The ban that occurred
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildBanAdd, guild.bans._add(data));
|
|
5
15
|
};
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const GuildBan = require('../../../structures/GuildBan.js');
|
|
4
|
+
const Events = require('../../../util/Events.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
|
|
10
|
+
const ban = guild.bans.cache.get(data.user.id) ?? new GuildBan(client, data, guild);
|
|
11
|
+
|
|
12
|
+
guild.bans.cache.delete(ban.user.id);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Emitted whenever a member is unbanned from a guild.
|
|
16
|
+
* @event Client#guildBanRemove
|
|
17
|
+
* @param {GuildBan} ban The ban that was removed
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.GuildBanRemove, ban);
|
|
5
20
|
};
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
if (data.unavailable) {
|
|
10
|
+
guild.available = false;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild becomes unavailable, likely due to a server outage.
|
|
14
|
+
* @event Client#guildUnavailable
|
|
15
|
+
* @param {Guild} guild The guild that has become unavailable
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.GuildUnavailable, guild);
|
|
18
|
+
|
|
19
|
+
// Stops the GuildDelete packet thinking a guild was actually deleted,
|
|
20
|
+
// handles emitting of event itself
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const channel of guild.channels.cache.values()) client.channels._remove(channel.id);
|
|
25
|
+
client.voice.adapters.get(data.id)?.destroy();
|
|
26
|
+
|
|
27
|
+
client.guilds.cache.delete(guild.id);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Emitted whenever a guild kicks the client or the guild is deleted/left.
|
|
31
|
+
* @event Client#guildDelete
|
|
32
|
+
* @param {Guild} guild The guild that was deleted
|
|
33
|
+
*/
|
|
34
|
+
client.emit(Events.GuildDelete, guild);
|
|
5
35
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever a guild integration is updated
|
|
11
|
+
* @event Client#guildIntegrationsUpdate
|
|
12
|
+
* @param {Guild} guild The guild whose integrations were updated
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildIntegrationsUpdate, guild);
|
|
5
15
|
};
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const role = guild.roles.cache.get(data.role.id);
|
|
10
|
+
if (!role) return;
|
|
11
|
+
|
|
12
|
+
const old = role._update(data.role);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Emitted whenever a guild role is updated.
|
|
16
|
+
* @event Client#roleUpdate
|
|
17
|
+
* @param {Role} oldRole The role before the update
|
|
18
|
+
* @param {Role} newRole The role after the update
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.GuildRoleUpdate, old, role);
|
|
5
21
|
};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const guildScheduledEvent = guild.scheduledEvents._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild scheduled event is created.
|
|
13
|
+
* @event Client#guildScheduledEventCreate
|
|
14
|
+
* @param {GuildScheduledEvent} guildScheduledEvent The created guild scheduled event
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.GuildScheduledEventCreate, guildScheduledEvent);
|
|
5
17
|
};
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const oldGuildScheduledEvent = guild.scheduledEvents.cache.get(data.id)?._clone() ?? null;
|
|
10
|
+
const newGuildScheduledEvent = guild.scheduledEvents._add(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild scheduled event gets updated.
|
|
14
|
+
* @event Client#guildScheduledEventUpdate
|
|
15
|
+
* @param {?GuildScheduledEvent} oldGuildScheduledEvent The guild scheduled event object before the update
|
|
16
|
+
* @param {GuildScheduledEvent} newGuildScheduledEvent The guild scheduled event object after the update
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.GuildScheduledEventUpdate, oldGuildScheduledEvent, newGuildScheduledEvent);
|
|
5
19
|
};
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!channel) return;
|
|
9
|
+
|
|
10
|
+
const inviteData = Object.assign(data, { channel, guild });
|
|
11
|
+
const invite = guild.invites._add(inviteData);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted when an invite is created.
|
|
15
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageChannels} permission for the channel.</info>
|
|
16
|
+
* @event Client#inviteCreate
|
|
17
|
+
* @param {Invite} invite The invite that was created
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.InviteCreate, invite);
|
|
5
20
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Invite = require('../../../structures/Invite.js');
|
|
4
|
+
const Events = require('../../../util/Events.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
8
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
9
|
+
if (!channel) return;
|
|
10
|
+
|
|
11
|
+
const inviteData = Object.assign(data, { channel, guild });
|
|
12
|
+
const invite = new Invite(client, inviteData);
|
|
13
|
+
|
|
14
|
+
guild.invites.cache.delete(invite.code);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Emitted when an invite is deleted.
|
|
18
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageChannels} permission for the channel.</info>
|
|
19
|
+
* @event Client#inviteDelete
|
|
20
|
+
* @param {Invite} invite The invite that was deleted
|
|
21
|
+
*/
|
|
22
|
+
client.emit(Events.InviteDelete, invite);
|
|
5
23
|
};
|
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
const Partials = require('../../../util/Partials.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
let user = client.users.cache.get(data.user.id);
|
|
8
|
+
if (!user && ('username' in data.user || client.options.partials.includes(Partials.User))) {
|
|
9
|
+
user = client.users._add(data.user);
|
|
10
|
+
}
|
|
11
|
+
if (!user) return;
|
|
12
|
+
|
|
13
|
+
if (data.user.username) {
|
|
14
|
+
if (!user._equals(data.user)) client.actions.UserUpdate.handle(data.user);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
18
|
+
if (!guild) return;
|
|
19
|
+
|
|
20
|
+
const oldPresence = guild.presences.cache.get(user.id)?._clone() ?? null;
|
|
21
|
+
|
|
22
|
+
let member = guild.members.cache.get(user.id);
|
|
23
|
+
if (!member && data.status !== 'offline') {
|
|
24
|
+
member = guild.members._add({
|
|
25
|
+
user,
|
|
26
|
+
deaf: false,
|
|
27
|
+
mute: false,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
client.emit(Events.GuildMemberAvailable, member);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const newPresence = guild.presences._add(Object.assign(data, { guild }));
|
|
34
|
+
if (client.listenerCount(Events.PresenceUpdate) > 0 && !newPresence.equals(oldPresence)) {
|
|
35
|
+
/**
|
|
36
|
+
* Emitted whenever a guild member's presence (e.g. status, activity) is changed.
|
|
37
|
+
* @event Client#presenceUpdate
|
|
38
|
+
* @param {?Presence} oldPresence The presence before the update, if one at all
|
|
39
|
+
* @param {Presence} newPresence The presence after the update
|
|
40
|
+
*/
|
|
41
|
+
client.emit(Events.PresenceUpdate, oldPresence, newPresence);
|
|
42
|
+
}
|
|
5
43
|
};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const thread = client.channels.cache.get(data.id);
|
|
7
|
+
if (!thread) return;
|
|
8
|
+
|
|
9
|
+
client.channels._remove(thread.id);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a thread is deleted.
|
|
13
|
+
* @event Client#threadDelete
|
|
14
|
+
* @param {ThreadChannel} thread The thread that was deleted
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.ThreadDelete, thread);
|
|
5
17
|
};
|
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const { Collection } = require('@discordjs/collection');
|
|
4
|
+
const Events = require('../../../util/Events.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
|
|
10
|
+
if (data.channel_ids) {
|
|
11
|
+
for (const id of data.channel_ids) {
|
|
12
|
+
const channel = client.channels.cache.get(id);
|
|
13
|
+
if (channel) removeStaleThreads(client, channel);
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
for (const channel of guild.channels.cache.values()) {
|
|
17
|
+
removeStaleThreads(client, channel);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const syncedThreads = data.threads.reduce((coll, rawThread) => {
|
|
22
|
+
const thread = client.channels._add(rawThread);
|
|
23
|
+
return coll.set(thread.id, thread);
|
|
24
|
+
}, new Collection());
|
|
25
|
+
|
|
26
|
+
for (const rawMember of Object.values(data.members)) {
|
|
27
|
+
// Discord sends the thread id as id in this object
|
|
28
|
+
const thread = client.channels.cache.get(rawMember.id);
|
|
29
|
+
if (thread) {
|
|
30
|
+
thread.members._add(rawMember);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Emitted whenever the client user gains access to a text or announcement channel that contains threads
|
|
36
|
+
* @event Client#threadListSync
|
|
37
|
+
* @param {Collection<Snowflake, ThreadChannel>} threads The threads that were synced
|
|
38
|
+
* @param {Guild} guild The guild that the threads were synced in
|
|
39
|
+
*/
|
|
40
|
+
client.emit(Events.ThreadListSync, syncedThreads, guild);
|
|
5
41
|
};
|
|
42
|
+
|
|
43
|
+
function removeStaleThreads(client, channel) {
|
|
44
|
+
channel.threads?.cache.forEach(thread => {
|
|
45
|
+
if (!thread.archived) {
|
|
46
|
+
client.channels._remove(thread.id);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const Events = require('../../../util/Events.js');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
// Discord sends the thread id as id in this object
|
|
7
|
+
const thread = client.channels.cache.get(data.id);
|
|
8
|
+
if (!thread) return;
|
|
9
|
+
|
|
10
|
+
const member = thread.members.cache.get(data.user_id);
|
|
11
|
+
if (!member) {
|
|
12
|
+
thread.members._add(data);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const old = member._update(data);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Emitted whenever the client user's thread member is updated.
|
|
20
|
+
* @event Client#threadMemberUpdate
|
|
21
|
+
* @param {ThreadMember} oldMember The member before the update
|
|
22
|
+
* @param {ThreadMember} newMember The member after the update
|
|
23
|
+
*/
|
|
24
|
+
client.emit(Events.ThreadMemberUpdate, old, member);
|
|
5
25
|
};
|