Get started with Peachy now 🍑
PEACHYPEACHY
Utility

QR Code

The `qr` command displays a QR code for KHR or USD in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.

QR Code Command

The qr command is a utility feature in a Discord bot that displays a QR code for a specified currency (KHR or USD).

Command Details

  • Name: qr
  • Aliases: qrcode
  • Category: Utility
  • Description: Displays the QR code for KHR or USD.
  • Usage:
    • Prefix: P qr <kh|usd>, p qr <kh|usd>
    • Slash: /qr [currency]
  • Examples:
    • P qr kh
    • p qr usd
    • /qr kh
  • Cooldown: 3 seconds
  • Arguments: Required (currency: kh or usd)
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages
    • User: SendMessages
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • Displays a QR code image for the specified currency (KHR or USD).
  • Sends an initial "searching" message with a loading emoji, then replaces it with an embed containing:
    • The QR code image for the selected currency, sourced from globalGif.qrKH or globalGif.qrUSD.
    • A title indicating the currency (e.g., "QR Code for KHR").
    • A description confirming the QR code for the selected currency.
  • Supports both prefix-based (P or p) and slash command (/) inputs.
  • If an invalid currency is provided (not kh or usd), an error message is displayed, optionally with an ephemeral flag for slash commands.

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.
  • globalGif.qrKH or globalGif.qrUSD to retrieve the QR code image URL based on the selected currency.
  • Language localization for messages and emojis via qrMessages.
  • Error handling for invalid currency inputs (not kh or usd).