diff options
author | Minteck <contact@minteck.org> | 2022-11-28 17:22:49 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-11-28 17:22:49 +0100 |
commit | 006ed0f2b6ba65f691551c18138bb38a1bef44b6 (patch) | |
tree | 9218625a3ce812e928489623b0673fdf1c964b7f /commands | |
parent | af9b870d6fae7af96fc5ecb7e6e595cdbe167b51 (diff) | |
download | cooler-pony-006ed0f2b6ba65f691551c18138bb38a1bef44b6.tar.gz cooler-pony-006ed0f2b6ba65f691551c18138bb38a1bef44b6.tar.bz2 cooler-pony-006ed0f2b6ba65f691551c18138bb38a1bef44b6.zip |
Diffstat (limited to 'commands')
-rw-r--r-- | commands/about.ts | 6 | ||||
-rw-r--r-- | commands/restart.ts | 37 |
2 files changed, 40 insertions, 3 deletions
diff --git a/commands/about.ts b/commands/about.ts index 96ba94a..01c826c 100644 --- a/commands/about.ts +++ b/commands/about.ts @@ -43,15 +43,15 @@ export class AboutCommand extends CommandBase { new MessageButton() .setLabel('Source Code') .setStyle('LINK') - .setURL("https://git.equestria.dev/equestria.dev/dj-pon-3"), + .setURL("https://git.equestria.dev/equestria.dev/cooler-pony"), new MessageButton() .setLabel('Roadmap') .setStyle('LINK') - .setURL("https://git.equestria.dev/equestria.dev/dj-pon-3/src/branch/mane/TODO.md"), + .setURL("https://git.equestria.dev/equestria.dev/cooler-pony/src/branch/mane/TODO.md"), new MessageButton() .setLabel('General Information') .setStyle('LINK') - .setURL("https://git.equestria.dev/equestria.dev/dj-pon-3/src/branch/mane/README.md"), + .setURL("https://git.equestria.dev/equestria.dev/cooler-pony/src/branch/mane/README.md"), ) ] }).then(() => { diff --git a/commands/restart.ts b/commands/restart.ts new file mode 100644 index 0000000..0f4bcfd --- /dev/null +++ b/commands/restart.ts @@ -0,0 +1,37 @@ +import {CommandBase} from "../core/CommandBase"; +import {SlashCommandBuilder} from "@discordjs/builders"; +import * as fs from 'fs'; +import {CommandAction} from "../core/CommandAction"; +import {MessageEmbed} from "discord.js"; + +export class RestartCommand extends CommandBase { + constructor() { + super(); + this.slashCommandData = new SlashCommandBuilder() + .setName("restart") + .setDescription("Restarts the bot") + } + + public handle(action: CommandAction) { + let interaction = action.getInteraction(); + + if (!interaction.memberPermissions.has("ADMINISTRATOR")) { + interaction.reply({ + embeds: [ + new MessageEmbed() + .setDescription(":x: You need to have the server administrator permission.") + ] + }); + return; + } + + interaction.reply({ + embeds: [ + new MessageEmbed() + .setDescription(":white_check_mark: The bot is now restarting") + ] + }).then(() => { + fs.writeFileSync("./RESTART-FORCE", ""); + }); + } +} |