35 lines
905 B
TypeScript
35 lines
905 B
TypeScript
import {
|
|
ChatInputCommandInteraction,
|
|
MessageFlags,
|
|
SlashCommandBuilder
|
|
} from 'discord.js';
|
|
import { Command } from '../../commands';
|
|
import { DatabaseManager } from '../../modules/db';
|
|
|
|
const builder = new SlashCommandBuilder()
|
|
.setName('tts-channel')
|
|
.setDescription('Sets the channel where TTS messages will be read from');
|
|
|
|
const cmd: Command = {
|
|
name: builder.name,
|
|
builder: builder,
|
|
|
|
execute: async (interaction: ChatInputCommandInteraction): Promise<void> => {
|
|
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
|
|
|
if (!interaction.guild) {
|
|
interaction.editReply('This message can only be executed on guilds');
|
|
return;
|
|
}
|
|
|
|
const guildData = await DatabaseManager.get.getGuild(interaction.guild.id);
|
|
|
|
await guildData.set('tts_channel', interaction.channelId);
|
|
await guildData.save();
|
|
|
|
interaction.editReply('TTS channel updated.');
|
|
}
|
|
};
|
|
|
|
export default cmd;
|