Enable the 'selfbot' button#42
Conversation
Authored by: @Sakhwoow
📝 WalkthroughWalkthroughThe selfButton initialization in MultiBot.SyncBridgeRosterToPlayers is modified to add a doLeft handler that sends the ".playerbot bot self" chat command and calls MultiBot.OnOffSwitch, while the setDisable call condition is restructured. ChangesSelfbot Button Fix
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I 100% lifted the code from the comment in the issue thread - I cannot take any credit for the fix. I simply made the PR, thanks a lot to @Sakhwoow for providing the info used. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Core/MultiBot.lua`:
- Around line 1432-1438: The self button handling in MultiBot.OnOffSwitch is not
synced to the actual selfbot active state, so it can be disabled even when the
selfbot is already active. Update the selfButton setup to use the same state
source as the roster buttons (the active-state check used by
SyncBridgeRosterToPlayers and IsBridgeRosterBotActive), and switch between
setEnable() and setDisable() accordingly before assigning doLeft. This keeps the
self button UI aligned with the current selfbot state and prevents the toggle
behavior from flipping the wrong way.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| if selfButton then | ||
| if selfButton.setDisable then selfButton.setDisable() end | ||
| selfButton.doLeft = function(pButton) | ||
| SendChatMessage(".playerbot bot self", "SAY") | ||
| MultiBot.OnOffSwitch(pButton) | ||
| end | ||
| end |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check call sites of SyncBridgeRosterToPlayers
rg -n 'SyncBridgeRosterToPlayers' --type lua -g '!**/test/**'
# Check if selfbot active state is tracked in bridge roster or elsewhere
rg -n 'IsBridgeRosterBotActive\|SelfBot\|selfBot\|self_bot' --type lua -C3Repository: Wishmaster117/MultiBot-Chatless
Length of output: 169
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the relevant file and nearby symbols.
git ls-files 'Core/MultiBot.lua'
wc -l Core/MultiBot.lua
rg -n 'SyncBridgeRosterToPlayers|OnOffSwitch|IsBridgeRosterBotActive|setDisable|setEnable|doLeft' Core/MultiBot.lua -n -C 4
# Inspect the function body around the cited lines.
sed -n '1408,1485p' Core/MultiBot.lua
# Find any bridge roster/selfbot state tracking elsewhere in the repo.
rg -n 'IsBridgeRosterBotActive|SyncBridgeRosterToPlayers|selfbot|self bot|selfBot|self_bot|bridge roster|bot self' .Repository: Wishmaster117/MultiBot-Chatless
Length of output: 9383
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the active-state helper and self-button construction.
sed -n '1288,1375p' Core/MultiBot.lua
sed -n '1510,1615p' Core/MultiBot.lua
sed -n '1760,1845p' Core/MultiBot.lua
# Show the specific toggle handler used by the self button.
rg -n 'function MultiBot\.OnOffSwitch|OnOffSwitch\s*=' Core/MultiBot.lua Core/MultiBotHandler.lua Core/MultiBotEngine.lua -n -C 6Repository: Wishmaster117/MultiBot-Chatless
Length of output: 8299
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the self-button constructor and any state initialization it performs.
rg -n 'function MultiBot\.addSelf|addSelf\s*=' Core/MultiBot.lua Core/MultiBotEngine.lua -n -C 8
sed -n '1980,2085p' Core/MultiBotEngine.lua
# Re-read the toggle helper for exact state behavior.
sed -n '834,845p' Core/MultiBotEngine.luaRepository: Wishmaster117/MultiBot-Chatless
Length of output: 5278
Sync the self button with the current selfbot state. SyncBridgeRosterToPlayers always calls setDisable() for selfButton, while the roster buttons mirror IsBridgeRosterBotActive(...). If the selfbot is already active, the button still renders disabled and a click can toggle the command while the UI flips the wrong way. Use the same active-state source here and call setEnable()/setDisable() accordingly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Core/MultiBot.lua` around lines 1432 - 1438, The self button handling in
MultiBot.OnOffSwitch is not synced to the actual selfbot active state, so it can
be disabled even when the selfbot is already active. Update the selfButton setup
to use the same state source as the roster buttons (the active-state check used
by SyncBridgeRosterToPlayers and IsBridgeRosterBotActive), and switch between
setEnable() and setDisable() accordingly before assigning doLeft. This keeps the
self button UI aligned with the current selfbot state and prevents the toggle
behavior from flipping the wrong way.
Authored by: @Sakhwoow
Closes #33
Summary by CodeRabbit