@ovencord/discord.js 14.16.7 → 14.16.9
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 +1 -1
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
- package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
- package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
- package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
- package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
- package/src/client/websocket/handlers/READY.ts +30 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +51 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/TYPING_START.ts +4 -0
- package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/index.ts +75 -76
- package/src/index.ts +1 -1
- package/src/util/Constants.ts +2 -1
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
/**
|
|
6
|
+
* Emitted whenever permissions for an application command in a guild were updated.
|
|
7
|
+
* <warn>This includes permission updates for other applications in addition to the logged in client,
|
|
8
|
+
* check `data.applicationId` to verify which application the update is for</warn>
|
|
9
|
+
*
|
|
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
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { AutoModerationActionExecution } from '../../../structures/AutoModerationActionExecution.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever an auto moderation rule is triggered.
|
|
11
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
12
|
+
*
|
|
13
|
+
* @event Client#autoModerationActionExecution
|
|
14
|
+
* @param {AutoModerationActionExecution} autoModerationActionExecution The data of the execution
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.AutoModerationActionExecution, new AutoModerationActionExecution(data, guild));
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const autoModerationRule = guild.autoModerationRules._add(data);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever an auto moderation rule is created.
|
|
12
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
13
|
+
*
|
|
14
|
+
* @event Client#autoModerationRuleCreate
|
|
15
|
+
* @param {AutoModerationRule} autoModerationRule The created auto moderation rule
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.AutoModerationRuleCreate, autoModerationRule);
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const autoModerationRule = guild.autoModerationRules.cache.get(data.id);
|
|
9
|
+
if (!autoModerationRule) return;
|
|
10
|
+
|
|
11
|
+
guild.autoModerationRules.cache.delete(autoModerationRule.id);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever an auto moderation rule is deleted.
|
|
15
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
16
|
+
*
|
|
17
|
+
* @event Client#autoModerationRuleDelete
|
|
18
|
+
* @param {AutoModerationRule} autoModerationRule The deleted auto moderation rule
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.AutoModerationRuleDelete, autoModerationRule);
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const oldAutoModerationRule = guild.autoModerationRules.cache.get(data.id)?._clone() ?? null;
|
|
9
|
+
const newAutoModerationRule = guild.autoModerationRules._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever an auto moderation rule gets updated.
|
|
13
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
14
|
+
*
|
|
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);
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
6
|
+
const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
7
|
+
|
|
8
|
+
if (channel) {
|
|
9
|
+
// Discord sends null for last_pin_timestamp if the last pinned message was removed
|
|
10
|
+
channel.lastPinTimestamp = time;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event,
|
|
14
|
+
* not much information can be provided easily here - you need to manually check the pins yourself.
|
|
15
|
+
*
|
|
16
|
+
* @event Client#channelPinsUpdate
|
|
17
|
+
* @param {TextBasedChannels} channel The channel that the pins update occurred in
|
|
18
|
+
* @param {Date} time The time of the pins update
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.ChannelPinsUpdate, channel, time);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, packet) => {
|
|
5
|
+
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
|
|
6
|
+
if (old && updated) {
|
|
7
|
+
/**
|
|
8
|
+
* Emitted whenever a channel is updated - e.g. name change, topic change, channel type change.
|
|
9
|
+
*
|
|
10
|
+
* @event Client#channelUpdate
|
|
11
|
+
* @param {DMChannel|GuildChannel} oldChannel The channel before the update
|
|
12
|
+
* @param {DMChannel|GuildChannel} newChannel The channel after the update
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.ChannelUpdate, old, updated);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const entitlement = client.application.entitlements._add(data);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Emitted whenever an entitlement is created.
|
|
9
|
+
*
|
|
10
|
+
* @event Client#entitlementCreate
|
|
11
|
+
* @param {Entitlement} entitlement The entitlement that was created
|
|
12
|
+
*/
|
|
13
|
+
client.emit(Events.EntitlementCreate, entitlement);
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const entitlement = client.application.entitlements._add(data, false);
|
|
6
|
+
|
|
7
|
+
client.application.entitlements.cache.delete(entitlement.id);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever an entitlement is deleted.
|
|
11
|
+
* <warn>Entitlements are not deleted when they expire.
|
|
12
|
+
* This is only triggered when Discord issues a refund or deletes the entitlement manually.</warn>
|
|
13
|
+
*
|
|
14
|
+
* @event Client#entitlementDelete
|
|
15
|
+
* @param {Entitlement} entitlement The entitlement that was deleted
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.EntitlementDelete, entitlement);
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const oldEntitlement = client.application.entitlements.cache.get(data.id)?._clone() ?? null;
|
|
6
|
+
const newEntitlement = client.application.entitlements._add(data);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever an entitlement is updated - i.e. when a user's subscription renews.
|
|
10
|
+
*
|
|
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);
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { GuildAuditLogsEntry } from '../../../structures/GuildAuditLogsEntry.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const auditLogEntry = new GuildAuditLogsEntry(guild, data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild audit log entry is created.
|
|
13
|
+
*
|
|
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);
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever a member is banned from a guild.
|
|
10
|
+
*
|
|
11
|
+
* @event Client#guildBanAdd
|
|
12
|
+
* @param {GuildBan} ban The ban that occurred
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildBanAdd, guild.bans._add(data));
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { GuildBan } from '../../../structures/GuildBan.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const ban = guild.bans.cache.get(data.user.id) ?? new GuildBan(client, data, guild);
|
|
10
|
+
|
|
11
|
+
guild.bans.cache.delete(ban.user.id);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever a member is unbanned from a guild.
|
|
15
|
+
*
|
|
16
|
+
* @event Client#guildBanRemove
|
|
17
|
+
* @param {GuildBan} ban The ban that was removed
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.GuildBanRemove, ban);
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
import { Status } from '../../../util/Status.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }, shardId) => {
|
|
6
|
+
let guild = client.guilds.cache.get(data.id);
|
|
7
|
+
if (guild) {
|
|
8
|
+
if (!guild.available && !data.unavailable) {
|
|
9
|
+
// A newly available guild
|
|
10
|
+
guild._patch(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild becomes available.
|
|
14
|
+
*
|
|
15
|
+
* @event Client#guildAvailable
|
|
16
|
+
* @param {Guild} guild The guild that became available
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.GuildAvailable, guild);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
// A new guild
|
|
22
|
+
data.shardId = shardId;
|
|
23
|
+
guild = client.guilds._add(data);
|
|
24
|
+
if (client.status === Status.Ready) {
|
|
25
|
+
/**
|
|
26
|
+
* Emitted whenever the client joins a guild.
|
|
27
|
+
*
|
|
28
|
+
* @event Client#guildCreate
|
|
29
|
+
* @param {Guild} guild The created guild
|
|
30
|
+
*/
|
|
31
|
+
client.emit(Events.GuildCreate, guild);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
if (data.unavailable) {
|
|
9
|
+
guild.available = false;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild becomes unavailable, likely due to a server outage.
|
|
13
|
+
*
|
|
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
|
+
*
|
|
32
|
+
* @event Client#guildDelete
|
|
33
|
+
* @param {Guild} guild The guild that was deleted
|
|
34
|
+
*/
|
|
35
|
+
client.emit(Events.GuildDelete, guild);
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever a guild integration is updated
|
|
10
|
+
*
|
|
11
|
+
* @event Client#guildIntegrationsUpdate
|
|
12
|
+
* @param {Guild} guild The guild whose integrations were updated
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildIntegrationsUpdate, guild);
|
|
15
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
import { Collection } from '@ovencord/collection';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
const members = new Collection();
|
|
9
|
+
|
|
10
|
+
for (const member of data.members) members.set(member.user.id, guild.members._add(member));
|
|
11
|
+
if (data.presences) {
|
|
12
|
+
for (const presence of data.presences) guild.presences._add(Object.assign(presence, { guild }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the properties of a guild members chunk
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} GuildMembersChunk
|
|
19
|
+
* @property {number} index Index of the received chunk
|
|
20
|
+
* @property {number} count Number of chunks the client should receive
|
|
21
|
+
* @property {Array<*>} notFound An array of whatever could not be found
|
|
22
|
+
* when using {@link GatewayOpcodes.RequestGuildMembers}
|
|
23
|
+
* @property {?string} nonce Nonce for this chunk
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Emitted whenever a chunk of guild members is received (all members come from the same guild).
|
|
28
|
+
*
|
|
29
|
+
* @event Client#guildMembersChunk
|
|
30
|
+
* @param {Collection<Snowflake, GuildMember>} members The members in the chunk
|
|
31
|
+
* @param {Guild} guild The guild related to the member chunk
|
|
32
|
+
* @param {GuildMembersChunk} chunk Properties of the received chunk
|
|
33
|
+
*/
|
|
34
|
+
client.emit(Events.GuildMembersChunk, members, guild, {
|
|
35
|
+
index: data.chunk_index,
|
|
36
|
+
count: data.chunk_count,
|
|
37
|
+
notFound: data.not_found,
|
|
38
|
+
nonce: data.nonce,
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (guild) {
|
|
7
|
+
guild.memberCount++;
|
|
8
|
+
const member = guild.members._add(data);
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever a user joins a guild.
|
|
11
|
+
*
|
|
12
|
+
* @event Client#guildMemberAdd
|
|
13
|
+
* @param {GuildMember} member The member that has joined a guild
|
|
14
|
+
*/
|
|
15
|
+
client.emit(Events.GuildMemberAdd, member);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const role = guild.roles.cache.get(data.role.id);
|
|
9
|
+
if (!role) return;
|
|
10
|
+
|
|
11
|
+
const old = role._update(data.role);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever a guild role is updated.
|
|
15
|
+
*
|
|
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);
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const guildScheduledEvent = guild.scheduledEvents._add(data);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever a guild scheduled event is created.
|
|
12
|
+
*
|
|
13
|
+
* @event Client#guildScheduledEventCreate
|
|
14
|
+
* @param {GuildScheduledEvent} guildScheduledEvent The created guild scheduled event
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.GuildScheduledEventCreate, guildScheduledEvent);
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const oldGuildScheduledEvent = guild.scheduledEvents.cache.get(data.id)?._clone() ?? null;
|
|
9
|
+
const newGuildScheduledEvent = guild.scheduledEvents._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild scheduled event gets updated.
|
|
13
|
+
*
|
|
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);
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { Collection } from '@ovencord/collection';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
export default (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
|
|
10
|
+
const soundboardSounds = new Collection();
|
|
11
|
+
|
|
12
|
+
for (const soundboardSound of data.soundboard_sounds) {
|
|
13
|
+
soundboardSounds.set(soundboardSound.sound_id, guild.soundboardSounds._add(soundboardSound));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Emitted whenever multiple guild soundboard sounds are updated.
|
|
18
|
+
*
|
|
19
|
+
* @event Client#guildSoundboardSoundsUpdate
|
|
20
|
+
* @param {Collection<Snowflake, SoundboardSound>} soundboardSounds The updated soundboard sounds
|
|
21
|
+
* @param {Guild} guild The guild that the soundboard sounds are from
|
|
22
|
+
*/
|
|
23
|
+
client.emit(Events.GuildSoundboardSoundsUpdate, soundboardSounds, guild);
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const soundboardSound = guild.soundboardSounds._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild soundboard sound is created.
|
|
13
|
+
*
|
|
14
|
+
* @event Client#guildSoundboardSoundCreate
|
|
15
|
+
* @param {SoundboardSound} soundboardSound The created guild soundboard sound
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.GuildSoundboardSoundCreate, soundboardSound);
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const oldGuildSoundboardSound = guild.soundboardSounds.cache.get(data.sound_id)?._clone() ?? null;
|
|
10
|
+
const newGuildSoundboardSound = guild.soundboardSounds._add(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild soundboard sound is updated.
|
|
14
|
+
*
|
|
15
|
+
* @event Client#guildSoundboardSoundUpdate
|
|
16
|
+
* @param {?SoundboardSound} oldGuildSoundboardSound The guild soundboard sound before the update
|
|
17
|
+
* @param {SoundboardSound} newGuildSoundboardSound The guild soundboard sound after the update
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.GuildSoundboardSoundUpdate, oldGuildSoundboardSound, newGuildSoundboardSound);
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
export default (client, { d: data }) => {
|
|
5
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!channel) return;
|
|
8
|
+
|
|
9
|
+
const inviteData = Object.assign(data, { channel, guild });
|
|
10
|
+
const invite = guild.invites._add(inviteData);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted when an invite is created.
|
|
14
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageChannels} permission for the channel.</info>
|
|
15
|
+
*
|
|
16
|
+
* @event Client#inviteCreate
|
|
17
|
+
* @param {GuildInvite} invite The invite that was created
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.InviteCreate, invite);
|
|
20
|
+
};
|