Add feedback for markov bot reply chance
This will just send a message to the user who just updated their markov reply chance with the final value it was set to, so there are no surprises. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -236,11 +236,20 @@ class Markov(Plugin):
|
|||||||
self.send_to(conn, channel, f"{who.nick}: {message}")
|
self.send_to(conn, channel, f"{who.nick}: {message}")
|
||||||
case ["chance", chance]:
|
case ["chance", chance]:
|
||||||
chain = self.get_chain(channel, who.nick)
|
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):
|
if not math.isnan(reply_chance):
|
||||||
chain.reply_chance = min(
|
chain.reply_chance = min(
|
||||||
max(float(reply_chance), 0.0), self.reply_chance
|
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 _:
|
case _:
|
||||||
# command not recognized
|
# command not recognized
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user