Discord bot like MCGalaxy's, BetaCraft support and ViaFabricPlus tests - #63
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Discord bot (
relay-discord2.0), modelled on MCGalaxy's:/opchat,#message)!command argsfrom Discord. Anyone can usepublicCommands. Other commands need a Discord role or user mapped to a server rank (roleRanks,userRanks), or a staff channel (staffRank).bannedCommandscan never be run.!players/.who/.players, the player count as the bot's status, and/discordfor an invite linkdocs/DISCORD.mdRank 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.
extraHeartbeatsannounces the server on more lists, as MCGalaxy does with authservices:mojangAuth) accept Minecraft accounts the way the BetaCraft launcher signs inViaFabricPlus. 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 lintandnpm testpass (56 tests). New tests:!rankrefused for a staff user