21 lines
No EOL
871 B
TypeScript
21 lines
No EOL
871 B
TypeScript
import { SlashCommandBuilder, APIApplicationCommandOptionChoice, SlashCommandStringOption } from "discord.js";
|
|
import IConfig from './config.js';
|
|
import { readFileSync } from "fs";
|
|
const config : IConfig = JSON.parse(readFileSync('./config.json', 'utf8'));
|
|
|
|
const Commands = [
|
|
new SlashCommandBuilder()
|
|
.setName('connect')
|
|
.setDescription('Connect the bot to the specified VM')
|
|
.addStringOption(option => {
|
|
option.setName('vm');
|
|
option.setDescription('The QEMU instance to connect to');
|
|
option.setRequired(true);
|
|
config.VMs.forEach(vm => option.addChoices({name: vm.name, value: vm.name}));
|
|
return option;
|
|
}).toJSON(),
|
|
new SlashCommandBuilder()
|
|
.setName('disconnect')
|
|
.setDescription('Leave the voice channel'),
|
|
];
|
|
export default Commands; |