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