migration notice

This commit is contained in:
artie 2025-02-09 12:20:47 +01:00
parent 1357417efe
commit cf61068a28
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { Events } from "discord.js";
import { defineEvent } from ".";
import { dedent } from "../utils/functions";
export default defineEvent({
name: Events.MessageCreate,
async execute(message) {
if (message.author.bot) return;
const command = message.content.match(/^\$[a-zA-Z]+$/);
if (command) {
await message.reply(
dedent`The bot has migrated to slash commands!
Start typing \`/\` to see the available commands.
For example: \`/${command[0].slice(1)}\``
);
return;
}
},
});

View File

@ -42,3 +42,12 @@ export async function silently<T extends Promise<any>>(p?: T) {
return await p;
} catch {}
}
export function dedent(parts: TemplateStringsArray, ...values: unknown[]) {
return parts
.flatMap((part, i) =>
i < values.length ? [part, String(values[i])] : [part]
)
.join("")
.replace(/(\n)\s+/g, "$1");
}