StealEmoji
The `stealemoji` command generates an image of a specified emoji from the server or a Unicode emoji in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
StealEmoji Command
The stealemoji
command is a utility feature in a Discord bot that displays an image of a specified custom or Unicode emoji and provides options to download it in various formats.
Command Details
- Name:
stealemoji
- Aliases:
emoji
,emojisteal
- Category: Utility
- Description: Generates an emoji image from the server or a Unicode emoji.
- Usage:
- Prefix:
P stealemoji <emoji>
,p stealemoji <emoji>
- Slash:
/stealemoji [emoji]
- Prefix:
- Examples:
P stealemoji :emoji:
p stealemoji 😊
/stealemoji :emoji:
- Cooldown: 3 seconds
- Arguments: Required (emoji: custom or Unicode)
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks, AttachFiles
- User: SendMessages
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Displays an image of a specified custom Discord emoji or Unicode emoji.
- Sends an initial "searching" message with a loading emoji, then replaces it with an embed containing:
- The emoji image (PNG for static custom emojis or Unicode emojis, GIF for animated custom emojis).
- A title with the emoji name and ID (for custom emojis).
- A description indicating the emoji image.
- A footer showing the requester's display name and avatar.
- A timestamp.
- Includes interactive buttons to download the emoji in PNG, JPG, or GIF formats.
- Supports both prefix-based (
P
orp
) and slash command (/
) inputs. - If an invalid or unrecognized emoji is provided, an error message is displayed.
- Buttons time out after 1 minute, becoming disabled, and only the command issuer can interact with them.
Code Overview
The command is built using a Command
class structure and handles both message-based and interaction-based (slash command) inputs. It uses:
client.embed()
to create a formatted embed.- Regular expressions (
customEmojiRegex
andunicodeEmojiRegex
) to parse custom and Unicode emojis from the input. axios
to fetch the emoji image for downloads.AttachmentBuilder
to send downloadable emoji files in PNG, JPG, or GIF formats.ActionRowBuilder
andButtonBuilder
fromdiscord.js
to create interactive download buttons.- A message component collector to handle button interactions with a 1-minute timeout.
- Language localization for messages and emojis via
emojiMessages
. - Error handling for invalid emojis and download failures.
ServerInfo
The `serverinfo` command displays detailed information about the Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Theme
The `theme` command allows users to toggle between peach, goma, and normal themes or view their current theme setting in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.