ambience: use zip_longest to not cut the reply

master
dece 2 years ago
parent 9eec6795c6
commit dab1abf4c6

@ -15,6 +15,7 @@ Words are actually the requester's name but it could be extended.
"""
import random
from itertools import zip_longest
from edmond.plugin import Plugin
from edmond.utils import proc
@ -87,4 +88,7 @@ class AmbiencePlugin(Plugin):
return chunk[:index] + word + chunk[index:]
def interleave_word(self, chunk, word):
return "".join(a + b for a, b in zip(chunk, word))
return "".join(
a + b
for a, b in zip_longest(chunk, word, fillvalue='')
)

Loading…
Cancel
Save