diff options
| author | Ahmed <git@gumx.cc> | 2026-06-14 23:54:15 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-14 23:56:37 +0300 |
| commit | 3afca074af8a0f7a264f6318e4cbf2fab91719e2 (patch) | |
| tree | f2ba4dcaceaeda3ee053e88f723cc5a713c32937 | |
| parent | 4cace2f42208bc54298894d4bc0988b165bd73da (diff) | |
fix: hunt idle command for jeeves
| -rw-r--r-- | jeeves/duck.py | 24 | ||||
| -rw-r--r-- | jeeves/helpstrings.py | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/jeeves/duck.py b/jeeves/duck.py index be998b1..03804d1 100644 --- a/jeeves/duck.py +++ b/jeeves/duck.py @@ -11,6 +11,7 @@ Spawn times, flee timeout, and idle threshold are runtime-configurable via !set. !hunt - show hunt state !hunt start - start the hunt (op/owner) !hunt stop - stop the hunt (op/owner) + !hunt idle <n> - set idle rounds before auto-stop (0=off) (op/owner) """ import os as _os, sys as _sys @@ -283,6 +284,27 @@ def cmd_hunt(bot, trigger): st["next_spawn"] = float("inf") bot.say("the hunt is over.", channel) + elif sub == "idle": + if not jv.is_authorized(bot, trigger): + return + parts = arg.split() + if len(parts) < 2: + bot.say("usage: !hunt idle <rounds> (0 = no auto-stop)", channel) + return + try: + n = int(parts[1]) + if n < 0: + raise ValueError + except ValueError: + bot.say("idle rounds must be a non-negative integer", channel) + return + with bot.memory["jv_lock"]: + ch = jv.chan_db(bot, channel) + ch["config"]["duck_idle_rounds"] = n + jv.save(bot) + idle_str = f"{n} round(s)" if n > 0 else "off" + bot.say(f"idle auto-stop set to {idle_str}", channel) + else: with bot.memory["dk_lock"]: st = _chan_state(bot, channel) @@ -311,4 +333,4 @@ def cmd_hunt(bot, trigger): else: bot.say(f"hunt: {state}", channel) if jv.is_authorized(bot, trigger): - bot.notice("use !hunt start | !hunt stop to control | timing via !set duck_spawn_min/max/flee_time", trigger.nick) + bot.notice("use !hunt start|stop|idle <n> | timing via !set duck_spawn_min/max/flee_time", trigger.nick) diff --git a/jeeves/helpstrings.py b/jeeves/helpstrings.py index bf4b27e..2a7e262 100644 --- a/jeeves/helpstrings.py +++ b/jeeves/helpstrings.py @@ -29,7 +29,7 @@ _DUCK = { "bang": "!bang - fire at the current duck", "reload": "!reload - refill ammo, 3s cooldown", "score": "!score - top 5 for this channel; !score clear to reset (op/owner)", - "hunt": "!hunt - show hunt state (includes spawn/flee times); !hunt start|stop to control (op); timing via !set duck_spawn_min/max/flee_time", + "hunt": "!hunt - show hunt state; !hunt start|stop (op); !hunt idle <n> - set idle rounds (0=off) (op); timing via !set duck_spawn_min/max/flee_time", } _RECIPES = { |
