Fixed Style issues

pull/51/head
Trivernis 6 years ago
parent 5114228134
commit 3ae7fbc6fa

@ -2,6 +2,10 @@ const cmdLib = require('../../CommandLib'),
anilistApi = require('../../api/AnilistApi'), anilistApi = require('../../api/AnilistApi'),
location = './lib/commands/AnilistApiCommands'; location = './lib/commands/AnilistApiCommands';
/**
* The AniList commands are all commands that interact with the anilist api.
*/
/** /**
* Returns a string for a name. * Returns a string for a name.
* @param nameNode {String} The AniList name node in format {first, last, native} * @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) if (mediaInfo.endDate && mediaInfo.endDate.day)
fields['End Date'] = `${mediaInfo.endDate.day}.${mediaInfo.endDate.month}.${mediaInfo.endDate.year}`; 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) { if (mediaInfo.staff && mediaInfo.staff.edges) {
let staffContent = mediaInfo.staff.edges.map((x) => { let staffContent = mediaInfo.staff.edges.map((x) => {
let url = x.node.siteUrl; let url = x.node.siteUrl;
@ -83,7 +93,6 @@ class RichMediaInfo extends cmdLib.ExtendedRichEmbed {
fields['Staff'] = staffFieldValue; fields['Staff'] = staffFieldValue;
} }
} }
this.addFields(fields); this.addFields(fields);
} }
} }
@ -269,7 +278,7 @@ class AniListCommandModule extends cmdLib.CommandModule {
else else
characterData = await anilistApi.searchCharacterByName(s); characterData = await anilistApi.searchCharacterByName(s);
this._logger.silly(`Character Query returned ${JSON.stringify(characterData)}`); this._logger.silly(`Character Query returned ${JSON.stringify(characterData)}`);
return new RichCharacterInfo(characterData) return new RichCharacterInfo(characterData);
} catch (err) { } catch (err) {
if (err.message) { if (err.message) {
this._logger.verbose(err.message); this._logger.verbose(err.message);

@ -76,7 +76,7 @@ class ModuleLogger {
constructor(moduleInstance) { constructor(moduleInstance) {
this.logger = logger; this.logger = logger;
if (moduleInstance.constructor) { if (moduleInstance.constructor)
switch (moduleInstance.constructor.name) { switch (moduleInstance.constructor.name) {
case 'String': case 'String':
this.logName = moduleInstance; this.logName = moduleInstance;
@ -87,9 +87,9 @@ class ModuleLogger {
default: default:
this.logName = moduleInstance.constructor.name; this.logName = moduleInstance.constructor.name;
} }
} else { else
this.logName = moduleInstance.toString(); this.logName = moduleInstance.toString();
}
} }
silly(msg, meta) { silly(msg, meta) {

Loading…
Cancel
Save