mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-29 06:51:10 -05:00
RelayNext: make options configurable
This commit is contained in:
parent
3419de9127
commit
169c1873dc
@ -38,6 +38,7 @@ except:
|
|||||||
# without the i18n module
|
# without the i18n module
|
||||||
_ = lambda x: x
|
_ = lambda x: x
|
||||||
|
|
||||||
|
|
||||||
def configure(advanced):
|
def configure(advanced):
|
||||||
# This will be called by supybot to configure this module. advanced is
|
# This will be called by supybot to configure this module. advanced is
|
||||||
# a bool that specifies whether the user identified themself as an advanced
|
# a bool that specifies whether the user identified themself as an advanced
|
||||||
@ -48,9 +49,17 @@ def configure(advanced):
|
|||||||
|
|
||||||
|
|
||||||
RelayNext = conf.registerPlugin('RelayNext')
|
RelayNext = conf.registerPlugin('RelayNext')
|
||||||
# This is where your configuration variables (if any) should go. For example:
|
|
||||||
# conf.registerGlobalValue(RelayNext, 'someConfigVariableName',
|
conf.registerChannelValue(RelayNext, 'color',
|
||||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
@ -48,6 +48,7 @@ except ImportError:
|
|||||||
# without the i18n module
|
# without the i18n module
|
||||||
_ = lambda x: x
|
_ = lambda x: x
|
||||||
|
|
||||||
|
|
||||||
filename = conf.supybot.directories.data.dirize("RelayNext.db")
|
filename = conf.supybot.directories.data.dirize("RelayNext.db")
|
||||||
|
|
||||||
class RelayNext(callbacks.Plugin):
|
class RelayNext(callbacks.Plugin):
|
||||||
@ -69,7 +70,8 @@ class RelayNext(callbacks.Plugin):
|
|||||||
with open(filename, 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
pickle.dump(self.db, f, 2)
|
pickle.dump(self.db, f, 2)
|
||||||
except Exception as e:
|
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):
|
def __init__(self, irc):
|
||||||
self.__parent = super(RelayNext, self)
|
self.__parent = super(RelayNext, self)
|
||||||
@ -145,10 +147,10 @@ class RelayNext(callbacks.Plugin):
|
|||||||
s = ''
|
s = ''
|
||||||
nick = msg.nick
|
nick = msg.nick
|
||||||
userhost = ''
|
userhost = ''
|
||||||
noHighlight = True
|
|
||||||
useHostmask = True
|
|
||||||
color = True
|
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
|
noHighlight = self.registryValue('noHighlight', channel)
|
||||||
|
useHostmask = self.registryValue('hostmasks', channel)
|
||||||
|
color = self.registryValue('color', channel)
|
||||||
netname = irc.network.lower()
|
netname = irc.network.lower()
|
||||||
|
|
||||||
if color:
|
if color:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user