mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Fixed bug #1027229 and cleaned up _chanservCommand a bit.
This commit is contained in:
parent
7e52305f35
commit
bae1972316
@ -406,15 +406,21 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
channel = msg.args[1] # nick is msg.args[0].
|
channel = msg.args[1] # nick is msg.args[0].
|
||||||
self.checkPrivileges(irc, channel)
|
self.checkPrivileges(irc, channel)
|
||||||
|
|
||||||
def _chanservCommand(self, irc, channel, command):
|
def _chanservCommand(self, irc, channel, command, log=False):
|
||||||
chanserv = self.registryValue('ChanServ')
|
chanserv = self.registryValue('ChanServ')
|
||||||
if chanserv:
|
if chanserv:
|
||||||
msg = ircmsgs.privmsg(chanserv,
|
msg = ircmsgs.privmsg(chanserv,
|
||||||
' '.join([command, channel, irc.nick]))
|
' '.join([command, channel, irc.nick]))
|
||||||
irc.sendMsg(msg)
|
irc.sendMsg(msg)
|
||||||
return True
|
|
||||||
else:
|
else:
|
||||||
return False
|
if log:
|
||||||
|
self.log.warning('Unable to send %s command to ChanServ, '
|
||||||
|
'you must set '
|
||||||
|
'supybot.plugins.Services.ChanServ before '
|
||||||
|
'I can send commands to ChanServ.', command)
|
||||||
|
else:
|
||||||
|
irc.error('You must set supybot.plugins.Services.ChanServ '
|
||||||
|
'before I\'m able to do get voiced.', Raise=True)
|
||||||
|
|
||||||
def op(self, irc, msg, args):
|
def op(self, irc, msg, args):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
@ -427,9 +433,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if irc.nick in irc.state.channels[channel].ops:
|
if irc.nick in irc.state.channels[channel].ops:
|
||||||
irc.error('I\'m already opped in %s.' % channel)
|
irc.error('I\'m already opped in %s.' % channel)
|
||||||
else:
|
else:
|
||||||
if not self._chanservCommand(irc, channel, 'op'):
|
self._chanservCommand(irc, channel, 'op')
|
||||||
irc.error('You must set supybot.plugins.Services.ChanServ '
|
|
||||||
'before I\'m able to do get opped.')
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error('I\'m not in %s.' % channel)
|
irc.error('I\'m not in %s.' % channel)
|
||||||
|
|
||||||
@ -444,18 +448,14 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if irc.nick in irc.state.channels[channel].voices:
|
if irc.nick in irc.state.channels[channel].voices:
|
||||||
irc.error('I\'m already voiced in %s.' % channel)
|
irc.error('I\'m already voiced in %s.' % channel)
|
||||||
else:
|
else:
|
||||||
if self._chanservCommand(irc, channel, 'voice'):
|
self._chanservCommand(irc, channel, 'voice')
|
||||||
irc.error('You must set supybot.plugins.Services.ChanServ '
|
|
||||||
'before I\'m able to do get voiced.')
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error('I\'m not in %s.' % channel)
|
irc.error('I\'m not in %s.' % channel)
|
||||||
|
|
||||||
def do474(self, irc, msg):
|
def do474(self, irc, msg):
|
||||||
channel = msg.args[1]
|
channel = msg.args[1]
|
||||||
self.log.info('Banned from %s, attempting ChanServ unban.', channel)
|
self.log.info('Banned from %s, attempting ChanServ unban.', channel)
|
||||||
if not self._chanservCommand(irc, channel, 'unban'):
|
self._chanservCommand(irc, channel, 'unban', log=True)
|
||||||
self.log.info('Unable to send unban command, '
|
|
||||||
'ChanServ is not configured.')
|
|
||||||
# Success log in doChanservNotice.
|
# Success log in doChanservNotice.
|
||||||
|
|
||||||
def unban(self, irc, msg, args):
|
def unban(self, irc, msg, args):
|
||||||
@ -468,20 +468,16 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
try:
|
try:
|
||||||
if self._chanservCommand(irc, channel, 'unban'):
|
self._chanservCommand(irc, channel, 'unban')
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
|
||||||
irc.error('You must set supybot.plugins.Services.ChanServ '
|
|
||||||
'before I\'m able to do get voiced.')
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error('I\'m not in %s.' % channel)
|
irc.error('I\'m not in %s.' % channel)
|
||||||
|
|
||||||
def do473(self, irc, msg):
|
def do473(self, irc, msg):
|
||||||
channel = msg.args[1]
|
channel = msg.args[1]
|
||||||
self.log.info('%s is +i, attempting ChanServ invite.', channel)
|
self.log.info('%s is +i, attempting ChanServ invite.', channel)
|
||||||
if not self._chanservCommand(irc, channel, 'invite'):
|
self._chanservCommand(irc, channel, 'invite', log=True)
|
||||||
self.log.info('Unable to send invite command, '
|
|
||||||
'ChanServ is not configured.')
|
|
||||||
def invite(self, irc, msg, args):
|
def invite(self, irc, msg, args):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
|
||||||
@ -492,11 +488,8 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
try:
|
try:
|
||||||
if self._chanservCommand(irc, channel, 'invite'):
|
self._chanservCommand(irc, channel, 'invite')
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
|
||||||
irc.error('You must set supybot.plugins.Services.ChanServ '
|
|
||||||
'before I\'m able to do get voiced.')
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error('I\'m not in %s.' % channel)
|
irc.error('I\'m not in %s.' % channel)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user