Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik K committed Nov 28, 2023
2 parents 1d6d97e + 48697ac commit 27c12e0
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@sentry/node": "^7.80.1",
"@top-gg/sdk": "^3.1.5",
"axios": "^1.6.2",
"canvabase": "^1.1.1",
"chalk-advanced": "^1.0.3",
"cron": "^3.1.6",
"cryptr": "^6.3.0",
Expand All @@ -65,4 +66,4 @@
"tslib": "^2.6.2",
"typescript": "^5.2.2"
}
}
}
106 changes: 106 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/buttons/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const button: Button = {
user: interaction.user.id,
timeout: 180000,
client,
image: null,
});

page.add(
Expand Down
69 changes: 69 additions & 0 deletions src/commands/game/leaderboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {
EmbedBuilder,
SlashCommandBuilder,
ActionRowBuilder,
ButtonBuilder,
MessageActionRowComponentBuilder,
bold,
} from "discord.js";
import { captureException } from "@sentry/node";
import { ChatInputCommand } from "../../models";
import Paginator from "../../util/pagination";
import { UserModel } from "../../util/Models/userModel";
import Canvas from "canvabase";

const command: ChatInputCommand = {
requireGuild: true,
data: new SlashCommandBuilder()
.setName("leaderboard")
.setDescription("Leaderboard statistics for games")
.setDMPermission(false)
.setDescriptionLocalizations({
de: "Test",
"es-ES": "Test",
fr: "Test",
})
.addStringOption((option) =>
option
.setName("game")
.setDescription("Which game do you want leaderboards from?")
.addChoices({ name: "Higher & Ligher", value: "higherlower" })
.setRequired(true),
)
.addStringOption((option) =>
option
.setName("for")
.setDescription("Pick what type of leaderboard you want to view")
.addChoices(
{ name: "Global", value: "global" },
{ name: "Local", value: "local" },
)
.setRequired(true),
),

/**
* @param {CommandInteraction} interaction
* @param {WouldYou} client
* @param {guildModel} guildDb
*/
execute: async (interaction, client, guildDb) => {
switch (interaction.options.getString("game")) {
case "higherlower":
const page = new Paginator({
user: interaction.user.id,
timeout: 180000,
client,
image: null,
});

const users = await UserModel.find({
"higherlower.highscore": { $gt: 1 },
});


break;
}
},
};

export default command;
1 change: 1 addition & 0 deletions src/commands/settings/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ const command: ChatInputCommand = {
user: interaction.user.id,
timeout: 180000,
client,
image: null,
});

if (
Expand Down
4 changes: 4 additions & 0 deletions src/util/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ export default class Paginator {
private user: any;
private page: number;
private timeout: number;
private image: string | null;

constructor({
user,
client,
timeout,
image,
}: {
user: any;
client: WouldYou;
timeout: number;
image: string | null;
}) {
this.pages = [];
this.client = client;
this.user = user;
this.page = 0;
this.timeout = timeout;
this.image = image;
}

add(page: EmbedBuilder) {
Expand Down

0 comments on commit 27c12e0

Please sign in to comment.