]> git.aero2k.de Git - urlbot-v3.git/commitdiff
re-add vote duration limit
authorThorsten <mail@aero2k.de>
Mon, 9 Sep 2024 20:36:18 +0000 (22:36 +0200)
committerThorsten <mail@aero2k.de>
Mon, 9 Sep 2024 20:36:18 +0000 (22:36 +0200)
src/distbot/plugins/votepoll.py

index 9768df353389f2ff2230eb301a3fea6952f810f6..9c63bc367b1ecead861d9aec23073cd9efd44131 100644 (file)
@@ -169,6 +169,7 @@ class VotePoll(Worker):
                 # duplicate options
                 return Action(msg="No duplicate options.")
             vote_duration = self.vote_duration if not vote_duration else vote_duration
+            vote_duration = min(self.max_vote_duration, max(30, vote_duration))
             # setup new poll
             poll = Poll(options, {}, now + vote_duration)
             # check prior results
@@ -185,7 +186,6 @@ class VotePoll(Worker):
             # setup timeout to disable poll and present results
             bot_nick = conf_get("bot_nickname")
 
-
             poll_message = (f"**New Vote:** {sender} started a vote! "
                             f"Vote within {vote_duration}s "
                             f"(reply with '{bot_nick}: vote A/B/foo' within {vote_duration}s)"