mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Add webhook notification in add/remove commands
This commit is contained in:
parent
19b7094051
commit
caa4cd829b
@ -1,5 +1,6 @@
|
|||||||
import Discord from 'discord.js';
|
import Discord from 'discord.js';
|
||||||
import TClient from '../client.js';
|
import TClient from '../client.js';
|
||||||
|
import HookMgr from '../components/HookManager.js';
|
||||||
import MessageTool from '../helpers/MessageTool.js';
|
import MessageTool from '../helpers/MessageTool.js';
|
||||||
export default class ProhibitedWords {
|
export default class ProhibitedWords {
|
||||||
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
@ -22,6 +23,14 @@ export default class ProhibitedWords {
|
|||||||
else {
|
else {
|
||||||
await client.prohibitedWords.insertWord(word);
|
await client.prohibitedWords.insertWord(word);
|
||||||
interaction.reply({ephemeral: true, content: `Successfully added \`${word}\` to the list`});
|
interaction.reply({ephemeral: true, content: `Successfully added \`${word}\` to the list`});
|
||||||
|
await this.notify(client, {
|
||||||
|
embeds: [new client.embed()
|
||||||
|
.setColor(client.config.embedColorGreen)
|
||||||
|
.setDescription(`**${interaction.user.tag}** has added \`${word}\` to the list`)
|
||||||
|
.setFooter({text: `Total: ${(await client.prohibitedWords.getAllWords()).length}`})
|
||||||
|
.setAuthor({name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({size: 2048})})
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove: async()=>{
|
remove: async()=>{
|
||||||
@ -29,6 +38,14 @@ export default class ProhibitedWords {
|
|||||||
else {
|
else {
|
||||||
await client.prohibitedWords.removeWord(word);
|
await client.prohibitedWords.removeWord(word);
|
||||||
interaction.reply({ephemeral: true, content: `Successfully removed \`${word}\` from the list`});
|
interaction.reply({ephemeral: true, content: `Successfully removed \`${word}\` from the list`});
|
||||||
|
await this.notify(client, {
|
||||||
|
embeds: [new client.embed()
|
||||||
|
.setColor(client.config.embedColorRed)
|
||||||
|
.setDescription(`**${interaction.user.tag}** has removed \`${word}\` from the list`)
|
||||||
|
.setFooter({text: `Total: ${(await client.prohibitedWords.getAllWords()).length}`})
|
||||||
|
.setAuthor({name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({size: 2048})})
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
import: async()=>{
|
import: async()=>{
|
||||||
@ -40,6 +57,9 @@ export default class ProhibitedWords {
|
|||||||
}
|
}
|
||||||
} as any)[interaction.options.getSubcommand()]();
|
} as any)[interaction.options.getSubcommand()]();
|
||||||
}
|
}
|
||||||
|
private static async notify(client:TClient, message:Discord.MessageCreateOptions) {
|
||||||
|
return new HookMgr(client, 'pw_list', '1193424631059714128').send(message);
|
||||||
|
}
|
||||||
static data = new Discord.SlashCommandBuilder()
|
static data = new Discord.SlashCommandBuilder()
|
||||||
.setName('pw')
|
.setName('pw')
|
||||||
.setDescription('Manage the database of prohibited words')
|
.setDescription('Manage the database of prohibited words')
|
||||||
|
@ -84,7 +84,8 @@
|
|||||||
"punishment_log": "1102751034754998302",
|
"punishment_log": "1102751034754998302",
|
||||||
"dcmod_chat": "742324777934520350",
|
"dcmod_chat": "742324777934520350",
|
||||||
"mpmod_chat": "516344221452599306",
|
"mpmod_chat": "516344221452599306",
|
||||||
"multifarm_chat": "1149238561934151690"
|
"multifarm_chat": "1149238561934151690",
|
||||||
|
"pw_list": "1193424588554645505"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1
src/interfaces.d.ts
vendored
1
src/interfaces.d.ts
vendored
@ -159,6 +159,7 @@ export interface Config {
|
|||||||
dcmod_chat: string,
|
dcmod_chat: string,
|
||||||
mpmod_chat: string,
|
mpmod_chat: string,
|
||||||
multifarm_chat: string
|
multifarm_chat: string
|
||||||
|
pw_list: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user