ambience: use zip_longest to not cut the reply
This commit is contained in:
parent
9eec6795c6
commit
dab1abf4c6
|
@ -15,6 +15,7 @@ Words are actually the requester's name but it could be extended.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
from itertools import zip_longest
|
||||||
|
|
||||||
from edmond.plugin import Plugin
|
from edmond.plugin import Plugin
|
||||||
from edmond.utils import proc
|
from edmond.utils import proc
|
||||||
|
@ -87,4 +88,7 @@ class AmbiencePlugin(Plugin):
|
||||||
return chunk[:index] + word + chunk[index:]
|
return chunk[:index] + word + chunk[index:]
|
||||||
|
|
||||||
def interleave_word(self, chunk, word):
|
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…
Reference in a new issue