Skip to content

[FEAT] Set the bots up from /mb and explain what is wrong - #127

Closed
makeevrserg wants to merge 61 commits into
masterfrom
feat/setup-onboarding
Closed

makeevrserg wants to merge 61 commits into
masterfrom
feat/setup-onboarding

Conversation

@makeevrserg

Copy link
Copy Markdown
Member

Admins struggled to set the bridge up: bot tokens, a proxy where Telegram and Discord are blocked, chat, topic and channel ids, the rights of the bots. Most of it failed silently: every messenger logger was created with withoutParentHandlers(), which dropped the logs, /minfo included.

Setup from the console or the game. /mb replaces /mbreload and lives in the new modules/onboarding feature module:

  • status, reload, telegram …, discord … set tokens, chat, topic, channel, activity, proxy (HTTP or SOCKS5, login optional) and a Bot API url.
  • bind issues a one-time code; sent into a chat (/bind@Bot <code> by a chat admin, !bind <code> with Manage Channel) it fills in chat_id and topic_id or the channel.
  • check goes through the token, the bot, privacy mode, the chat, the rights, the topic, the intents and the link role, and sends a test message.
  • invite builds the Discord invite with the permissions the plugin needs.
  • A token or proxy password typed in game needs --unsafe, because Paper writes player commands to latest.log.

Status and errors. Each bot is not configured, connecting, connected as @bot, or failed with a reason and the next step. An empty token logs a step-by-step guide once instead of retrying forever. Telegram and Discord errors become texts that say what to do: wrong token, chat not found, supergroup migration (chat_id is updated), topic gone, bot removed, no rights, 409, 429, blocked network with and without a proxy, proxy login, Discord close code 4014 with the intents to turn on, missing permission. A wrong token, intent or api_url waits for new settings.

Fixes

  • Logs of the messenger modules reach the console again; withRetry no longer prints stacktraces; the webhook URL is not logged.
  • A new Discord token or channel applies without a restart.
  • A Telegram group without topics relays both ways; photos, stickers and service messages are no longer deleted.
  • config.yml with an error keeps the previous settings and says where it breaks, and nothing is saved over it (AstraLibs krateOf returns the read result now).
  • The LuckPerms group is taken away when a linked player leaves the Discord server, also for those who left while the server was off, and on /unlink. Discord needs Server Members Intent for that, only when link gives roles.
  • A linked player who left Discord no longer breaks delivery; linking by sending the code to the bot works; Discord starts with an empty activity; /minfo replies in the chat.
  • Polling has its own dispatcher, so a reconnect no longer cancels messages being sent.

Structure. modules/onboarding/api holds the contracts the messengers implement, modules/onboarding the commands. The Telegram, Discord and link modules are grouped by concept instead of by layer. Texts come from translations.yml; the MC/TG/DS source tags stay in code, %from% controls them.

Docs. docs/ covers Telegram, Discord, proxy, commands, troubleshooting and limitations; the README is rewritten; every setting in config.yml has a comment.

Breaking. /mbreload is /mb reload. Discord needs Server Members Intent when link gives roles. The Discord start, stop and topic texts are translations now, so they follow the first language of translations.yml (English by default) instead of being Russian.

Not done. SOCKS5 with a password needs a JVM-wide Authenticator. A Discord webhook deleted by hand is created again only on the next reconnect.

435 unit tests, detekt clean. Checked on Paper 26.1.2 with fake tokens: the setup guide at start, every /mb reply, the errors for wrong tokens and a dead proxy, /mb reload with a broken config.yml and translations.yml keeping the settings. Not run against real Telegram or Discord bots.

Merge after AstraLibs 3.51.0 is released (Astra-Interactive/AstraLibs#152): until then CI cannot resolve it. Version 0.36.0.

@makeevrserg
makeevrserg force-pushed the feat/setup-onboarding branch from df5f80d to e452017 Compare October 1, 2026 17:01
LuckPerms registers its singleton on Bukkit too, so the lookup through
the Bukkit services manager is not needed.
@makeevrserg
makeevrserg force-pushed the feat/setup-onboarding branch from e452017 to 65a848e Compare October 2, 2026 15:45
…ables

LinkedPlayerTable is not migrated on purpose: links start over.
@makeevrserg makeevrserg closed this Oct 3, 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.

1 participant