diff --git a/lib/commands/AnilistApiCommands/index.js b/lib/commands/AnilistApiCommands/index.js index 97a431d..d66ee42 100644 --- a/lib/commands/AnilistApiCommands/index.js +++ b/lib/commands/AnilistApiCommands/index.js @@ -2,6 +2,10 @@ const cmdLib = require('../../CommandLib'), anilistApi = require('../../api/AnilistApi'), location = './lib/commands/AnilistApiCommands'; +/** + * The AniList commands are all commands that interact with the anilist api. + */ + /** * Returns a string for a name. * @param nameNode {String} The AniList name node in format {first, last, native} @@ -56,6 +60,12 @@ class RichMediaInfo extends cmdLib.ExtendedRichEmbed { } if (mediaInfo.endDate && mediaInfo.endDate.day) fields['End Date'] = `${mediaInfo.endDate.day}.${mediaInfo.endDate.month}.${mediaInfo.endDate.year}`; + this.addStaffInfo(mediaInfo); + this.addFields(fields); + } + + addStaffInfo(mediaInfo) { + let fields = {}; if (mediaInfo.staff && mediaInfo.staff.edges) { let staffContent = mediaInfo.staff.edges.map((x) => { let url = x.node.siteUrl; @@ -83,7 +93,6 @@ class RichMediaInfo extends cmdLib.ExtendedRichEmbed { fields['Staff'] = staffFieldValue; } } - this.addFields(fields); } } @@ -269,7 +278,7 @@ class AniListCommandModule extends cmdLib.CommandModule { else characterData = await anilistApi.searchCharacterByName(s); this._logger.silly(`Character Query returned ${JSON.stringify(characterData)}`); - return new RichCharacterInfo(characterData) + return new RichCharacterInfo(characterData); } catch (err) { if (err.message) { this._logger.verbose(err.message); diff --git a/lib/logging.js b/lib/logging.js index 98166ef..6cfc1e2 100644 --- a/lib/logging.js +++ b/lib/logging.js @@ -76,7 +76,7 @@ class ModuleLogger { constructor(moduleInstance) { this.logger = logger; - if (moduleInstance.constructor) { + if (moduleInstance.constructor) switch (moduleInstance.constructor.name) { case 'String': this.logName = moduleInstance; @@ -87,9 +87,9 @@ class ModuleLogger { default: this.logName = moduleInstance.constructor.name; } - } else { + else this.logName = moduleInstance.toString(); - } + } silly(msg, meta) {