mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 22:34:46 +02:00
Better status display for personal list
This commit is contained in:
@@ -67,6 +67,14 @@ const statuses = {
|
|||||||
NOT_YET_RELEASED: 'Unreleased',
|
NOT_YET_RELEASED: 'Unreleased',
|
||||||
CANCELLED: 'Cancelled'
|
CANCELLED: 'Cancelled'
|
||||||
};
|
};
|
||||||
|
const userStatuses = {
|
||||||
|
CURRENT: 'Watching',
|
||||||
|
PLANNING: 'Planning',
|
||||||
|
COMPLETED: 'Completed',
|
||||||
|
DROPPED: 'Dropped',
|
||||||
|
PAUSED: 'Paused',
|
||||||
|
REPEATING: 'Rewatching'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = class AnimeCommand extends Command {
|
module.exports = class AnimeCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -113,9 +121,9 @@ module.exports = class AnimeCommand extends Command {
|
|||||||
.addField('❯ Episodes', anime.episodes || '???', true)
|
.addField('❯ Episodes', anime.episodes || '???', true)
|
||||||
.addField('❯ Season', anime.season ? `${seasons[anime.season]} ${anime.startDate.year}` : '???', true)
|
.addField('❯ Season', anime.season ? `${seasons[anime.season]} ${anime.startDate.year}` : '???', true)
|
||||||
.addField('❯ Average Score', anime.meanScore ? `${anime.meanScore}/100` : '???', true)
|
.addField('❯ Average Score', anime.meanScore ? `${anime.meanScore}/100` : '???', true)
|
||||||
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true)
|
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '?/10', true)
|
||||||
.addField(`❯ ${ANILIST_USERNAME}'s Progress`,
|
.addField(`❯ ${ANILIST_USERNAME}'s Progress`,
|
||||||
entry && entry.progress ? `${entry.progress}/${anime.episodes || ''}` : '???', true);
|
entry && entry.status ? userStatuses[entry.status] : 'Not Planned', true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
@@ -161,12 +169,8 @@ module.exports = class AnimeCommand extends Command {
|
|||||||
query: personalGraphQL
|
query: personalGraphQL
|
||||||
});
|
});
|
||||||
const { lists } = body.data.MediaListCollection;
|
const { lists } = body.data.MediaListCollection;
|
||||||
this.personalList = [
|
this.personalList = [];
|
||||||
...lists.find(list => list.name === 'Watching').entries,
|
for (const list of Object.values(lists)) this.personalList.push(...list.entries);
|
||||||
...lists.find(list => list.name === 'Completed').entries
|
|
||||||
];
|
|
||||||
const rewatching = lists.find(list => list.name === 'Rewatching');
|
|
||||||
if (rewatching) this.personalList.push(...rewatching.entries);
|
|
||||||
setTimeout(() => { this.personalList = null; }, 3.6e+6);
|
setTimeout(() => { this.personalList = null; }, 3.6e+6);
|
||||||
return this.personalList;
|
return this.personalList;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user