mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Reimplementation of channeldb converter, respecting the channelValueness of supybot.databases.plugins.channelSpecific, and turned supybot.databases.plugins.channelSpecific.channel into a channelValue so channels can link their databases to other channels.
This commit is contained in:
parent
d170a717d3
commit
af1d04291d
@ -238,14 +238,6 @@ def getBoolean(irc, msg, args, state):
|
||||
except ValueError:
|
||||
irc.errorInvalid('boolean', args[0])
|
||||
|
||||
def getChannelDb(irc, msg, args, state, **kwargs):
|
||||
if not conf.supybot.databases.plugins.channelSpecific():
|
||||
channel = conf.supybot.databases.plugins.channelSpecific.channel()
|
||||
state.args.append(channel)
|
||||
state.channel = channel
|
||||
else:
|
||||
getChannel(irc, msg, args, state, **kwargs)
|
||||
|
||||
def getNetworkIrc(irc, msg, args, state, errorIfNoMatch=False):
|
||||
if args:
|
||||
for otherIrc in world.ircs:
|
||||
@ -365,6 +357,18 @@ def getChannel(irc, msg, args, state):
|
||||
state.channel = channel
|
||||
state.args.append(channel)
|
||||
|
||||
def getChannelDb(irc, msg, args, state, **kwargs):
|
||||
channelSpecific = conf.supybot.databases.plugins.channelSpecific
|
||||
try:
|
||||
getChannel(irc, msg, args, state, **kwargs)
|
||||
if state.channel and not conf.get(channelSpecific, state.channel):
|
||||
state.channel = conf.get(channelSpecific.channel, state.channel)
|
||||
except (callbacks.ArgumentError, IndexError):
|
||||
if channelSpecific():
|
||||
raise
|
||||
else:
|
||||
state.channel = channelSpecific.channel()
|
||||
|
||||
def inChannel(irc, msg, args, state):
|
||||
if not state.channel:
|
||||
getChannel(irc, msg, args, state)
|
||||
|
@ -802,7 +802,7 @@ registerChannelValue(supybot.databases.plugins, 'channelSpecific',
|
||||
this variable to take effect; also note that you may wish to set
|
||||
supybot.databases.plugins.channelSpecific.channel appropriately if you
|
||||
wish to share a certain channel's databases globally."""))
|
||||
registerGlobalValue(supybot.databases.plugins.channelSpecific, 'channel',
|
||||
registerChannelValue(supybot.databases.plugins.channelSpecific, 'channel',
|
||||
ValidChannel('#', """Determines what channel global (non-channel-specific)
|
||||
databases will be considered a part of. This is helpful if you've been
|
||||
running channel-specific for awhile and want to turn the databases for your
|
||||
|
Loading…
Reference in New Issue
Block a user