Kojima Bot can turn any image file into a Discord slash command with zero code. Drop an image into the right folder, redeploy, and the command appears in the slash menu automatically. This makes it trivial to maintain a server-specific meme library without touching the bot’s source code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/noskap/kojima-bot/llms.txt
Use this file to discover all available pages before exploring further.
How it works
At bot startup,registerMemeSlashHandlers calls scanMemeImageFiles, which walks assets/images/meme/ recursively (skipping hidden files and directories). Every file with a recognised extension is registered as its own slash command.
Supported file types: .png, .jpg, .jpeg, .gif, .webp, .bmp, .webm
The command name is derived from the filename using memeFileToCommandNameStem:
- Take the filename without its extension.
- Lowercase the entire string.
- Replace every character that is not
a–z,0–9, or_with an underscore. - Collapse consecutive underscores into one.
- Strip leading and trailing underscores.
- Truncate to 32 characters (Discord’s slash command name limit).
- If the result is empty, fall back to
"meme".
label in the command description (shown in the Discord UI as "Meme: subdir/filename.png") but do not affect the command name itself — only the bare filename matters.
Adding meme commands
Add the image file
Copy or move your image into
assets/images/meme/ (or any subdirectory inside it). The filename becomes the slash command name, so choose something clear and Discord-safe.Register the command with Discord
Run the deploy script to push the new slash command definition to your guild:
Name collision handling
If two files would produce the same derived command name, a numeric suffix is appended to make each name unique. For example, iffunny.png and funny.gif both resolve to funny, the second one becomes funny_2, the third funny_3, and so on.
Core command names — kojima, gamble, profile, colonel, ping — are reserved. If a meme file would produce one of those names, registerMemeSlashHandlers logs a warning and skips that file entirely:
Guild command cap
Discord allows up to approximately 500 guild slash commands.MEME_GUILD_COMMAND_CAP is set to 500. The bot counts available slots by subtracting the number of already-registered core commands from the cap. If the meme directory exceeds the remaining slots the bot logs a warning and stops registering further files:
Meme commands are guild-scoped (uses
GUILD_ID from .env). Re-run bun run deploy whenever you add or remove images to keep Discord’s command list in sync with your assets/images/meme/ folder.