Skip to content

Commit

Permalink
fixe empty ladders
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Oct 21, 2023
1 parent e5499d1 commit 483ca91
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/namespaces/ladder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ export class Ladder<Line extends LadderLine> {
return lines.map(this.options.formatLine).join("\n")
}

async fetchEmbed(options: LadderPaginatorOptions) {
async fetchEmbed(
ctx: { client: discord.Client },
options: LadderPaginatorOptions
) {
return new discord.MessageEmbed()
.setTitle(`${this.options.title} leaderboard`)
.setDescription(await this.fetchPage(options))
.setDescription(
(await this.fetchPage(options)) ||
`${tools.emote(ctx, "DENY")} No ladder available`
)
.setFooter({
text: `Page: ${options.pageIndex + 1} / ${await this.fetchPageCount(
options
Expand Down Expand Up @@ -71,7 +77,7 @@ export class Ladder<Line extends LadderLine> {
if (page.length === 0)
return `${tools.emote(channel, "DENY")} No ladder available.`

return await this.fetchEmbed({
return await this.fetchEmbed(channel, {
pageIndex,
...options,
})
Expand Down

0 comments on commit 483ca91

Please sign in to comment.