From a1b20551276f2017256453304216988d6f094bd8 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 10 Apr 2014 19:34:26 +0200 Subject: =?UTF-8?q?Fix=20#2500=20(better=20=E2=80=9CC=E2=80=99est=20toi=20?= =?UTF-8?q?le=E2=80=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks, anonymous contributor --- plugins/stoi.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/stoi.py b/plugins/stoi.py index 56440db5..f0b863fe 100644 --- a/plugins/stoi.py +++ b/plugins/stoi.py @@ -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 “C’est toi le” sentence.", + help="Repeats the last word of the last " + "message in the conversation, and " + "use it in an annoying “C’est toi " + "le” sentence.", short='C’est 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("C’est 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) + -- cgit v1.2.3