Fix #2500 (better “C’est toi le”)

Thanks, anonymous contributor
This commit is contained in:
mathieui 2014-04-10 19:34:26 +02:00
parent e451041f05
commit a1b2055127

View file

@ -21,6 +21,7 @@ from plugin import BasePlugin
import tabs
import string
import xhtml
import random
char_we_dont_want = string.punctuation+' ’„“”…«»'
@ -29,9 +30,10 @@ class Plugin(BasePlugin):
for tab_type in (tabs.MucTab, tabs.PrivateTab, tabs.ConversationTab):
self.api.add_tab_command(tab_type, 'stoi',
handler=self.stoi,
help="Repeats the last word of the last message "
"in the conversation, and use it in an "
"annoying “Cest toi le” sentence.",
help="Repeats the last word of the last "
"message in the conversation, and "
"use it in an annoying “Cest toi "
"le” sentence.",
short='Cest toi le stoi.')
def stoi(self, args):
@ -47,4 +49,10 @@ class Plugin(BasePlugin):
last_word = txt.split()[-1]
else:
last_word = "vide"
self.api.send_message("Cest toi le %s." % last_word)
intro = "C'est toi " if random.getrandbits(1) else "Stoi "
if last_word[0] in 'aeiouAEIOUÀàÉéÈè':
msg = intro + ('l%s' % last_word)
else:
msg = intro + ('le %s' % last_word)
self.api.send_message(msg)