summaryrefslogtreecommitdiff
path: root/plugins/replace.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/replace.py')
-rw-r--r--plugins/replace.py8
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))