refactor: just ignore when something is bad in message cmds

This commit is contained in:
Jozef Steinhübl 2024-05-10 17:17:23 +02:00
parent c7f7ddd1a3
commit 6ce4a36feb
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F

View file

@ -4,7 +4,8 @@ import { searchTag } from "../loaders/tags.ts";
export default { export default {
name: "tag", name: "tag",
run: async (message, args) => { run: async (message, args) => {
const keyword = args[0] ?? "what-is-bun"; const keyword = args[0];
if (!keyword) return; // just ignore
const target = args[1]?.match(/([0-9]+)/)?.[0]; const target = args[1]?.match(/([0-9]+)/)?.[0];
const resolvedTarget = target const resolvedTarget = target
@ -12,15 +13,7 @@ export default {
: null; : null;
const tag = searchTag(await message.fetchChannel(), keyword, false); const tag = searchTag(await message.fetchChannel(), keyword, false);
if (!keyword || !tag) { if (!keyword || !tag) return; // just ignore
// @ts-expect-error allowed_mentions
return message.reply({
content: `\`\` Could not find a tag \`${keyword}\``,
allowed_mentions: {
parse: [],
},
});
}
// @ts-expect-error allowed_mentions // @ts-expect-error allowed_mentions
message.reply({ message.reply({