|
|
|
@ -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);
|
|
|
|
|