ft_discord_bot: The Discord Bot That Treats Documentation Like Infrastructure

A tiny Python bot turns Freqtrade support into a living FAQ, hot-reloads its command book from JSON, and routes users to curated answers instead of generic chat.

8 min read • View on GitHub • More from freqtrade

A Discord-style support desk drawn as a mechanical dispatch station. A command book sits in the center like a filing cabinet, while a moderator hand pulls one card and sends it through a relay toward a waiting user terminal. The scene explains that this bot distributes curated knowledge instead of improvising answers.
The bot’s job is not to converse. It is to move the right answer from a shared knowledge base into the right thread, fast.
Key Takeaways

The bot is a living FAQ, not a chatbot

The most interesting thing about ft_discord_bot is not that it answers questions. It is that it turns a Discord channel into a distribution layer for trusted community knowledge. The bot routes people toward curated commands, docs links, GitHub searches, and stock answers, which means the real product is consistency.

That matters in a trading community. People ask the same questions over and over, but the cost of a sloppy answer is higher than in a casual chat room. A simple first responder that is boring, predictable, and fast is often more useful than a clever one.

Why this matters in a trading community

Freqtrade sits in a domain where support questions are repetitive and consequences can be real. Users need help with backtesting, strategy settings, exchange quirks, and community norms. If the bot can point them to the right answer in one step, it saves moderator time and reduces the chance that someone improvises bad trading advice.

That is why the project’s anti-generic stance is notable. It does not try to simulate an expert. It tries to be a reliable index into the expert knowledge that already exists.

The brain is a JSON file, and that is the point

The bot’s knowledge lives in bot_commands.json, which acts like a flat-file FAQ. Commands map short triggers to long-form responses, and the content stays separate from the Python logic. That separation is the core design choice: the bot is a delivery mechanism, while the JSON file is the actual source of truth.

The implementation leans into practicality. It uses rapidjson with support for comments and trailing commas, which makes the file friendlier for humans to edit. In a community-maintained support layer, that matters more than strict purity.

The architecture is simple on purpose. Content comes from JSON, the bot routes it, and hot reload swaps the active command set in place.

A close-up of a handwritten JSON ledger being edited beside a live message router. One side shows human-friendly annotations and grouped entries. The other side shows the bot reloading those entries from a remote URL into the active command set. The image explains why comment-friendly JSON and hot reload are the project’s key operational ideas.
The technical trick is not complexity. It is making the knowledge base easy to edit and easy to refresh.

Hot reload turns moderators into operators

The smartest move in the project is **reload_commands. An authorized user can pull in a fresh command file from a local path or a remote URL and make that new knowledge live without restarting the bot. In other words, moderators are not just answering questions. They are operating a shared knowledge system.

That changes the maintenance model. FAQ edits do not have to wait for a deploy. A docs update, a policy change, or a new warning can be published centrally and reflected in the channel immediately. For a support bot, that is a big deal.

Support modelUpdate speedAccuracyOperational burdenBest at
Manual moderator repliesFast in the moment, slow to scaleDepends on who answersHighNuanced one-off situations
Generic Discord bot commandsUsually easy to configureMixedMediumSimple automation
ft_discord_bot’s curated JSON layerFast after reloadHigh for approved answersLow once maintainedRepeatable community support

What hot reload actually buys

How the command router actually behaves

The bot’s message flow is straightforward. It listens in on_message, checks for the double-asterisk prefix, and routes the message into command handlers. If the user is replying to someone else, the bot can preserve that context and direct the answer back to the original author.

That reply-aware behavior is subtle but important. It keeps the bot from becoming a blunt broadcast machine. The same command can serve a general chat thread or a direct follow-up without losing the target of the answer.

# Simplified flow
if message.content.startswith('**'):
    if is_reply(message):
        target = referenced_message.author
    else:
        target = message.author

    command = parse_command(message.content)
    response = process_command(command, target)
    await message.reply(response)

Under the hood, helper functions generate different destinations. Some commands build docs URLs, some send people to GitHub, and some create search links. The bot is less a conversational agent than a router with a friendly face.

The clean idea, and the messy trade-off

There is one obvious compromise: the allowed manager list is hardcoded. That is simple and readable, but it is also a security and governance trade-off. It works because the bot is narrow and the team is small. If the project grows, that list becomes a candidate for role-based permissions or configuration-driven access control.

The other trade-off is architectural. The main message handler is carrying a lot of responsibility. It is fine in a small utility, but it will eventually feel like a god function if the command surface expands. The design is elegant because it is minimal, and that same minimalism is also the ceiling.

ChoiceWhy it worksWhere it hurts
Hardcoded managersEasy to audit in a small repoBrittle as the operator set changes
Monolithic message handlerSimple to understandHarder to extend cleanly
JSON as knowledge baseEditable without code changesContent governance still matters

What this bot is really competing against

The real alternatives are not just other Discord bots. They are moderator labor, generic automation, and AI-first support tools. Manual replies are flexible but expensive. Generic bots are programmable but shallow. AI tools are broader, but they are not automatically better for a domain where correctness matters more than novelty.

This bot’s edge is that it stays narrow. It is built to return the approved answer quickly, in the right context, with almost no ceremony. That is enough for a community that values dependable support over conversational flair.

ApproachStrengthWeakness
Manual moderationHuman judgmentDoes not scale cleanly
AI-first supportBroad coverageCan drift or hallucinate
ft_discord_botCurated reliabilityLess flexible outside its domain