Get started with Peachy now 🍑
PEACHYPEACHY
Utility

Icon

The `icon` command allows users to display the server's icon in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.

Icon Command

The icon command is a utility feature in a Discord bot that displays the icon of the server where the command is executed.

Command Details

  • Name: icon
  • Aliases: servericon, guildicon
  • Category: Utility
  • Description: Displays the server's icon.
  • Usage:
    • Prefix: P icon, p icon
    • Slash: /icon
  • Examples:
    • P icon
    • p icon
    • /icon
  • Cooldown: 3 seconds
  • Arguments: None
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages, ViewChannel, EmbedLinks
    • User: None
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • Displays the server's icon in an embed.
  • Sends an initial "searching" message with a loading emoji, then replaces it with an embed containing:
    • The server's icon image (1024x1024, PNG format, dynamic).
    • A title with customizable emojis.
    • A footer showing the requester's display name and avatar.
    • A timestamp.
  • Supports both prefix-based (P or p) and slash command (/) inputs.
  • If the server has no icon, an error message is displayed.

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.
  • ctx.guild.iconURL() to fetch the server's icon.
  • Language localization for messages and emojis.
  • Error handling for cases where the server has no icon.