Skip to content

Commit 068a6ee

Browse files
committed
WATMAN - minor fix
1 parent d5fca68 commit 068a6ee

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

bot_core/irc_bot.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,27 @@ def privmsg(self, user, channel, msg):
7676
# pattern for matching the bot's nick
7777
nickname_pattern = re.compile(n + "(:|,)?\s", flags=re.IGNORECASE)
7878
hello_pattern = re.compile("(hi|hello|ciao|hola|aloha)\s" + n + "(!|\s)?$", flags=re.IGNORECASE)
79-
bravo_pattern = re.compile("(bravo|great)\s" + n + "(!|\s)?$", flags=re.IGNORECASE)
80-
79+
bravo_pattern = re.compile("(bravo|great|good)\s" + n + "(!|\s)?$", flags=re.IGNORECASE)
80+
ins = "([sf]uc|vaff|bastar|pezzo di m|coglio)"
81+
insult_pattern = re.compile( ins+"(.*)"+n, re.IGNORECASE)
82+
83+
if insult_pattern.search(msg):
84+
self.msg(channel, "%s: jsc -e '{} + []'? HTH >> http://tiny.cc/watman" % user)
85+
vengeance = threads.deferToThread( self.karma_manager.update_karma, user, plus=False, defense=-5 )
86+
vengeance.addCallback(self.threadSafeMsg)
8187
# Check if you are talking with BOT
82-
if nickname_pattern.match(msg):
83-
#self.msg(channel, "%s: I am BOT, do not waste your time!" % user)
88+
elif nickname_pattern.match(msg):
8489
deferred_reddit = threads.deferToThread(self.reddit.retrieve_hot, rand=True, nick=user)
8590
deferred_reddit.addCallback(self.threadSafeMsg)
86-
87-
elif msg.startswith('!'):
88-
self.evaluate_command(user, channel, msg)
8991
elif re.match(re.compile('\w+\+\+$|\w+--$'), msg):
9092
self.karma_update(user, channel, msg)
9193
elif hello_pattern.match(msg):
9294
polite_msg = self.welcome_machine.ciao(user)
9395
self.msg(channel, polite_msg)
9496
elif bravo_pattern.match(msg):
9597
self.msg(channel, "No hay problema %s ;)" % user)
98+
elif msg.startswith('!'):
99+
self.evaluate_command(user, channel, msg)
96100

97101

98102
def evaluate_command(self, user, channel, msg):
@@ -110,17 +114,13 @@ def evaluate_command(self, user, channel, msg):
110114
reddit_pattern = re.compile("!reddit\s?(\d+|\d+\s\w+)?$", flags = re.IGNORECASE)
111115
msg_splits = msg.split()
112116

113-
# check for commands starting with bang!
114117
if msg.startswith('!karma'):
115-
116118
if len(msg_splits) == 1:
117119
fetch_user = user
118120
elif len(msg_splits) == 2:
119121
fetch_user = msg_splits[1]
120122
else: # !karma first two etc
121123
return
122-
123-
# self.msg(channel, self.karma_manager.fetch_karma(fetch_user))
124124
# Deferred call
125125
deferred_fetch = threads.deferToThread(self.karma_manager.fetch_karma, nick=fetch_user)
126126
deferred_fetch.addCallback(self.threadSafeMsg)

0 commit comments

Comments
 (0)