diff --git a/plugins/markov.py b/plugins/markov.py index a8e285d..ba9186d 100644 --- a/plugins/markov.py +++ b/plugins/markov.py @@ -236,11 +236,20 @@ class Markov(Plugin): self.send_to(conn, channel, f"{who.nick}: {message}") case ["chance", chance]: chain = self.get_chain(channel, who.nick) - reply_chance = float(chance) + try: + reply_chance = float(chance) + except ValueError: + log.error("Couldn't parse %r as a float", chance) + return if not math.isnan(reply_chance): chain.reply_chance = min( max(float(reply_chance), 0.0), self.reply_chance ) + self.send_to( + conn, + channel, + f"{who.nick}: reply chance set to {chain.reply_chance}", + ) case _: # command not recognized pass