owner command
parent
b435d1a72b
commit
98ea70d35b
@ -0,0 +1,22 @@
|
||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import dotenv from 'dotenv';
|
||||
import process from 'node:process';
|
||||
dotenv.config();
|
||||
const { ownerId } = process.env;
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('die')
|
||||
.setDescription('Kill the bot'),
|
||||
async execute(interaction) {
|
||||
if (interaction.user.id !== ownerId) {
|
||||
return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
|
||||
}
|
||||
console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m');
|
||||
await interaction.reply({ content: 'Good bye', ephemeral: true })
|
||||
.then(() => {
|
||||
console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m');
|
||||
process.exit(1);
|
||||
});
|
||||
},
|
||||
};
|
@ -0,0 +1,18 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { REST } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
require('dotenv').config();
|
||||
const { clientId, guildId, token } = process.env;
|
||||
|
||||
const commands = [
|
||||
new SlashCommandBuilder()
|
||||
.setName('die')
|
||||
.setDescription('Kill the bot'),
|
||||
]
|
||||
.map(command => command.toJSON());
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(token);
|
||||
|
||||
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
|
||||
.then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`))
|
||||
.catch(console.error);
|
Loading…
Reference in New Issue