use sayd and not --del

This commit is contained in:
loicbersier 2019-11-25 21:53:19 +01:00
parent b756a08202
commit 425304646a

View file

@ -1,12 +1,13 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const rand = require('../../rand.js'); const rand = require('../../rand.js');
class SayCommand extends Command { class SayCommand extends Command {
constructor() { constructor() {
super('say', { super('say', {
aliases: ['say'], aliases: ['say', 'sayd'],
category: 'general', category: 'general',
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'], clientPermissions: ['SEND_MESSAGES', 'MANAGE_MESSAGES'],
args: [ args: [
{ {
id: 'text', id: 'text',
@ -15,15 +16,10 @@ class SayCommand extends Command {
start: 'Write something so i can say it back', start: 'Write something so i can say it back',
}, },
match: 'rest' match: 'rest'
},
{
id: 'delete',
match: 'flag',
flag: ['--del', '--delete', '-d']
} }
], ],
description: { description: {
content: 'Repeat what you say, (Use "-d" to delete the message you sent) [Click here to see the complete list of "tag"](https://cdn.discordapp.com/attachments/502198809355354133/561043193949585418/unknown.png)', content: 'Repeat what you say, (Use sayd to delete your message) [Click here to see the complete list of "tag"](https://cdn.discordapp.com/attachments/502198809355354133/561043193949585418/unknown.png)',
usage: '[text]', usage: '[text]',
examples: ['[member] is a big [adverbs] [verbs]'] examples: ['[member] is a big [adverbs] [verbs]']
} }
@ -129,7 +125,7 @@ class SayCommand extends Command {
} }
} }
const embed = this.client.util.embed() const embed = new MessageEmbed()
.setColor(color) .setColor(color)
.setTitle(title) .setTitle(title)
.setImage(image) .setImage(image)
@ -151,11 +147,11 @@ class SayCommand extends Command {
// Send the final text // Send the final text
if (attach) { if (attach) {
if (args.delete) if (message.util.parsed.alias == 'sayd')
message.delete(); message.delete();
return message.channel.send(text, {files: [attach]}); return message.channel.send(text, {files: [attach]});
} else { } else {
if (args.delete) if (message.util.parsed.alias == 'sayd')
message.delete(); message.delete();
return message.channel.send(text); return message.channel.send(text);
} }