diff options
author | mathieui <mathieui@mathieui.net> | 2018-08-15 13:13:17 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-08-15 13:13:17 +0200 |
commit | 6e13b8b73572f9c0ac9b5c683b98a475afbeab38 (patch) | |
tree | 7dae86588339a8cf144b2d98c9280f28646341a9 /plugins/replace.py | |
parent | d1b624753bb5371cf287cc9d86bb685593a99315 (diff) | |
download | poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.gz poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.bz2 poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.xz poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.zip |
yapf -rip on plugins
Diffstat (limited to 'plugins/replace.py')
-rw-r--r-- | plugins/replace.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/replace.py b/plugins/replace.py index 1949bd6a..3202721c 100644 --- a/plugins/replace.py +++ b/plugins/replace.py @@ -60,6 +60,7 @@ import random import re from slixmpp.xmlstream.stanzabase import JID + class Plugin(BasePlugin): def init(self): self.patterns = {} @@ -81,20 +82,22 @@ class Plugin(BasePlugin): for pattern in self.patterns: new = body body = re.sub('%%%s%%' % pattern, - lambda x: self.patterns[pattern](message, tab), - body) + lambda x: self.patterns[pattern](message, tab), body) message['body'] = body def replace_time(message, tab): return datetime.datetime.now().strftime("%X") + def replace_date(message, tab): return datetime.datetime.now().strftime("%x") + def replace_datetime(message, tab): return datetime.datetime.now().strftime("%c") + def replace_random_user(message, tab): if isinstance(tab, tabs.MucTab): return random.choice(tab.users).nick @@ -105,5 +108,6 @@ def replace_random_user(message, tab): # ConversationTab anyway? return str(tab.name) + def replace_dice(message, tab): return str(random.randrange(1, 7)) |