mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Refactor CmdModule.ts
This commit is contained in:
parent
c43958d05d
commit
012f8d6eb2
@ -7,22 +7,20 @@ export default class CmdTrigger {
|
|||||||
return message.content.toLowerCase().startsWith(this.prefix+trigger)
|
return message.content.toLowerCase().startsWith(this.prefix+trigger)
|
||||||
}
|
}
|
||||||
static registerCmds(client:TClient, message:Message, trigger:string) {
|
static registerCmds(client:TClient, message:Message, trigger:string) {
|
||||||
if (this.SenseTrigger(message, trigger) && client.config.whitelist.includes(message.author.id)) {
|
if (!this.SenseTrigger(message, trigger) ?? !client.config.whitelist.includes(message.author.id)) return;
|
||||||
(client.guilds.cache.get(message.guildId) as Guild).commands.set(client.registry)
|
(client.guilds.cache.get(message.guildId) as Guild).commands.set(client.registry)
|
||||||
.then(()=>message.reply('Deployed the slash commands successfully!'))
|
.then(()=>message.reply('Deployed the slash commands successfully!'))
|
||||||
.catch(e=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
.catch(e=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
static MFPwTrigger(message:Message, trigger:string) {
|
static MFPwTrigger(message:Message, trigger:string) {
|
||||||
if (this.SenseTrigger(message, trigger)) {
|
if (!this.SenseTrigger(message, trigger)) return;
|
||||||
let passwordText = 'The farm password is ';
|
let passwordText = 'The farm password is ';
|
||||||
const mapping = {
|
const mapping = {
|
||||||
'1149138133514981386': 'koops',
|
'1149138133514981386': 'koops',
|
||||||
'1149138202662293555': 'junkers'
|
'1149138202662293555': 'junkers'
|
||||||
}
|
}
|
||||||
for (const [channelId, farmPw] of Object.entries(mapping)) {
|
for (const [channelId, farmPw] of Object.entries(mapping)) {
|
||||||
if (message.channelId === channelId) message.reply(passwordText += `\`${farmPw}\``);
|
if (message.channelId === channelId) message.reply(passwordText += `\`${farmPw}\``);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user