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):
reply = ""
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):
chunk = self.get_chunk()
if i == effect_index:
chunk = self.apply_effect(chunk, effect_word)
reply += chunk
reply += self.get_chunk()
if target is not None or proc(self.config["effect_rate"]):
effect_word = (target or event.source.nick).upper()
reply = self.apply_effect(reply, effect_word)
return reply
def get_chunk(self):