mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
Beep
This commit is contained in:
+4
-6
@@ -109,19 +109,17 @@ client.on('messageReactionRemove', async reaction => {
|
|||||||
client.on('raw', async event => {
|
client.on('raw', async event => {
|
||||||
const data = event.d;
|
const data = event.d;
|
||||||
if (event.t === 'MESSAGE_REACTION_ADD') {
|
if (event.t === 'MESSAGE_REACTION_ADD') {
|
||||||
console.log(data);
|
|
||||||
const channel = client.channels.get(data.channel_id);
|
const channel = client.channels.get(data.channel_id);
|
||||||
if (!data.emoji.id || channel.messages.has(data.message_id)) return;
|
if ((!data.emoji.id && !data.emoji.name) || channel.messages.has(data.message_id)) return;
|
||||||
const user = client.users.get(data.user_id);
|
const user = client.users.get(data.user_id);
|
||||||
const message = await channel.messages.fetch(data.message_id);
|
const message = await channel.messages.fetch(data.message_id);
|
||||||
const reaction = message.reactions.get(data.emoji.id);
|
const reaction = message.reactions.get(data.emoji.id || data.emoji.name);
|
||||||
client.emit('messageReactionAdd', reaction, user);
|
client.emit('messageReactionAdd', reaction, user);
|
||||||
} else if (event.t === 'MESSAGE_REACTION_REMOVE') {
|
} else if (event.t === 'MESSAGE_REACTION_REMOVE') {
|
||||||
console.log(data);
|
|
||||||
const channel = client.channels.get(data.channel_id);
|
const channel = client.channels.get(data.channel_id);
|
||||||
if (!data.emoji.id || channel.messages.has(data.message_id)) return;
|
if ((!data.emoji.id && !data.emoji.name) || channel.messages.has(data.message_id)) return;
|
||||||
const message = await channel.messages.fetch(data.message_id);
|
const message = await channel.messages.fetch(data.message_id);
|
||||||
const reaction = message.reactions.get(data.emoji.id);
|
const reaction = message.reactions.get(data.emoji.id || data.emoji.name);
|
||||||
client.emit('messageReactionRemove', reaction);
|
client.emit('messageReactionRemove', reaction);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user