misc_reactions: fix weights
This commit is contained in:
parent
0558fb7bdf
commit
7f75b15207
|
@ -54,6 +54,11 @@ class MiscReactionsPlugin(Plugin):
|
|||
continue
|
||||
reactions.append(getattr(self, f"react_with_{reaction}"))
|
||||
weights.append(weight)
|
||||
# Normalize weights.
|
||||
total_weight = sum(weights)
|
||||
weights = list(map(lambda w: w / total_weight, weights))
|
||||
self.bot.log_d(f"Reactions: {reactions}")
|
||||
self.bot.log_d(f"Reaction weights: {weights}")
|
||||
return reactions, weights
|
||||
|
||||
def on_pubmsg(self, event):
|
||||
|
|
Loading…
Reference in a new issue