1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 11:20:19 +00:00
musix-oss/struct/funcs/exe.js

20 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-02-05 20:02:53 +00:00
module.exports = function (msg, args, client, Discord, prefix, command) {
const permissions = msg.channel.permissionsFor(msg.client.user);
2020-03-12 11:56:31 +00:00
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
if (!permissions.has('USE_EXTERNAL_EMOJIS')) return msg.channel.send(client.noPermsUseExternalEmojis);
2020-02-05 20:02:53 +00:00
try {
command.uses++;
command.execute(msg, args, client, Discord, prefix, command);
} catch (error) {
2020-03-11 15:49:31 +00:00
const date = new Date();
2020-03-12 11:56:31 +00:00
msg.reply(client.messages.errorExe);
2020-02-05 20:02:53 +00:00
const embed = new Discord.MessageEmbed()
.setTitle(`Musix ${error.toString()}`)
.setDescription(error.stack.replace(/at /g, '**at **'))
2020-03-13 20:31:04 +00:00
.setFooter(`guild: ${msg.guild.id} (${msg.guild.name}), user: ${msg.member.id} (${msg.member.displayName}), channel: ${msg.channel.id} (${msg.channel.name}), date: ${date}, Shard: ${client.shard.ids}`)
2020-02-05 20:02:53 +00:00
.setColor('#b50002');
2020-03-03 20:24:41 +00:00
client.debug_channel.send(embed);
2020-02-19 19:58:32 +00:00
console.error(error);
2020-02-05 20:02:53 +00:00
}
};