mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-21 16:55:03 +00:00
added emojiinfo command
This commit is contained in:
parent
89a4b4a153
commit
5d52f88c56
5 changed files with 82 additions and 3 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 });
|
||||
},
|
||||
});
|
|
@ -2,7 +2,7 @@ import { utilityCmd } from "../types";
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed";
|
||||
import { isValidSnowflake, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils";
|
||||
import { customEmojiRegex, isValidSnowflake, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils";
|
||||
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
|
||||
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget";
|
||||
import { canReadChannel } from "../../../utils/canReadChannel";
|
||||
|
@ -13,6 +13,7 @@ import { getChannelId, getRoleId } from "knub/dist/utils";
|
|||
import { getGuildPreview } from "../functions/getGuildPreview";
|
||||
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed";
|
||||
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
|
||||
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
|
||||
|
||||
export const InfoCmd = utilityCmd({
|
||||
trigger: "info",
|
||||
|
@ -114,7 +115,15 @@ export const InfoCmd = utilityCmd({
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: 8. Emoji ID
|
||||
// 8. Emoji
|
||||
const emojiIdMatch = value.match(customEmojiRegex);
|
||||
if (emojiIdMatch?.[2] && userCfg.can_emojiinfo) {
|
||||
const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]);
|
||||
if (embed) {
|
||||
message.channel.createMessage({ embed });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 9. Arbitrary ID
|
||||
if (isValidSnowflake(value) && userCfg.can_snowflake) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue