mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-28 22:41:06 -05:00
RelayNext: make options configurable
This commit is contained in:
parent
3419de9127
commit
169c1873dc
@ -36,7 +36,8 @@ try:
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x:x
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
@ -48,9 +49,17 @@ def configure(advanced):
|
||||
|
||||
|
||||
RelayNext = conf.registerPlugin('RelayNext')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(RelayNext, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
conf.registerChannelValue(RelayNext, 'color',
|
||||
registry.Boolean(True, _("""Determines whether the bot will color relayed
|
||||
PRIVMSGs so as to make the messages easier to read.""")))
|
||||
conf.registerChannelValue(RelayNext, 'hostmasks',
|
||||
registry.Boolean(True, _("""Determines whether the bot will relay the
|
||||
hostmask of the person joining or parting the channel when he or she joins
|
||||
or parts.""")))
|
||||
conf.registerChannelValue(RelayNext, 'noHighlight',
|
||||
registry.Boolean(False, _("""Determines whether the bot should prefix nicks
|
||||
with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions).""")))
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
@ -46,7 +46,8 @@ try:
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x:x
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
filename = conf.supybot.directories.data.dirize("RelayNext.db")
|
||||
|
||||
@ -69,7 +70,8 @@ class RelayNext(callbacks.Plugin):
|
||||
with open(filename, 'wb') as f:
|
||||
pickle.dump(self.db, f, 2)
|
||||
except Exception as e:
|
||||
self.log.warning('RelayNext: Unable to write pickled database: %s', e)
|
||||
self.log.warning('RelayNext: Unable to write pickled database: %s',
|
||||
e)
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(RelayNext, self)
|
||||
@ -145,10 +147,10 @@ class RelayNext(callbacks.Plugin):
|
||||
s = ''
|
||||
nick = msg.nick
|
||||
userhost = ''
|
||||
noHighlight = True
|
||||
useHostmask = True
|
||||
color = True
|
||||
channel = msg.args[0]
|
||||
noHighlight = self.registryValue('noHighlight', channel)
|
||||
useHostmask = self.registryValue('hostmasks', channel)
|
||||
color = self.registryValue('color', channel)
|
||||
netname = irc.network.lower()
|
||||
|
||||
if color:
|
||||
|
Loading…
x
Reference in New Issue
Block a user