Bugfix and formatting improvements
This commit is contained in:
parent
092856138c
commit
18fa150075
@ -167,7 +167,7 @@ class MusicLibrary implements Initialisable
|
|||||||
|
|
||||||
countSkip (name: string)
|
countSkip (name: string)
|
||||||
{
|
{
|
||||||
this.#countStat(name, 'skip');
|
this.#countStat(name, 'skips');
|
||||||
}
|
}
|
||||||
|
|
||||||
resetStats ()
|
resetStats ()
|
||||||
|
@ -35,7 +35,7 @@ class QueueCommand extends Command
|
|||||||
if (!queue.length)
|
if (!queue.length)
|
||||||
return 'Queue empty';
|
return 'Queue empty';
|
||||||
return `
|
return `
|
||||||
**Music queue:**\n${queue.map(entry => `\t\\- **${entry.title}** by ${entry.artist}`).join('\n')}
|
**Music queue:**\n\`\`\`${queue.map(entry => `\t\\- **${entry.title}** by ${entry.artist}`).join('\n')}\`\`\`
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class SearchCommand extends Command
|
|||||||
if (!results.length)
|
if (!results.length)
|
||||||
return 'No results found';
|
return 'No results found';
|
||||||
return `
|
return `
|
||||||
**Search results:**\n${results.map(result => `\t\\- [id: ${result.id}] **${result.title}** - ${result.artist} (Album: ${result.album ?? 'Unknown'}) [${result.year ?? 'Unknown year'}]`).join('\n')}
|
**Search results:**\n\`\`\`${results.map(result => `\t\\- [id: ${result.id}] **${result.title}** - ${result.artist} (Album: ${result.album ?? 'Unknown'}) [${result.year ?? 'Unknown year'}]`).join('\n')}\`\`\`
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,10 @@ class StatsCommand extends Command
|
|||||||
async execute (_message: Message, { args }: CommandOpts)
|
async execute (_message: Message, { args }: CommandOpts)
|
||||||
{
|
{
|
||||||
if (args.reset?.value)
|
if (args.reset?.value)
|
||||||
|
{
|
||||||
this.client.musicPlayer.library.resetStats();
|
this.client.musicPlayer.library.resetStats();
|
||||||
|
return 'Stats reset';
|
||||||
|
}
|
||||||
const { stats } = this.client.musicPlayer.library;
|
const { stats } = this.client.musicPlayer.library;
|
||||||
const mostPlayed = stats.sort((a, b) => b.plays - a.plays).slice(0, 10);
|
const mostPlayed = stats.sort((a, b) => b.plays - a.plays).slice(0, 10);
|
||||||
const mostSkipped = stats.sort((a, b) => b.skips - a.skips).slice(0, 10);
|
const mostSkipped = stats.sort((a, b) => b.skips - a.skips).slice(0, 10);
|
||||||
@ -41,7 +44,7 @@ class StatsCommand extends Command
|
|||||||
const top10Plays = mostPlayed.map(mapper).join('\n');
|
const top10Plays = mostPlayed.map(mapper).join('\n');
|
||||||
stat = 'skips';
|
stat = 'skips';
|
||||||
const top10Skips = mostSkipped.map(mapper).join('\n');
|
const top10Skips = mostSkipped.map(mapper).join('\n');
|
||||||
return `**Music statistics**\n\nMost played:\n${top10Plays}\n\nMost skipped:\n${top10Skips}`;
|
return `**Music statistics**\n\nMost played:\n\`\`\`${top10Plays}\`\`\`\n\nMost skipped:\n\`\`\`${top10Skips}\`\`\``;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user