Add new rating notifications

This commit is contained in:
2024-04-03 12:10:14 +02:00
parent edbbbe2d02
commit 0cdb763b5f
2 changed files with 46 additions and 2 deletions

43
events/ratingReact.js Normal file
View File

@@ -0,0 +1,43 @@
const { Events, Partials } = require('discord.js');
module.exports = {
name: Events.MessageReactionAdd,
async execute(reaction, user) {
if (reaction.partial) {
try {
await reaction.fetch();
} catch (error) {
console.error('Reacted message can not be fecthed:', error);
return;
}
}
let channelWhitelist = [
'1220653860251762688', //musik hier
'1221748800671191050', //track der woche
'1220685344341757952', //playlists
'1159103323018891264' //test
];
if(!channelWhitelist.includes(reaction.message.channel.id)) {
return;
}
let title = 'Unknown';
if(reaction.message.author.id == "816228963285860373") {
title = reaction.message.embeds[0].title;
} else {
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
title = reaction.message.content.split("\n")[0];
}
if(title.startsWith('https://')) {
title = `<${title}>`;
}
await reaction.message.channel.send({
content: `${user.displayName} rated **${title}** with ${reaction._emoji.toString()}`,
reply: { messageReference: reaction.message.id }
});
},
};