You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
import {adminId, SubcommandData} from "../types.js"
|
|
import {
|
|
ActivityType,
|
|
ApplicationCommandOptionType,
|
|
ApplicationCommandSubCommandData,
|
|
ChatInputCommandInteraction,
|
|
} from "discord.js"
|
|
import {wrappedRestart} from "../../ipc/restart.js"
|
|
|
|
class RestartCommand extends SubcommandData {
|
|
readonly definition: ApplicationCommandSubCommandData = {
|
|
name: "restart",
|
|
type: ApplicationCommandOptionType.Subcommand,
|
|
description: "Tells the bot to restart.",
|
|
}
|
|
|
|
async execute(b: ChatInputCommandInteraction): Promise<void> {
|
|
const user = b.user || b.member
|
|
if (!!user && user.id === adminId) {
|
|
await b.reply("Yaaaawwn... Okay... Just a quick nap then...")
|
|
const self = b.client.user
|
|
self.setPresence({
|
|
status: "idle",
|
|
afk: true,
|
|
activities: [
|
|
{
|
|
type: ActivityType.Listening,
|
|
name: "A New Day",
|
|
},
|
|
],
|
|
})
|
|
await wrappedRestart(b)
|
|
} else {
|
|
await b.reply("Heeey... I don't gotta do what you say...")
|
|
}
|
|
}
|
|
}
|
|
|
|
export const commandBotRestart = new RestartCommand() |