ambience: apply effect to whole reply, not a chunk

This commit is contained in:
dece 2021-12-12 18:38:19 +01:00
parent f97e2c51e4
commit 9eec6795c6

View file

@ -44,16 +44,11 @@ class AmbiencePlugin(Plugin):
def get_reply(self, event, target=None): def get_reply(self, event, target=None):
reply = "" reply = ""
num_chunks = random.randint(2, 3) num_chunks = random.randint(2, 3)
if target is not None or proc(self.config["effect_rate"]):
effect_index = random.randint(0, num_chunks - 1)
effect_word = (target or event.source.nick).upper()
else:
effect_index = -1
for i in range(num_chunks): for i in range(num_chunks):
chunk = self.get_chunk() reply += self.get_chunk()
if i == effect_index: if target is not None or proc(self.config["effect_rate"]):
chunk = self.apply_effect(chunk, effect_word) effect_word = (target or event.source.nick).upper()
reply += chunk reply = self.apply_effect(reply, effect_word)
return reply return reply
def get_chunk(self): def get_chunk(self):