mirror of
https://github.com/artiemis/artemis.js.git
synced 2026-02-14 10:21:54 +00:00
migration notice
This commit is contained in:
parent
1357417efe
commit
cf61068a28
21
src/events/messageCreate.ts
Normal file
21
src/events/messageCreate.ts
Normal 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;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -42,3 +42,12 @@ export async function silently<T extends Promise<any>>(p?: T) {
|
|||||||
return await p;
|
return await p;
|
||||||
} catch {}
|
} 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");
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user