Repository navigation
fix(commands): make a level-0 !disable actually disable Torchlight - #210
Merged
Merged
Conversation
Torchlight.disabled stored the disabling level and used 0 as "enabled", so a !disable from a level-0 player (when the command is configured at level 0) announced that Torchlight was disabled while every check still treated it as enabled. Use None as the "enabled" value so level 0 is a real disable level. Bump VERSION to 1.8.41. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
Torchlight.disabledholds the admin level that disabled Torchlight, with0meaning "enabled". When theDisablecommand is configured at level 0, a level-0 player's!disablestoresdisabled = 0:check_disabled,AudioManager,VoteDisableandEnableall test the value for truthiness, so Torchlight stays fully enabled,!disableannounces the same thing again instead of "already disabled".This was noted in the #177 audit comments as out of scope.
Fix
Nonenow means "enabled", so0is a real disable level:Torchlight.disabledis typedint | Noneand starts asNone, and the map start reset inTorchlightHandlersetsNone.!enablesetsNoneinstead ofFalse.check_disabled,AudioManager.AudioPlayer,VoteDisable,EnableandDisabletestis None/is not None.Nothing changes for levels above 0, for vote-disable (
6) or for the teardown value (sys.maxsize).VERSIONgoes from 1.8.40 to 1.8.41. No config change is needed.🤖 Generated with Claude Code