(fix) !spells and !chants returned null value (#40)

This commit is contained in:
2021-05-04 22:39:59 +02:00
committed by GitHub
parent 895f47847e
commit 4fa2dc7ab7
7 changed files with 56 additions and 7 deletions

View File

@ -11,7 +11,8 @@ const createChantList = (Character = {}) => {
Character.chants.forEach(chant =>
ChantList.push(getChant({ Character: Character, chant_name: chant.id }))
);
return ChantList.filter(value => value !== undefined);
console.log(ChantList);
return ChantList.filter(value => value !== undefined && value !== null);
};
const ReplyChantList = (ChantList = []) => {
@ -42,6 +43,7 @@ module.exports = {
if (isEmpty(doc)) {
return message.reply(findMessage('NOENTRY'));
}
console.log(doc.character);
const Character = doc.character;
if (!Character.hasOwnProperty('chants'))
return message.reply(findMessage('NO_CHANTS'));