better error handling, added chant command

This commit is contained in:
Marcus Netz
2021-04-28 15:50:02 +02:00
parent f5c485fdcc
commit d29e04a103
11 changed files with 228 additions and 44 deletions

View File

@ -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); //?+
};
/*