@@ -116,14 +116,22 @@ def on_pubmsg(self, c, e):
116
116
# Did someone mention my name?
117
117
if line .lower ().find (self .connection .get_nickname ().lower ()) != - 1 :
118
118
if DEBUG : print ("Whoopie, someone said my name!!!" )
119
- c .privmsg (e .target (),"Wie kann ich dienen?" )
120
-
121
- # Shall I do some maths?
122
- if line .lower ().startswith ("calc " ):
123
- self .do_math (c , e , line .split (None ,1 )[1 ])
119
+
120
+ # Shall I do some maths?
121
+ if line .split (None ,1 )[- 1 ].lower ().startswith ("calc " ):
122
+ msg = self .do_math (line .split (None ,2 )[- 1 ])
123
+
124
+ # Did someone say something interesting to respond to?
125
+ else :
126
+ msg = self .responder .respond_to (line )
127
+
128
+ if msg :
129
+ c .privmsg (e .target (),msg )
130
+ else :
131
+ #msg = "Wie kann ich dienen?"
132
+ #c.privmsg(e.target(),msg)
133
+ pass
124
134
125
- # Did someone say something interesting to respond to?
126
- self .responder .respond_to (c , e , line )
127
135
return
128
136
129
137
def on_privmsg (self , c , e ):
@@ -160,13 +168,13 @@ def on_privmsg(self, c, e):
160
168
161
169
return
162
170
163
- def do_math (self ,c , e , expr ):
171
+ def do_math (self ,expr ):
164
172
"""
165
173
Just generate a link to Wolfram Alpha containing the given expression
166
174
"""
167
175
url = "http://www.wolframalpha.com/input/?i=%s" % quote (expr )
168
- c . privmsg ( e . target (), "I'm not that good at maths... Try it here: %s" % url )
169
- return
176
+
177
+ return "I'm not that good at maths... Try it here: %s" % url
170
178
171
179
def help (self ,c ,e ):
172
180
"""
@@ -202,7 +210,7 @@ def on_join(self,c,e):
202
210
if DEBUG : print nick + " joined"
203
211
204
212
if nick != c .get_nickname ():
205
- c .privmsg (channel ,"Hello %s" % nick )
213
+ # c.privmsg(channel,"Hello %s" % nick)
206
214
level = dbstuff .getLevel (channel ,host )
207
215
if DEBUG : print ("level: %s on %s in %s has %s" % (nick , host , channel , level ))
208
216
if (level == "v" ) or (level == "o" ):
0 commit comments