40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import BotClient from "../../../libs/BotClient";
|
|
import ms from "ms";
|
|
|
|
let cooldown = false;
|
|
|
|
export default async(Discord: any, client: BotClient, message: any) => {
|
|
|
|
if(message.channel.id == "1311034475727028305") {
|
|
if(message.author.bot) return;
|
|
message.react(message.guild.emojis.cache.get('1310753663001563156'))
|
|
}
|
|
|
|
if(message.author.bot) return;
|
|
|
|
// typst code block -> emit typst event
|
|
try {
|
|
const hasTypst = /```typ\s*\n([\s\S]*?)\n```/i.test(message.content || "");
|
|
if(hasTypst) {
|
|
client.emit("typst", message);
|
|
return;
|
|
}
|
|
} catch (e) {
|
|
console.error('Error checking for typst block:', e);
|
|
}
|
|
|
|
const replyText = client.config.getReplyText();
|
|
if(replyText) {
|
|
for(const [key, value] of Object.entries(replyText)) {
|
|
if(message.content == key && !cooldown) {
|
|
cooldown = true;
|
|
setTimeout(() => {
|
|
cooldown = false;
|
|
}, ms("10s"));
|
|
return message.reply(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|