-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremove.js
More file actions
23 lines (18 loc) · 821 Bytes
/
remove.js
File metadata and controls
23 lines (18 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module.exports = {
name: 'remove',
description: 'Remove a move from your dragon.',
async execute(context) {
const { args, player, reply } = context;
const moveName = args.join(' ').toLowerCase();
if (!moveName) return reply('Please specify the name of the move to remove.');
if (player.party.length === 0) return reply('You have no dragons in your party.');
const dragon = player.party[0];
const moveIndex = dragon.moves.findIndex(m => m.name.toLowerCase() === moveName);
if (moveIndex === -1) {
return reply(`${dragon.name} does not know the move ${moveName}.`);
}
const [removedMove] = dragon.moves.splice(moveIndex, 1);
require('../database/index').saveDb();
await reply(`You have removed the move ${removedMove.name} from your ${dragon.name}.`);
},
};