mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-04 09:21:12 -05:00
OperUp: document plugin & wrap the longer lines
This commit is contained in:
parent
41a2c962ea
commit
10cdf34797
@ -1 +1 @@
|
|||||||
Insert a description of your plugin here, with any notes, etc. about using it.
|
Simple plugin that allows Supybot to oper up on configured networks, on connect and manually.
|
||||||
|
@ -46,16 +46,18 @@ def configure(advanced):
|
|||||||
from supybot.questions import expect, anything, something, yn
|
from supybot.questions import expect, anything, something, yn
|
||||||
conf.registerPlugin('OperUp', True)
|
conf.registerPlugin('OperUp', True)
|
||||||
|
|
||||||
|
|
||||||
OperUp = conf.registerPlugin('OperUp')
|
OperUp = conf.registerPlugin('OperUp')
|
||||||
conf.registerGlobalValue(OperUp, 'operName',
|
conf.registerGlobalValue(OperUp, 'operName',
|
||||||
registry.String("", _("""Specifies the name of the Oper block the bot will use."""), private=True))
|
registry.String("", _("""Specifies the name of the Oper block the bot will
|
||||||
|
use."""), private=True))
|
||||||
conf.registerGlobalValue(OperUp, 'operPass',
|
conf.registerGlobalValue(OperUp, 'operPass',
|
||||||
registry.String("", _("""Specifies the password of the Oper block the bot will use."""), private=True))
|
registry.String("", _("""Specifies the password of the Oper block the bot
|
||||||
|
will use."""), private=True))
|
||||||
conf.registerGlobalValue(OperUp, 'operNets',
|
conf.registerGlobalValue(OperUp, 'operNets',
|
||||||
registry.SpaceSeparatedListOfStrings("", _("""Space separated list of network names to Oper up on (denoted by 005 name)"""), private=True))
|
registry.SpaceSeparatedListOfStrings("", _("""Space separated list of
|
||||||
|
network names to Oper up on (denoted by 005 name)"""), private=True))
|
||||||
conf.registerGlobalValue(OperUp, 'operModes',
|
conf.registerGlobalValue(OperUp, 'operModes',
|
||||||
registry.SpaceSeparatedListOfStrings("", _("""Specifies the mode(s) the bot will set on itself when it Opers up."""), private=True))
|
registry.SpaceSeparatedListOfStrings("", _("""Specifies the mode(s) the
|
||||||
|
bot will set on itself when it Opers up."""), private=True))
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -43,48 +43,67 @@ except:
|
|||||||
_ = lambda x:x
|
_ = lambda x:x
|
||||||
|
|
||||||
class OperUp(callbacks.Plugin):
|
class OperUp(callbacks.Plugin):
|
||||||
"""Add the help for "@plugin help OperUp" here
|
"""Simple plugin that allows Supybot to oper up on configured networks, on
|
||||||
This should describe *how* to use this plugin."""
|
connect and manually."""
|
||||||
|
|
||||||
def do005(self, irc, msg):
|
def do005(self, irc, msg):
|
||||||
"""Oper up on connect."""
|
"""Oper up on connect."""
|
||||||
if irc.network in self.registryValue('operNets'):
|
if irc.network in self.registryValue('operNets'):
|
||||||
if self.registryValue("operName") and self.registryValue("operPass"):
|
if self.registryValue("operName") and \
|
||||||
irc.sendMsg(ircmsgs.IrcMsg(command="OPER", args=[self.registryValue("operName"), self.registryValue("operPass")]))
|
self.registryValue("operPass"):
|
||||||
|
irc.sendMsg(ircmsgs.IrcMsg(command="OPER",
|
||||||
|
args=[self.registryValue("operName"),
|
||||||
|
self.registryValue("operPass")]))
|
||||||
else:
|
else:
|
||||||
self.log.error("OperUp: Bot is set to oper on network %s, but operName and/or operPass are not defined!")
|
self.log.error("OperUp: Bot is set to oper on network %s, but"
|
||||||
|
" operName and/or operPass are not defined!")
|
||||||
|
|
||||||
def do381(self, irc, msg):
|
def do381(self, irc, msg):
|
||||||
self.log.info("OperUp: Received 381 (successfully opered up) from network %s." % irc.network)
|
self.log.info("OperUp: Received 381 (successfully opered up) from "
|
||||||
|
"network %s." % irc.network)
|
||||||
if self.registryValue("operModes"):
|
if self.registryValue("operModes"):
|
||||||
self.log.info("OperUp: Opered up on %s, sending user modes %s" % (irc.network, ''.join(self.registryValue("operModes"))))
|
self.log.info("OperUp: Opered up on %s, sending user modes %s"
|
||||||
irc.sendMsg(ircmsgs.mode(irc.nick, self.registryValue("operModes")))
|
% (irc.network, ''.join(self.registryValue("operModes"))))
|
||||||
|
irc.sendMsg(ircmsgs.mode(irc.nick,
|
||||||
|
self.registryValue("operModes")))
|
||||||
|
|
||||||
def do385(self, irc, msg):
|
def do385(self, irc, msg):
|
||||||
self.log.info("OperUp: Received 385 (not opered anymore) from network %s." % irc.network)
|
self.log.info("OperUp: Received 385 (not opered anymore) from network"
|
||||||
|
" %s." % irc.network)
|
||||||
|
|
||||||
def do461(self, irc, msg):
|
def do461(self, irc, msg):
|
||||||
self.log.warning("OperUp: Received 461 (some command needs more parameters) from network %s." % irc.network)
|
self.log.warning("OperUp: Received 461 (some command needs more "
|
||||||
|
"parameters) from network %s." % irc.network)
|
||||||
|
|
||||||
def do464(self, irc, msg):
|
def do464(self, irc, msg):
|
||||||
self.log.error("OperUp: Received 461 (password mismatch) from network %s." % irc.network)
|
self.log.error("OperUp: Received 461 (password mismatch) from "
|
||||||
|
"network %s." % irc.network)
|
||||||
|
|
||||||
def do481(self, irc, msg):
|
def do481(self, irc, msg):
|
||||||
self.log.warning("OperUp: Received 481 (missing oper privileges) from network %s." % irc.network)
|
self.log.warning("OperUp: Received 481 (missing oper privileges) "
|
||||||
|
"from network %s." % irc.network)
|
||||||
|
|
||||||
def do491(self, irc, msg):
|
def do491(self, irc, msg):
|
||||||
self.log.error("OperUp: Received 491 (server has been configured to disallow the your bot's host from opering) from network %s." % irc.network)
|
self.log.error("OperUp: Received 491 (server has been configured "
|
||||||
|
"to disallow the your bot's host from opering) from network %s." \
|
||||||
|
% irc.network)
|
||||||
|
|
||||||
def operup(self, irc, msg, args):
|
def operup(self, irc, msg, args):
|
||||||
"""Oper up."""
|
"""Oper up."""
|
||||||
if irc.network in self.registryValue('operNets'):
|
if irc.network in self.registryValue('operNets'):
|
||||||
if self.registryValue("operName") and self.registryValue("operPass"):
|
if self.registryValue("operName") and \
|
||||||
irc.sendMsg(ircmsgs.IrcMsg(command="OPER", args=[self.registryValue("operName"), self.registryValue("operPass")]))
|
self.registryValue("operPass"):
|
||||||
|
irc.sendMsg(ircmsgs.IrcMsg(command="OPER",
|
||||||
|
args=[self.registryValue("operName"),
|
||||||
|
self.registryValue("operPass")]))
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
else:
|
||||||
irc.error(_('Either the operName or the operPass configuration values were not properly defined. Please check to see these values are correct!'))
|
irc.error(_("Either the operName or the operPass "
|
||||||
|
"configuration values were not properly defined. Please "
|
||||||
|
"check to see these values are correct!"))
|
||||||
else:
|
else:
|
||||||
irc.error(_('This network is not configured for opering up! (see @config plugins.OperUp.opernets)'))
|
irc.error(_("This network is not configured for opering up! (see"
|
||||||
|
" @config plugins.OperUp.opernets)"))
|
||||||
operup = wrap(operup, ['owner'])
|
operup = wrap(operup, ['owner'])
|
||||||
|
|
||||||
def deoper(self, irc, msg, args):
|
def deoper(self, irc, msg, args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user