mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Changed defaultHerald to default (now that channel values can have children) and added a public boolean for the default herald.
This commit is contained in:
parent
bd3e056be4
commit
452f23946d
@ -71,10 +71,13 @@ conf.registerChannelValue(conf.supybot.plugins.Herald, 'heralding',
|
|||||||
conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTime',
|
conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTime',
|
||||||
registry.PositiveInteger(600, """Determines the minimum number of seconds
|
registry.PositiveInteger(600, """Determines the minimum number of seconds
|
||||||
between heralds."""))
|
between heralds."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.Herald, 'defaultHerald',
|
conf.registerChannelValue(conf.supybot.plugins.Herald, 'default',
|
||||||
registry.String('', """Sets the default herald to use. If a user has a
|
registry.String('', """Sets the default herald to use. If a user has a
|
||||||
personal herald specified, that will be used instead. If set to the empty
|
personal herald specified, that will be used instead. If set to the empty
|
||||||
string, the default herald will be disabled."""))
|
string, the default herald will be disabled."""))
|
||||||
|
conf.registerChannelValue(conf.supybot.plugins.Herald.default, 'public',
|
||||||
|
registry.Boolean(False, """Determines whether the default herald will be
|
||||||
|
sent publicly."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTimeAfterPart',
|
conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTimeAfterPart',
|
||||||
registry.PositiveInteger(60, """Determines the minimum number of seconds
|
registry.PositiveInteger(60, """Determines the minimum number of seconds
|
||||||
after parting that the bot will not herald the person when he or she
|
after parting that the bot will not herald the person when he or she
|
||||||
@ -101,9 +104,12 @@ class Herald(callbacks.Privmsg):
|
|||||||
id = ircdb.users.getUserId(msg.prefix)
|
id = ircdb.users.getUserId(msg.prefix)
|
||||||
herald = self.db[channel, id]
|
herald = self.db[channel, id]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
default = self.registryValue('defaultHerald', channel)
|
default = self.registryValue('default', channel)
|
||||||
if default:
|
if default:
|
||||||
irc.queueMsg(ircmsgs.privmsg(msg.nick, default))
|
target = msg.nick
|
||||||
|
if self.registryValue('default.public', channel):
|
||||||
|
target = channel
|
||||||
|
irc.queueMsg(ircmsgs.privmsg(target, default))
|
||||||
return
|
return
|
||||||
now = time.time()
|
now = time.time()
|
||||||
throttle = self.registryValue('throttleTime', channel)
|
throttle = self.registryValue('throttleTime', channel)
|
||||||
@ -148,19 +154,19 @@ class Herald(callbacks.Privmsg):
|
|||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
for (option, _) in optlist:
|
for (option, _) in optlist:
|
||||||
if option == '--remove':
|
if option == '--remove':
|
||||||
conf.supybot.plugins.Herald.defaultHerald.set("")
|
self.setRegistryValue('default', '', channel)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
return
|
return
|
||||||
msg = privmsgs.getArgs(rest, required=0, optional=1)
|
text = privmsgs.getArgs(rest, required=0, optional=1)
|
||||||
if not msg:
|
if not text:
|
||||||
resp = self.registryValue('defaultHerald', channel)
|
resp = self.registryValue('default', channel)
|
||||||
if not resp:
|
if not resp:
|
||||||
irc.reply('I do not have a default herald set.')
|
irc.reply('I do not have a default herald set.')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
irc.reply(resp)
|
irc.reply(resp)
|
||||||
return
|
return
|
||||||
conf.supybot.plugins.Herald.defaultHerald.set(msg)
|
self.setRegistryValue('default', text, channel)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
|
||||||
def get(self, irc, msg, args):
|
def get(self, irc, msg, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user