3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-22 09:15:03 +00:00
zeppelin/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts

32 lines
1,000 B
TypeScript

import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { customEmojiRegex } from "../../../utils";
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
import { utilityCmd } from "../types";
export const EmojiInfoCmd = utilityCmd({
trigger: ["emoji", "emojiinfo"],
description: "Show information about an emoji",
usage: "!emoji 106391128718245888",
permission: "can_emojiinfo",
signature: {
emoji: ct.string({ required: false }),
},
async run({ message, args, pluginData }) {
const emojiIdMatch = args.emoji.match(customEmojiRegex);
if (!emojiIdMatch?.[2]) {
sendErrorMessage(pluginData, message.channel, "Emoji not found");
return;
}
const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]);
if (!embed) {
sendErrorMessage(pluginData, message.channel, "Emoji not found");
return;
}
message.channel.send({ embed });
},
});