@@ -76,23 +76,29 @@ def privmsg(self, user, channel, msg):
76
76
# pattern for matching the bot's nick
77
77
nickname_pattern = re .compile (n + "(:|,)?\s" , flags = re .IGNORECASE )
78
78
hello_pattern = re .compile ("(hi|hello|ciao|hola|aloha)\s" + n + "(!|\s)?$" , flags = re .IGNORECASE )
79
+ goodbye_pattern = re .compile ("(goodbye|bye|see you|see ya|see u)\s" + n + "(!|\s)?$" , flags = re .IGNORECASE )
79
80
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
81
83
- if insult_pattern .search (msg ):
84
- self .msg (channel , "%s: jsc -e '{} + []'? HTH >> http://tiny.cc/watman" % user )
85
- vengeance = threads .deferToThread ( self .data_manager .update_karma , user , plus = False , defense = - 5 )
86
- vengeance .addCallback (self .threadSafeMsg )
82
+ # TODO (sentenza) fix this check
83
+ #ins = "([sf]uc|vaff|bastar|pezzo di m|coglio)"
84
+ #insult_pattern = re.compile( ins+"(.*)"+n, re.IGNORECASE)
85
+
86
+ #if insult_pattern.search(msg):
87
+ # self.msg(channel, "%s: jsc -e '{} + []'? HTH >> http://tiny.cc/watman" % user)
88
+ # vengeance = threads.deferToThread( self.data_manager.update_karma, user, plus=False, defense=-5 )
89
+ # vengeance.addCallback(self.threadSafeMsg)
90
+
87
91
# Check if you are talking with BOT
88
- elif nickname_pattern .match (msg ):
92
+ if nickname_pattern .match (msg ):
89
93
deferred_reddit = threads .deferToThread (self .reddit .retrieve_hot , rand = True , nick = user )
90
94
deferred_reddit .addCallback (self .threadSafeMsg )
91
95
elif re .match (re .compile ('[\w`]+\+\+$|[\w`]+--$' , re .I ), msg ):
92
96
self .karma_update (user , channel , msg )
93
97
elif hello_pattern .match (msg ):
94
98
polite_msg = self .welcome_machine .ciao (user )
95
99
self .msg (channel , polite_msg )
100
+ elif goodbye_pattern .match (msg ):
101
+ self .msg (channel , "Hasta la vista, %s." % user )
96
102
elif bravo_pattern .match (msg ):
97
103
self .msg (channel , "No hay problema %s ;)" % user )
98
104
elif msg .startswith ('!' ):
@@ -116,7 +122,7 @@ def evaluate_command(self, user, channel, msg):
116
122
117
123
if re .match (re .compile ("!(karma|k)(\s)*" , re .IGNORECASE ), msg ):
118
124
if len (msg_splits ) == 1 :
119
- fetch_word = user
125
+ fetch_word = user . lower ()
120
126
elif len (msg_splits ) == 2 :
121
127
fetch_word = msg_splits [1 ].lower ()
122
128
else : # !karma first two etc
0 commit comments