DrBotIRC: remove connection argument from reply()
we only have one connection, we don't need to be told what to reply to
This commit is contained in:
parent
456671615b
commit
e4225abba4
17
DrBotIRC.py
17
DrBotIRC.py
|
@ -390,25 +390,25 @@ class DrBotIRC(irclib.IRC):
|
|||
|
||||
self.config.set('Alias', whats[2], ' '.join(whats[3:]))
|
||||
replystr = "Added alias '{0:s}'.".format(whats[2])
|
||||
return self.reply(connection, event, replystr)
|
||||
return self.reply(event, replystr)
|
||||
if whats[0] == '!alias' and whats[1] == 'remove' and len(whats) >= 3:
|
||||
if not self.config.has_section('Alias'):
|
||||
self.config.add_section('Alias')
|
||||
|
||||
if self.config.remove_option('Alias', whats[2]):
|
||||
replystr = "Removed alias '{0:s}'.".format(whats[2])
|
||||
return self.reply(connection, event, replystr)
|
||||
return self.reply(event, replystr)
|
||||
elif whats[0] == '!alias' and whats[1] == 'list':
|
||||
try:
|
||||
if len(whats) > 2:
|
||||
alias = self.config.get('Alias', whats[2])
|
||||
return self.reply(connection, event, alias)
|
||||
return self.reply(event, alias)
|
||||
else:
|
||||
alist = self.config.options('Alias')
|
||||
alist.remove('debug')
|
||||
alist.sort()
|
||||
liststr = ', '.join(alist)
|
||||
return self.reply(connection, event, liststr)
|
||||
return self.reply(event, liststr)
|
||||
except NoSectionError: pass
|
||||
except NoOptionError: pass
|
||||
except NoSectionError: pass
|
||||
|
@ -524,11 +524,10 @@ class DrBotIRC(irclib.IRC):
|
|||
log.info("Bot shutting down.")
|
||||
sys.exit()
|
||||
|
||||
def reply(self, connection, event, replystr, stop=False):
|
||||
def reply(self, event, replystr, stop=False):
|
||||
"""Reply over IRC to replypath or return a string with the reply.
|
||||
|
||||
Args:
|
||||
connection source connection
|
||||
event incoming event
|
||||
replystr the message to reply with
|
||||
stop whether or not to let other handlers see this
|
||||
|
@ -541,8 +540,8 @@ class DrBotIRC(irclib.IRC):
|
|||
|
||||
replypath = event.target()
|
||||
|
||||
# check for privmsg
|
||||
if replypath == connection.get_nickname():
|
||||
# if this is a privmsg, reply to the sender
|
||||
if replypath == self.server.get_nickname():
|
||||
replypath = irclib.nm_to_n(event.source())
|
||||
|
||||
if replystr is not None:
|
||||
|
@ -551,7 +550,7 @@ class DrBotIRC(irclib.IRC):
|
|||
else:
|
||||
replies = replystr.split('\n')
|
||||
for reply in replies:
|
||||
connection.privmsg(replypath, reply)
|
||||
self.server.privmsg(replypath, reply)
|
||||
if stop:
|
||||
return "NO MORE"
|
||||
|
||||
|
|
Loading…
Reference in New Issue