From 3afca074af8a0f7a264f6318e4cbf2fab91719e2 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Sun, 14 Jun 2026 23:54:15 +0300 Subject: fix: hunt idle command for jeeves --- jeeves/duck.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'jeeves/duck.py') 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 - 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 (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 | timing via !set duck_spawn_min/max/flee_time", trigger.nick) -- cgit v1.2.3