Skip to content

feat: replace Telegram bot with Discord bot#6

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-telegram-bot-with-discord-bot
Draft

feat: replace Telegram bot with Discord bot#6
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-telegram-bot-with-discord-bot

Conversation

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Migrates the bot platform from Telegram (python-telegram-bot) to Discord (discord.py==2.4.0). All commands, interactive flows, and periodic notifications are preserved with equivalent Discord-native patterns.

Core Changes

  • requirements.txt — swap python-telegram-bot==22.6discord.py==2.4.0
  • topology_template.jsontelegram_bot_tokendiscord_bot_token; admin ID is now a Discord snowflake
  • config.py — drop Telegram ConversationHandler state integers (no longer needed)

Bot Architecture

  • main.py — introduces RobbiBot(commands.Bot); shared state (node address, balance history, credentials, etc.) stored as instance attributes instead of application.bot_data; slash commands registered in setup_hook() + tree.sync()
  • handlers/common.pyauth_required wraps discord.Interaction; reads whitelist from interaction.client.allowed_user_ids; handle_api_error uses interaction.followup.send()

Handler Rewrites

  • handlers/node.pyConversationHandler + inline keyboard callbacks replaced by discord.ui.View subclasses for multi-step confirmation flows and discord.ui.Modal for roll count input; setup_node_commands(bot) registers /node, /flush, /hist, /docker
  • handlers/price.pysetup_price_commands(bot) registers /btc, /mas using defer + followup pattern
  • handlers/system.pysetup_system_commands(bot) registers /hi, /temperature, /perf
  • handlers/scheduler.py — periodic pings DM users via bot.fetch_user(user_id) instead of application.bot.send_message(chat_id=…)

Example: interactive docker menu flow

# Before (Telegram ConversationHandler + CallbackQueryHandler)
docker_handler = ConversationHandler(
    entry_points=[CommandHandler('docker', docker)],
    states={DOCKER_MENU_STATE: [CallbackQueryHandler(docker_start, pattern='^docker_start$'), ...]},
    ...
)

# After (Discord slash command + View)
@bot.tree.command(name='docker')
@auth_required
async def docker(interaction: discord.Interaction) -> None:
    await interaction.response.send_message(
        "🐳 Docker Node Management\nWhat do you want to do?",
        view=DockerMenuView(interaction.client)
    )
Original prompt

Je veux remplacer le bot Telegram par un bot discord.

Custom agent used: T800
Code maintainer and reviewer that develop the best application possible.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 10, 2026 13:18
Co-authored-by: lipnelz <174376617+lipnelz@users.noreply.github.com>
Co-authored-by: lipnelz <174376617+lipnelz@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace Telegram bot with Discord bot feat: replace Telegram bot with Discord bot Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants