1 |
#!/bin/ts-node |
#!/bin/node |
2 |
|
|
3 |
import { SlashCommandBuilder } from '@discordjs/builders'; |
const { SlashCommandBuilder } = require('@discordjs/builders'); |
4 |
import { REST } from '@discordjs/rest'; |
const { REST } = require('@discordjs/rest'); |
5 |
import { Routes } from 'discord-api-types/v9'; |
const { Routes } = require('discord-api-types/v9'); |
6 |
import { config } from 'dotenv'; |
const { config } = require('dotenv'); |
7 |
import { existsSync } from 'fs'; |
const { existsSync } = require('fs'); |
8 |
import path from 'path'; |
const path = require('path'); |
9 |
|
|
10 |
if (existsSync(path.join(__dirname, '.env'))) { |
if (existsSync(path.join(__dirname, '.env'))) { |
11 |
config(); |
config(); |
22 |
.addStringOption(option => option.setName('command').setDescription("The command")), |
.addStringOption(option => option.setName('command').setDescription("The command")), |
23 |
new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'), |
new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'), |
24 |
new SlashCommandBuilder().setName('system').setDescription('Show the system status'), |
new SlashCommandBuilder().setName('system').setDescription('Show the system status'), |
25 |
|
new SlashCommandBuilder().setName('restart').setDescription('Restart the system'), |
26 |
|
|
27 |
// INFORMATION |
// INFORMATION |
28 |
new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'), |
new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'), |
30 |
.addUserOption(option => option.setName('user').setDescription('The user')), |
.addUserOption(option => option.setName('user').setDescription('The user')), |
31 |
new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar') |
new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar') |
32 |
.addUserOption(option => option.setName('user').setDescription('The user')), |
.addUserOption(option => option.setName('user').setDescription('The user')), |
33 |
|
new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role') |
34 |
|
.addUserOption(option => option.setName('role').setDescription('The role')), |
35 |
|
|
36 |
// AUTOMATION |
// AUTOMATION |
37 |
|
new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine') |
38 |
|
.addSubcommand(subcommand => |
39 |
|
subcommand |
40 |
|
.setName('create') |
41 |
|
.setDescription('Send a ballot/poll message for collecting votes') |
42 |
|
.addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true)) |
43 |
|
.addBooleanOption(option => option.setName('anonymous').setDescription('If this is set to true then the syetem won\'t show your username')) |
44 |
|
.addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent'))) |
45 |
|
.addSubcommand(subcommand => |
46 |
|
subcommand |
47 |
|
.setName('view') |
48 |
|
.setDescription('Get information/stats about a ballot') |
49 |
|
.addIntegerOption(option => option.setName('id').setDescription('The ballot ID'))), |
50 |
|
|
51 |
new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'), |
new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'), |
52 |
|
|
53 |
new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later') |
new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later') |
139 |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning this user")) |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning this user")) |
140 |
.addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)), |
.addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)), |
141 |
|
|
142 |
|
new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users') |
143 |
|
.addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true)) |
144 |
|
.addStringOption(option => option.setName('reason').setDescription("The reason for banning")) |
145 |
|
.addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of these users").setMinValue(0).setMaxValue(7)), |
146 |
|
|
147 |
new SlashCommandBuilder().setName('kick').setDescription('Kick a member') |
new SlashCommandBuilder().setName('kick').setDescription('Kick a member') |
148 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
149 |
.addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")), |
.addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")), |
222 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
223 |
].map(command => command.toJSON()); |
].map(command => command.toJSON()); |
224 |
|
|
225 |
const rest = new REST({ version: '9' }).setToken(TOKEN!); |
const rest = new REST({ version: '9' }).setToken(TOKEN); |
226 |
|
|
227 |
rest.put(Routes.applicationGuildCommands(CLIENT_ID!, GUILD_ID!), { body: commands }) |
rest.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), { body: commands }) |
228 |
.then(() => console.log('Successfully registered application commands.')) |
.then(() => console.log('Successfully registered application commands.')) |
229 |
.catch(console.error); |
.catch(console.error); |