better error handling, added chant command
This commit is contained in:
@ -16,6 +16,7 @@ module.exports = {
|
||||
return message.reply(findMessage('NOENTRY'));
|
||||
}
|
||||
Character = docs[0].character;
|
||||
if (!Character.hasOwnProperty('spells')) return message.reply(findMessage('NO_SPELLS'));
|
||||
if (args.length === 0) {
|
||||
return message.reply(ReplySpellList(createSpellList(Character)));
|
||||
}
|
||||
@ -45,7 +46,9 @@ const ReplySpell = (Spell = {}) => {
|
||||
const createSpellList = (Character = {}) => {
|
||||
if (!Character || !Character.hasOwnProperty('spells')) return;
|
||||
let SpellList = [];
|
||||
Character.spells.forEach(spell => SpellList.push(getSpell({ Character: Character, spell_name: spell.id })));
|
||||
Character.spells.forEach(spell =>
|
||||
SpellList.push(getSpell({ Character: Character, spell_name: spell.id }))
|
||||
);
|
||||
return SpellList.filter(value => value !== undefined); //?+
|
||||
};
|
||||
/*
|
||||
|
Reference in New Issue
Block a user