feat(discord-bot): change bot prefix and improve quest results interaction
Some checks failed
Build and Push Docker Image / typecheck (push) Failing after 48s
Build and Push Docker Image / build (push) Has been skipped

This commit is contained in:
2026-05-12 16:01:14 +02:00
parent 528fff3a5b
commit 8629cf246b
3 changed files with 59 additions and 70 deletions

View File

@@ -16,14 +16,12 @@ const onReady = async (client: Client<true>) => {
setInterval(() => void trackingCron(client), env.WOV_TRACKING_INTERVAL);
};
const onMessage = async (message: OmitPartialGroupDMChannel<Message>, client: Client) => {
const onMessage = async (message: OmitPartialGroupDMChannel<Message>) => {
if (message.author.bot) return;
if (message.content.startsWith(`<@${client.user!.id}>`)) {
const [commandName, ...args] = message.content
.replace(`<@${client.user!.id}>`, "")
.trim()
.split(" ");
const parts = message.content.trim().split(/\s+/);
if (parts[0]?.toLowerCase() === "lbf") {
const [commandName, ...args] = parts.slice(1);
const command = commands[commandName];
if (!command) return;
@@ -40,6 +38,6 @@ const onMessage = async (message: OmitPartialGroupDMChannel<Message>, client: Cl
};
export const setupBotMode = (client: Client) => {
client.on("clientReady", (client) => { void onReady(client); });
client.on("messageCreate", (message) => { void onMessage(message, client); });
client.on("clientReady", (client) => { void onReady(client); });
client.on("messageCreate", (message) => { void onMessage(message); });
};