(fix) !spells and !chants returned null value (#40)
This commit is contained in:
@ -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'));
|
||||
|
@ -5,9 +5,10 @@ const { db } = require('../globals');
|
||||
const { Werte } = require('../globals');
|
||||
|
||||
function printHeader(attributes) {
|
||||
if (!attributes) return null;
|
||||
return `${''.padStart(31)}${attributes
|
||||
.map(a => `${a.Short}`.padEnd(4).padStart(6))
|
||||
.join('|')}\n`;
|
||||
.join('|')}\n`.toString();
|
||||
}
|
||||
function listStats(attributes) {
|
||||
return `${attributes.map(a => `${a.Level}`.padEnd(4).padStart(6)).join('|')}\n`;
|
||||
|
@ -22,7 +22,7 @@ const createSpellList = (Character = {}) => {
|
||||
Character.spells.forEach(spell =>
|
||||
SpellList.push(getSpell({ Character: Character, spell_name: spell.id }))
|
||||
);
|
||||
return SpellList.filter(value => value !== undefined); //?+
|
||||
return SpellList.filter(value => value !== undefined && value !== null); //?+
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
Reference in New Issue
Block a user