1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-30 00:50:59 -04:00
Daggerbot-TS/src/commands/addBannedWord.ts

18 lines
1007 B
TypeScript
Raw Normal View History

2022-11-18 22:23:33 -05:00
import Discord,{SlashCommandBuilder} from 'discord.js';
import { TClient } from 'src/client';
export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
if (!client.isStaff(interaction.member) && !client.config.eval.whitelist.includes(interaction.member.id)) return client.youNeedRole(interaction, 'dcmod')
const word = interaction.options.getString('word');
if (client.bannedWords._content.includes(word)) return interaction.reply({content: 'That word is already added to the list.', ephemeral: true});
client.bannedWords.addData(word).forceSave();
interaction.reply(`Successfully added \`${word}\` to the list.`)
},
data: new SlashCommandBuilder()
.setName('addbannedword')
.setDescription('Add a word to bannedWords file')
.addStringOption((opt)=>opt
.setName('word')
.setDescription('What word do you want automod to ban?')
.setRequired(true))
}