Make --remove work withtout having to provide the response args

This commit is contained in:
loicbersier 2019-11-20 18:15:24 +01:00
parent 11e50470cc
commit a7f549dcd9

View file

@ -16,18 +16,15 @@ class TagCommand extends Command {
start: 'What word or sentence should trigger it?', start: 'What word or sentence should trigger it?',
} }
}, },
{
id: 'response',
type: 'string',
match: 'rest',
prompt: {
start: 'What word or sentence should the response be?',
}
},
{ {
id: 'remove', id: 'remove',
match: 'flag', match: 'flag',
flag: '--remove' flag: '--remove'
},
{
id: 'response',
type: 'string',
match: 'rest',
} }
], ],
channelRestriction: 'guild', channelRestriction: 'guild',
@ -55,6 +52,10 @@ class TagCommand extends Command {
} }
} }
if (!args.response) {
return message.channel.send('Please provide the response for that tag');
}
if (!tag) { if (!tag) {
const body = {trigger: args.trigger, response: args.response, ownerID: message.author.id, serverID: message.guild.id}; const body = {trigger: args.trigger, response: args.response, ownerID: message.author.id, serverID: message.guild.id};
await Tag.create(body); await Tag.create(body);