This commit is contained in:
Elysia
2024-01-09 20:15:49 +07:00
parent 26c71d7777
commit 02fcfb881f
21 changed files with 52 additions and 529 deletions

View File

@@ -1,16 +1,19 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
/**
* Emitted whenever a recipient is added from a group DM.
* @event Client#channelRecipientAdd
* @param {PartialGroupDMChannel} channel Group DM channel
* @param {User} user User
*/
const { Events, Status } = require('../../../util/Constants');
module.exports = (client, packet, shard) => {
const channel = client.channels.cache.get(packet.d.channel_id);
if (!channel) return;
if (!channel._recipients) channel._recipients = [];
channel._recipients.push(packet.d.user);
const user = client.users._add(packet.d.user);
client.emit(Events.CHANNEL_RECIPIENT_ADD, channel, user);
if (channel) {
if (!channel._recipients) channel._recipients = [];
channel._recipients.push(packet.d.user);
const user = client.users._add(packet.d.user);
if (shard.status == Status.READY) {
/**
* Emitted whenever a recipient is added from a group DM.
* @event Client#channelRecipientAdd
* @param {GroupDMChannel} channel Group DM channel
* @param {User} user User
*/
client.emit(Events.CHANNEL_RECIPIENT_ADD, channel, user);
}
}
};

View File

@@ -1,16 +1,16 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
/**
* Emitted whenever a recipient is removed from a group DM.
* @event Client#channelRecipientRemove
* @param {PartialGroupDMChannel} channel Group DM channel
* @param {User} user User
*/
const channel = client.channels.cache.get(packet.d.channel_id);
if (!channel) return;
if (!channel._recipients) channel._recipients = [];
channel._recipients = channel._recipients.filter(r => r !== packet.d.user.id);
const user = client.users._add(packet.d.user);
client.emit(Events.CHANNEL_RECIPIENT_REMOVE, channel, user);
if (channel) {
if (!channel._recipients) channel._recipients = [];
channel._recipients = channel._recipients.filter(u => u.id !== packet.d.user.id);
/**
* Emitted whenever a recipient is removed from a group DM.
* @event Client#channelRecipientRemove
* @param {GroupDMChannel} channel Group DM channel
* @param {User} user User
*/
client.emit(Events.CHANNEL_RECIPIENT_REMOVE, channel, client.users._add(packet.d.user));
}
};

View File

@@ -1,11 +0,0 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
for (const command of data.application_commands) {
const user = client.users.cache.get(command.application_id);
if (!user || !user.bot) continue;
user.application?.commands?._add(command, true);
}
client.emit(Events.GUILD_APPLICATION_COMMANDS_UPDATE, data);
};

View File

@@ -1,16 +0,0 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const channel = client.channels.cache.get(data.channel_id);
/**
* Emitted whenever message is acknowledged (mark read / unread)
* @event Client#messageAck
* @param {TextChannel} channel Channel
* @param {Snowflake} message_id Message ID
* @param {boolean} isRead Whether the message is read
* @param {Object} raw Raw data
*/
client.emit(Events.MESSAGE_ACK, channel, data.message_id, !data.manual, data);
};

View File

@@ -1,5 +1,5 @@
'use strict';
module.exports = (client, { d: data }) => {
client.user.notes.set(data.id, data.note);
client.notes.cache.set(data.id, data.note);
};