mirror of
https://github.com/progval/Limnoria.git
synced 2025-05-02 16:31:09 -05:00
Fixed supybot.channels to use an IrcSet instead of a list.
This commit is contained in:
parent
3b899fd5c0
commit
1264f21f23
@ -67,7 +67,7 @@ def configure(advanced):
|
|||||||
|
|
||||||
conf.registerPlugin('Parter')
|
conf.registerPlugin('Parter')
|
||||||
conf.registerGlobalValue(conf.supybot.plugins.Parter, 'channels',
|
conf.registerGlobalValue(conf.supybot.plugins.Parter, 'channels',
|
||||||
conf.SpaceSeparatedListOfChannels([], """Determines what channels the bot
|
conf.SpaceSeparatedSetOfChannels([], """Determines what channels the bot
|
||||||
will automatically part whenever it joins them."""))
|
will automatically part whenever it joins them."""))
|
||||||
|
|
||||||
class Parter(callbacks.Privmsg):
|
class Parter(callbacks.Privmsg):
|
||||||
|
@ -63,7 +63,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
self.joins = {}
|
self.joins = {}
|
||||||
|
|
||||||
def do376(self, irc, msg):
|
def do376(self, irc, msg):
|
||||||
channels = conf.supybot.channels()
|
channels = list(conf.supybot.channels())
|
||||||
utils.sortBy(lambda s: ',' not in s, channels)
|
utils.sortBy(lambda s: ',' not in s, channels)
|
||||||
keys = []
|
keys = []
|
||||||
chans = []
|
chans = []
|
||||||
@ -132,7 +132,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if conf.supybot.alwaysJoinOnInvite() or \
|
if conf.supybot.alwaysJoinOnInvite() or \
|
||||||
ircdb.checkCapability(msg.prefix, 'admin'):
|
ircdb.checkCapability(msg.prefix, 'admin'):
|
||||||
irc.queueMsg(ircmsgs.join(channel))
|
irc.queueMsg(ircmsgs.join(channel))
|
||||||
conf.supybot.channels().append(channel)
|
conf.supybot.channels().add(channel)
|
||||||
|
|
||||||
def join(self, irc, msg, args):
|
def join(self, irc, msg, args):
|
||||||
"""<channel>[,<key>] [<channel>[,<key>] ...]
|
"""<channel>[,<key>] [<channel>[,<key>] ...]
|
||||||
@ -157,7 +157,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if not ircutils.isChannel(channel):
|
if not ircutils.isChannel(channel):
|
||||||
irc.error('%r is not a valid channel.' % channel)
|
irc.error('%r is not a valid channel.' % channel)
|
||||||
return
|
return
|
||||||
conf.supybot.channels().append(original)
|
conf.supybot.channels().add(original)
|
||||||
irc.queueMsg(ircmsgs.joins(channels, keys))
|
irc.queueMsg(ircmsgs.joins(channels, keys))
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
self.joins[channel] = (irc, msg)
|
self.joins[channel] = (irc, msg)
|
||||||
|
@ -108,13 +108,14 @@ what server the bot connects to."""))
|
|||||||
supybot.register('password', registry.String('', """Determines the password to
|
supybot.register('password', registry.String('', """Determines the password to
|
||||||
be sent to the server if it requires one."""))
|
be sent to the server if it requires one."""))
|
||||||
|
|
||||||
class SpaceSeparatedListOfChannels(registry.SeparatedListOf):
|
class SpaceSeparatedSetOfChannels(registry.SeparatedListOf):
|
||||||
|
List = ircutils.IrcSet
|
||||||
Value = ValidChannel
|
Value = ValidChannel
|
||||||
def splitter(self, s):
|
def splitter(self, s):
|
||||||
return s.split()
|
return s.split()
|
||||||
joiner = ' '.join
|
joiner = ' '.join
|
||||||
|
|
||||||
supybot.register('channels', SpaceSeparatedListOfChannels(['#supybot'], """
|
supybot.register('channels', SpaceSeparatedSetOfChannels(['#supybot'], """
|
||||||
Determines what channels the bot will join when it connects to the server."""))
|
Determines what channels the bot will join when it connects to the server."""))
|
||||||
|
|
||||||
class ValidPrefixChars(registry.String):
|
class ValidPrefixChars(registry.String):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user