mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Starboard
This commit is contained in:
@@ -7,6 +7,7 @@ const client = new CommandoClient({
|
||||
invite: INVITE,
|
||||
unknownCommandResponse: false
|
||||
});
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const path = require('path');
|
||||
const { carbon, dBots } = require('./structures/Stats');
|
||||
const SequelizeProvider = require('./providers/Sequelize');
|
||||
@@ -96,6 +97,23 @@ client.on('message', async (msg) => {
|
||||
} else return;
|
||||
});
|
||||
|
||||
client.on('messageReactionAdd', (reaction, user) => {
|
||||
if (reaction.emoji.name !== '⭐') return;
|
||||
if (reaction.count > 1) return;
|
||||
if (user.bot) return;
|
||||
const msg = reaction.message;
|
||||
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
|
||||
if (!channel) return;
|
||||
if (!channel.permissionsFor(client.user).has(['SEND_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xFFFF00)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setDescription(msg.content)
|
||||
.setImage(msg.attachments.first() ? msg.attachments.first().url : null)
|
||||
.setFooter(msg.createdAt);
|
||||
return channel.send({ embed });
|
||||
});
|
||||
|
||||
client.dispatcher.addInhibitor(msg => {
|
||||
if (msg.channel.type === 'dm') return false;
|
||||
const role = msg.guild.settings.get('singleRole');
|
||||
|
||||
Reference in New Issue
Block a user