1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 20:30:58 -05:00
Daggerbot-TS/src/funcs/CmdModule.ts

26 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-09-12 20:53:07 -04:00
import Discord from 'discord.js';
import TClient from '../client.js';
export default class CmdTrigger {
2023-09-19 03:15:26 -04:00
protected static SenseTrigger(message:Discord.Message, trigger:string) {
return message.content.toLowerCase().startsWith(trigger)
}
2023-09-12 20:53:07 -04:00
static registerCmds(client:TClient, message:Discord.Message, trigger:string) {
2023-09-19 03:15:26 -04:00
if (this.SenseTrigger(message, trigger) && client.config.whitelist.includes(message.author.id)) {
2023-09-12 20:53:07 -04:00
(client.guilds.cache.get(message.guildId) as Discord.Guild).commands.set(client.registry)
.then(()=>message.reply('How did you manage to lose the commands??? Anyways, it\'s re-registered now.'))
.catch((e:Error)=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
}
}
2023-09-19 03:15:26 -04:00
static MFPwTrigger(message:Discord.Message, trigger:string) {
if (this.SenseTrigger(message, trigger)) {
let farmPwText = 'The farm password is ';
if (message.channelId === '1149138133514981386') return message.reply(farmPwText += '`westfarm`')
else if (message.channelId === '1149138202662293555') return message.reply(farmPwText += '`eastfarm`')
}
}
static TriggerTest(message:Discord.Message, trigger:string) {
if (this.SenseTrigger(message, trigger)) return message.reply('Triggered!')
}
2023-09-12 20:53:07 -04:00
}