46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
|
|
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) => {
|
||
|
|
},
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|