1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 16:30:59 -04:00
Daggerbot-TS/src/commands/addBannedWord.ts
2022-12-03 01:52:26 +11:00

20 lines
1.0 KiB
TypeScript

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, 'admin')
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')
.setDMPermission(false)
.addStringOption((opt)=>opt
.setName('word')
.setDescription('What word do you want automod to ban?')
.setRequired(true))
}