Vylpes
e6c845e3b2
Some checks failed
continuous-integration/drone/push Build is failing
- Switch to TypeORM's DataSource API, rather than using the now deprecated ormconfig.json - This will fix stage deployment not knowing how to deploy the database migrations #297 > **NOTE:** This change requires the deployment scripts to be updated, please update them on the server before merging Co-authored-by: Ethan Lane <ethan@vylpes.com> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/299
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
|
|
import Server from "../database/entities/Server";
|
|
import { Command } from "../type/command";
|
|
|
|
export default class Setup extends Command {
|
|
constructor() {
|
|
super();
|
|
|
|
super.CommandBuilder = new SlashCommandBuilder()
|
|
.setName('setup')
|
|
.setDescription('Makes the server ready to be configured')
|
|
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
|
|
}
|
|
|
|
public override async execute(interaction: CommandInteraction) {
|
|
if (!interaction.guildId) return;
|
|
|
|
const server = await Server.FetchOneById(Server, interaction.guildId);
|
|
|
|
if (server) {
|
|
await interaction.reply('This server has already been setup, please configure using the config command.');
|
|
return;
|
|
}
|
|
|
|
const newServer = new Server(interaction.guildId);
|
|
|
|
await newServer.Save(Server, newServer);
|
|
|
|
await interaction.reply('Success, please configure using the configure command.');
|
|
}
|
|
} |