wynn/ts/src/bot/botevent/slash_commands.ts

46 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-03-01 21:10:31 +00:00
import { formGuildLeaderboardMessage, formGuildOnlineMessage } from "#/bot/common/guild"
import { WYNN_GUILD_ID } from "#/constants"
import { inject, injectable } from "@needle-di/core"
import { SlashHandler } from "./types"
import { PG } from "#/services/pg"
@injectable()
export class SlashCommandHandler {
constructor(
public readonly db = inject(PG)
) {
}
root(): SlashHandler {
return {
guild: {
info: async (interaction) => {
interaction.respond("TODO: guild info")
},
online: async (interaction) => {
const msg = await formGuildOnlineMessage(
WYNN_GUILD_ID,
this.db.sql,
)
await interaction.respond(msg, {
withResponse: true,
})
},
leaderboard: async (interaction) => {
const leaderboard = await formGuildLeaderboardMessage(
WYNN_GUILD_ID,
this.db.sql,
)
await interaction.respond(leaderboard, {
withResponse: true,
})
},
},
admin: {
set_wynn_guild: async (interaction) => {
},
}
}
}
}