mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 22:05:01 +00:00
Add !roleinfo and !emojiinfo (#198)
This commit is contained in:
parent
fb4f70a29c
commit
519cb4ece2
7 changed files with 247 additions and 46 deletions
32
backend/src/plugins/Utility/commands/EmojiInfoCmd.ts
Normal file
32
backend/src/plugins/Utility/commands/EmojiInfoCmd.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { utilityCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { customEmojiRegex } from "../../../utils";
|
||||
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
|
||||
|
||||
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.createMessage({ embed });
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue