Prefix Commands
The Prefix Bridge addon lets users run slash commands using a classic text prefix instead. Every mapped command is wrapped in a fake interaction and passed to the original command handler.
Key Features
Prefix Commands β Run any slash command with a text prefix (e.g.
^ban @user)YAML Mappings β Each command has a simple
.ymlfile that maps aliases to the slash commandArgument Parsing β Supports users, channels, roles, numbers, booleans, and rest-of-message text
Permission Enforcement β Respects
default_member_permissions, per-mapping role locks, and each command's own internal checksPer-User Cooldowns β Prevent command spam with configurable cooldown timers
Components V2 Support β Automatically patches rich message replies to work through prefix
Auto-Generated Mappings β Includes a tool to scan your commands folder and generate all YAML mappings at once
Hot Reload β Clears the command cache on load so you always get fresh command code
Clean Unload β Properly removes its listener and clears state when disabled
Configuration
Edit config.yml inside the addons/PrefixBridge folder.
# The character(s) users type before a command, e.g. ^ban
PREFIX: "^"
# Reply to the user's message, or just send in the channel
REPLY_TO_INVOKER: true
# Delete the user's message after running the command
DELETE_INVOKING: false
# Tell the user when they type a prefix command that doesn't exist
UNKNOWN_COMMAND_REPLY: false
# Per-user cooldown between uses of the same command (in seconds)
COOLDOWN_SECONDS: 2
# Shown when someone tries a command they can't use
NO_PERMISSION_MESSAGE: "π You don't have permission to use that command."
# Shown when a command throws an unexpected error
ERROR_MESSAGE: "Something went wrong running that command."Command Mappings
Each command has a YAML file in addons/PrefixBridge/commands/. A mapping tells the bridge which slash command to run, what aliases to listen for, and how to parse arguments.
Basic Command (no subcommands)
Command with Subcommands
Mapping Options
ENABLED
Set to false to disable this mapping without deleting it
PATH
Relative path to the slash command file (from bot root)
NAMES
List of prefix aliases for the command
ARGS
Argument definitions (see below)
SUBCOMMANDS
Map of subcommand definitions, each with their own NAMES and ARGS
REQUIRED_ROLES
Role IDs that can use this command (on top of existing permission checks)
REQUIRED_PERMISSIONS
Discord permission flags required to use this command
Subcommand Options
NAMES
Aliases for the subcommand (e.g. ["ban", "b"])
SUBCOMMAND
The actual subcommand name passed to the handler (defaults to the YAML key)
GROUP
Subcommand group name, if the slash command uses groups
ARGS
Argument definitions for this subcommand
REQUIRED_ROLES
Override the top-level REQUIRED_ROLES for this subcommand
REQUIRED_PERMISSIONS
Override the top-level REQUIRED_PERMISSIONS for this subcommand
Argument Types
string
Plain text
hello world
integer / int
Whole number
42
number
Decimal number
3.14
boolean / bool
True or false
true, yes, 1, on
user
User mention or ID
@User or 123456789012345678
channel
Channel mention or ID
#general or 123456789012345678
role
Role mention or ID
@Admin or 123456789012345678
Special Argument Options
REST: true
Captures all remaining text (must be the last argument)
OPTIONAL: true
Argument can be skipped
USER_OR_ID
Accepts either a user mention or a raw ID and maps to two different option names
Permission System
Permissions are checked in this order:
Generating Mappings
The addon includes a tool to auto-generate YAML mappings from your existing slash commands.
--force
Overwrite existing mapping files
--commands=path
Custom commands directory (relative to bot root)
The tool scans every .js file in your commands folder, reads its SlashCommandBuilder data, and writes a .yml mapping with correct argument types and subcommand structure.
After generating, review the files and tweak aliases as needed.
Included Mappings
The addon ships with mappings for all built-in commands:
Fun
2048, 8ball, advice, ascii, compliment, connectfour, darkjoke, fact, fliptext, guess, hangman, hug, image, kill, kiss, lennyface, meme, pickupline, quote, rizz, roast, rps, say, slap, tictactoe, wordle
Economy
balance, beg, booster, crime, daily, deposit, economy, games, heist, inventory, lottery, pets, prestige, rob, store, transfer, use, withdraw, work
Music
music, play
General
botavatar, botinfo, giveaway, help, inviter, invites, leaderboard, level, rank, reminder, serverinfo, snipe, suggestion, user
Moderation
antihoist, moderation, modtools, poll, removerole, role
Utility
autoreact, autoresponse, backup, botactivity, channelstats, embed, steal, tickets, translate, update
How It Works
Limitations
Ephemeral messages β There's no way to send ephemeral messages outside of slash commands. Permission errors and other "ephemeral" replies will be visible in the channel.
Integration overrides β Discord's per-channel/role slash command restrictions from Server Settings β Integrations are not enforced. Use
REQUIRED_ROLESin mappings instead.
Troubleshooting
Command not found
Check that the mapping's ENABLED is true and the alias is listed in NAMES
Wrong arguments
Review the ARGS order in the mapping β it must match what the command expects
Permission denied
Check REQUIRED_ROLES and REQUIRED_PERMISSIONS
Command errors on run
The slash command itself may need a real interaction β check if it uses modals or components
Mapping not loading
Check the console for [PrefixBridge] errors β usually a bad PATH or missing command file
Stale command behavior
Restart the bot β the bridge clears the command cache on startup
Support
If you run into issues:
Check the console for
[PrefixBridge]log messagesVerify your
config.ymlformattingMake sure command files exist at the paths referenced in your mappings
Re-run
generate-mappings.js --forceafter adding or renaming commands
Last updated