mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
const commando = require('discord.js-commando');
|
|
const Discord = require('discord.js');
|
|
|
|
module.exports = class EmbedCommand extends commando.Command {
|
|
constructor(Client) {
|
|
super(Client, {
|
|
name: 'embed',
|
|
group: 'textedit',
|
|
memberName: 'embed',
|
|
description: 'Sends a message in an embed. (;embed This is an example.)',
|
|
examples: [';embed This is an example.'],
|
|
guildOnly: true,
|
|
args: [{
|
|
key: 'text',
|
|
prompt: 'What text would you like to embed?',
|
|
type: 'string'
|
|
}]
|
|
});
|
|
}
|
|
|
|
async run(message, args) {
|
|
if (message.channel.type !== 'dm') {
|
|
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
|
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
|
if (!message.channel.permissionsFor(this.client.user).hasPermission('MANAGE_MESSAGES')) return message.say(':x: Error! I don\'t have the Manage Messages Permission!');
|
|
}
|
|
console.log(`[Command] ${message.content}`);
|
|
const embedMessage = args.text;
|
|
const embed = new Discord.RichEmbed()
|
|
.setAuthor(message.author.username, message.author.avatarURL)
|
|
.setColor(0x00AE86)
|
|
.setTimestamp()
|
|
.setDescription(embedMessage);
|
|
await message.delete();
|
|
return message.embed(embed);
|
|
}
|
|
};
|