Skip to content

Discord bot like MCGalaxy's, BetaCraft support and ViaFabricPlus tests - #63

Merged
perronosaurio merged 3 commits into
masterfrom
discord-bot-betacraft
Sep 29, 2026
Merged

perronosaurio merged 3 commits into
masterfrom
discord-bot-betacraft

Conversation

@perronosaurio

@perronosaurio perronosaurio commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

What does this change?

Discord bot (relay-discord 2.0), modelled on MCGalaxy's:

  • chat channels: in-game chat, joins and leaves go to Discord, and Discord messages show up in game
  • staff channels, linked both ways to the in-game staff chat (/opchat, #message)
  • !command args from Discord. Anyone can use publicCommands. Other commands need a Discord role or user mapped to a server rank (roleRanks, userRanks), or a staff channel (staffRank). bannedCommands can never be run.
  • !players / .who / .players, the player count as the bot's status, and /discord for an invite link
  • the gateway client resumes dropped sessions, detects dead connections and explains fatal errors (wrong token, Message Content intent not enabled)
  • setup guide in docs/DISCORD.md

Rank checks. Several commands skipped rank rules for anything that wasn't a player (for example "you can only give ranks lower than your own", /sudo, zones). Without this fix a Discord moderator could have given themselves Owner. The checks now compare permission levels, and the real console has an infinite one, so it behaves as before.

BetaCraft. extraHeartbeats announces the server on more lists, as MCGalaxy does with authservices:

  • each list gets its own salt
  • an optional name suffix keeps accounts from different lists apart
  • Mojang session checks (mojangAuth) accept Minecraft accounts the way the BetaCraft launcher signs in

ViaFabricPlus. It already worked. New tests now act as ViaLegacy (the 9 CPE extensions it implements) and as the vanilla Classic 0.30 client, and check that neither ever gets a packet it doesn't understand.

How did you test it?

  • npm run lint and npm test pass (56 tests). New tests:
    • Discord against a fake gateway and REST API: chat both ways, staff channel, public, role-based, staff and banned commands, and !rank refused for a staff user
    • login through two lists plus mocked Mojang sessions
    • the two client-compatibility tests (checked that they fail when extra packets are sent)
  • Tried it in game: not run against a real Discord server, BetaCraft or ViaFabricPlus client yet
  • Updated README.md, docs/ and CHANGELOG.md

Several commands skipped rank checks for anything that wasn't a player,
such as "you can only give ranks lower than your own" or /sudo. That was
fine while only the console could run commands without being in game,
but a relay running commands for a Discord user would have bypassed them.
They now compare permission levels; the console has an infinite one, so
nothing changes for it.

createConsoleActor() takes a rank to build such a limited sender, and the
staff chat fires a staffChat event.
extraHeartbeats announces the server on more lists (BetaCraft) with a
salt per list, an optional name suffix to keep accounts from different
lists apart, and Mojang session checks for Minecraft accounts, the same
way MCGalaxy's authservices work.

New tests play ViaFabricPlus (the 9 CPE extensions ViaLegacy implements)
and the vanilla Classic 0.30 client and check they never get a packet
they don't understand.
Chat channels and staff channels (linked to /opchat), !command with
ranks mapped from Discord roles and users, !players/.who, a status with
the player count and /discord for the invite link. The gateway client
resumes dropped sessions, notices dead connections and explains fatal
errors such as a missing Message Content intent.

Setup guide in docs/DISCORD.md.
@perronosaurio
perronosaurio merged commit 6b1e777 into master Sep 29, 2026
6 checks passed
@perronosaurio
perronosaurio deleted the discord-bot-betacraft branch September 29, 2026 20:59
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