mirror of https://github.com/Mikaela/Limnoria.git
Added a setValue option to setUserValue.
This commit is contained in:
parent
ae542511be
commit
6e6d619f48
|
@ -823,14 +823,24 @@ class Privmsg(irclib.IrcCallback):
|
||||||
group = group.get(name)
|
group = group.get(name)
|
||||||
return group.get(id)()
|
return group.get(id)()
|
||||||
|
|
||||||
def setUserValue(self, prefixOrName, name, value):
|
def setUserValue(self, prefixOrName, name, value,
|
||||||
|
ignoreNoUser=False, setValue=False):
|
||||||
|
try:
|
||||||
id = str(ircdb.users.getUserId(prefixOrName))
|
id = str(ircdb.users.getUserId(prefixOrName))
|
||||||
|
except KeyError:
|
||||||
|
if ignoreNoUser:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
raise
|
||||||
plugin = self.name()
|
plugin = self.name()
|
||||||
group = conf.users.plugins.get(plugin)
|
group = conf.users.plugins.get(plugin)
|
||||||
names = name.split('.')
|
names = name.split('.')
|
||||||
for name in names:
|
for name in names:
|
||||||
group = group.get(name)
|
group = group.get(name)
|
||||||
group = group.get(id)
|
group = group.get(id)
|
||||||
|
if setValue:
|
||||||
|
group.setValue(value)
|
||||||
|
else:
|
||||||
group.set(value)
|
group.set(value)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue