Fix "relation chat_levels does not exist" on cluster cleave / taunt#40
Merged
Conversation
.clank cluster cleave and .clank taunt queried a chat_levels table that Clankwarden never creates (it ships no leveling system; the table only exists when a separate leveling bot shares the DB). The raw queries threw relation "chat_levels" does not exist and failed the commands. Route both through a best-effort _chat_level() helper that returns None when the table is absent (cached after the first miss) so the level-based protection (cleave skips lvl>=30) and gate (taunt needs lvl>=15) are skipped when there is no leveling system, and applied when there is. The commands stay mod-gated either way.
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
.clank cluster cleave <id>(and.clank taunt) failed with:Why
Both commands queried a
chat_levelstable directly — a leftover from the Discoin port, where a chat-leveling system existed. Clankwarden is the slim containment bot and ships no leveling system, so that table is never created (it only exists if a separate leveling bot shares the same database). The rawSELECTthrewUndefinedTableError, failing the command.cluster cleaveused it to protect high-level members (skip level ≥ 30).taunt/clarion used it to gate the command behind level 15+.Fix
Route both through a best-effort
_chat_level()helper that returnsNonewhen the table is absent (cached after the first miss so we don't re-run a failing query or spam logs):Manage Roles).py_compileclean.cogs/clank.pyonly.Follow-up to #38 / #39.
Generated by Claude Code