diff options
author | Al Korgun <alkorgun@gmail.com> | 2012-11-18 05:33:35 +0400 |
---|---|---|
committer | Al Korgun <alkorgun@gmail.com> | 2012-11-18 05:33:35 +0400 |
commit | a3065ac48b232c846940ecb0bc51b7f85862ea63 (patch) | |
tree | 7d8db4f29e5e7b63fc7a8e2cd8973dd98d24cc3d | |
parent | 343ded2b4c4b1b153e4fe4359e852a437c9c49c9 (diff) |
added command taboo & search in affiliation lists
-rw-r--r-- | BlackSmith.py | 36 | ||||
-rw-r--r-- | expansions/allweb/code.py | 12 | ||||
-rw-r--r-- | expansions/cmd_control/code.py | 57 | ||||
-rw-r--r-- | expansions/cmd_control/insc.py | 16 | ||||
-rw-r--r-- | expansions/cmd_control/taboo.en | 8 | ||||
-rw-r--r-- | expansions/cmd_control/taboo.name | 4 | ||||
-rw-r--r-- | expansions/cmd_control/taboo.ru | 8 | ||||
-rw-r--r-- | expansions/converter/code.py | 17 | ||||
-rw-r--r-- | expansions/exp_control/command.en | 2 | ||||
-rw-r--r-- | expansions/get_iq/code.py | 106 | ||||
-rw-r--r-- | expansions/get_iq/insc.py | 6 | ||||
-rw-r--r-- | expansions/get_iq/list.en | 6 | ||||
-rw-r--r-- | expansions/get_iq/list.ru | 6 | ||||
-rw-r--r-- | expansions/info/code.py | 6 | ||||
-rw-r--r-- | expansions/muc/code.py | 18 | ||||
-rw-r--r-- | expansions/sheriff/code.py | 8 |
16 files changed, 231 insertions, 85 deletions
diff --git a/BlackSmith.py b/BlackSmith.py index 168149e..0752c06 100644 --- a/BlackSmith.py +++ b/BlackSmith.py @@ -72,7 +72,7 @@ Types = [ "request" # 22 ] -AflRoles = [ +aRoles = ( "affiliation", # 0 "outcast", # 1 "none", # 2 @@ -83,14 +83,14 @@ AflRoles = [ "visitor", # 7 "participant", # 8 "moderator" # 9 - ] + ) -sList = [ +sList = ( "chat", # готов поболтать "away", # отошел "xa", # не беспокоить "dnd" # недоступен - ] + ) aDesc = { "owner": 3, @@ -264,7 +264,7 @@ GenConFile = static % ("config.ini") ConDispFile = static % ("clients.ini") ChatsFile = dynamic % ("chats.db") -(BsMark, BsVer, BsRev) = (2, 34, 0) +(BsMark, BsVer, BsRev) = (2, 35, 0) if os.access(SvnCache, os.R_OK): Cache = open(SvnCache).readlines() @@ -759,31 +759,31 @@ class sConf(object): CallForResponse(self.disp, stanza, handler, kdesc) def outcast(self, jid, text = str(), handler = ()): - self.iq_sender(Types[19], jid, AflRoles[0], AflRoles[1], text, handler) + self.iq_sender(Types[19], jid, aRoles[0], aRoles[1], text, handler) def none(self, jid, text = str(), handler = ()): - self.iq_sender(Types[19], jid, AflRoles[0], AflRoles[2], text, handler) + self.iq_sender(Types[19], jid, aRoles[0], aRoles[2], text, handler) def member(self, jid, text = str(), handler = ()): - self.iq_sender(Types[19], jid, AflRoles[0], AflRoles[3], text, handler) + self.iq_sender(Types[19], jid, aRoles[0], aRoles[3], text, handler) def admin(self, jid, text = str(), handler = ()): - self.iq_sender(Types[19], jid, AflRoles[0], AflRoles[4], text, handler) + self.iq_sender(Types[19], jid, aRoles[0], aRoles[4], text, handler) def owner(self, jid, text = str(), handler = ()): - self.iq_sender(Types[19], jid, AflRoles[0], AflRoles[5], text, handler) + self.iq_sender(Types[19], jid, aRoles[0], aRoles[5], text, handler) def kick(self, nick, text = str(), handler = ()): - self.iq_sender(Types[20], nick, AflRoles[6], AflRoles[2], text, handler) + self.iq_sender(Types[20], nick, aRoles[6], aRoles[2], text, handler) def visitor(self, nick, text = str(), handler = ()): - self.iq_sender(Types[20], nick, AflRoles[6], AflRoles[7], text, handler) + self.iq_sender(Types[20], nick, aRoles[6], aRoles[7], text, handler) def participant(self, nick, text = str(), handler = ()): - self.iq_sender(Types[20], nick, AflRoles[6], AflRoles[8], text, handler) + self.iq_sender(Types[20], nick, aRoles[6], aRoles[8], text, handler) def moder(self, nick, text = str(), handler = ()): - self.iq_sender(Types[20], nick, AflRoles[6], AflRoles[9], text, handler) + self.iq_sender(Types[20], nick, aRoles[6], aRoles[9], text, handler) def get_source(source, nick): if Chats.has_key(source): @@ -1116,14 +1116,14 @@ class Web: if isNumber(size): size = int(size) else: - raise SelfExc("server gives no info about file size") + raise SelfExc("no info about file size") if not filename: if info.has_key("Content-Disposition"): disp = info.get("Content-Disposition") - comp = compile__("filename=[\"']?(.+?)[\"']?") + comp = compile__("filename=[\"']+?(.+?)[\"']+?") disp = comp.search(disp) if disp: - filename = disp.decode("utf-8") + filename = (disp.group(1)).decode("utf-8") if not filename: filename = self.One.unquote_plus(fp.url.split("/")[-1].split("?")[0].replace("%25", "%")) if not filename: @@ -1209,7 +1209,7 @@ def enumerated_list(list): ls.append(AnsBase[12] % (Numb.plus(), line)) return str.join(chr(10), ls) -isNumber = lambda obj: (None if exec_(int, (obj,)) is None else True) +isNumber = lambda obj: (not exec_(int, (obj,)) is None) isSource = lambda jid: IsJID.match(jid) diff --git a/expansions/allweb/code.py b/expansions/allweb/code.py index 91cfb67..204a1a3 100644 --- a/expansions/allweb/code.py +++ b/expansions/allweb/code.py @@ -1,8 +1,8 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "allweb" # /code.py v.x17 -# Id: 25~17b +exp_name = "allweb" # /code.py v.x18 +# Id: 25~18b # Code © (2011-2012) by WitcherGeralt [alkorgun@gmail.com] expansion_register(exp_name) @@ -128,10 +128,10 @@ class expansion_temp(expansion): else: try: list = data["responseData"]["results"] - except KeyError: + desc = list.pop(0) + except LookupError: answer = self.AnsBase[5] else: - desc = list.pop(0) ls = [] ls.append(desc.get("title", "")) ls.append(desc.get("content", "")) @@ -537,7 +537,7 @@ class expansion_temp(expansion): try: answer = data["errormessage"] except KeyError: - answer = self.AnsBase[5] + answer = self.AnsBase[1] else: answer = AnsBase[1] Answer(answer, ltype, source, disp) @@ -612,7 +612,7 @@ class expansion_temp(expansion): except Web.Two.HTTPError, exc: answer = str(exc) except SelfExc: - answer = exc_info()[1] + answer = "Error! %s." % exc_info()[1].capitalize() except: answer = self.AnsBase[0] else: diff --git a/expansions/cmd_control/code.py b/expansions/cmd_control/code.py new file mode 100644 index 0000000..834a593 --- /dev/null +++ b/expansions/cmd_control/code.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +# BlackSmith mark.2 +exp_name = "cmd_control" # /code.py v.x1 +# Id: 32~1b +# Code © (2012) by WitcherGeralt [alkorgun@gmail.com] + +expansion_register(exp_name) + +class expansion_temp(expansion): + + def __init__(self, name): + expansion.__init__(self, name) + + TabooFile = "taboo.db" + + def command_taboo(self, ltype, source, body, disp): + if Chats.has_key(source[1]): + oCmds = Chats[source[1]].oCmds + if body: + if enough_access(source[1], source[2], 6): + ls = body.split() + command = (ls.pop(0)).lower() + if Cmds.has_key(command): + if enough_access(source[1], source[2], Cmds[command].access): + if command not in sCmds: + if command in oCmds: + oCmds.remove(command) + answer = self.AnsBase[0] % (command) + else: + oCmds.append(command) + answer = self.AnsBase[1] % (command) + cat_file(chat_file(source[1], self.TabooFile), str(oCmds)) + else: + answer = self.AnsBase[2] + else: + answer = AnsBase[10] + else: + answer = AnsBase[6] + else: + answer = AnsBase[10] + elif oCmds: + answer = ", ".join(oCmds) + else: + answer = self.AnsBase[3] + else: + answer = AnsBase[0] + Answer(answer, ltype, source, disp) + + def init_taboo(self, conf): + filename = chat_file(conf, self.TabooFile) + if initialize_file(filename, "[]"): + Chats[conf].oCmds = eval(get_file(filename)) + + commands = ((command_taboo, "taboo", 1, False),) + + handlers = ((init_taboo, "01si"),) diff --git a/expansions/cmd_control/insc.py b/expansions/cmd_control/insc.py new file mode 100644 index 0000000..a7af727 --- /dev/null +++ b/expansions/cmd_control/insc.py @@ -0,0 +1,16 @@ +# coding: utf-8 + +if DefLANG in ("RU", "UA"): + AnsBase_temp = tuple([line.decode("utf-8") for line in ( + "Команда «%s» разрешена.", # 0 + "Команда «%s» запрещена.", # 1 + "Эта команда не может быть запрещена.", # 2 + "Нет запрещенных команд." # 3 + )]) +else: + AnsBase_temp = ( + "Command '%s' is allowed.", # 0 + "Command '%s' is forbidden.", # 1 + "This command can't be forbidden.", # 2 + "No forbidden commands." # 3 + )
\ No newline at end of file diff --git a/expansions/cmd_control/taboo.en b/expansions/cmd_control/taboo.en new file mode 100644 index 0000000..d3937ff --- /dev/null +++ b/expansions/cmd_control/taboo.en @@ -0,0 +1,8 @@ +control of the prohibition on the commands in the conference
+taboo (command)
+*/taboo
+bot would show the list of forbidden commands
+*/taboo bash
+bot would forbid command "bash"
+*/taboo bash
+bot would allow command "bash"
\ No newline at end of file diff --git a/expansions/cmd_control/taboo.name b/expansions/cmd_control/taboo.name new file mode 100644 index 0000000..07deea1 --- /dev/null +++ b/expansions/cmd_control/taboo.name @@ -0,0 +1,4 @@ +{
+ "RU": "табу",
+ "UA": "табу"
+}
\ No newline at end of file diff --git a/expansions/cmd_control/taboo.ru b/expansions/cmd_control/taboo.ru new file mode 100644 index 0000000..6d505a4 --- /dev/null +++ b/expansions/cmd_control/taboo.ru @@ -0,0 +1,8 @@ +запрет на использование команд в конференции
+табу (команда)
+*/табу
+бот покажет запрещенные команды
+*/табу баш
+бот запретит команду "баш"
+*/табу баш
+бот снимет запрет на команду "баш"
\ No newline at end of file diff --git a/expansions/converter/code.py b/expansions/converter/code.py index c677dce..d542d3b 100644 --- a/expansions/converter/code.py +++ b/expansions/converter/code.py @@ -1,8 +1,8 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "converter" # /code.py v.x3 -# Id: 31~2b +exp_name = "converter" # /code.py v.x4 +# Id: 31~3b # Code © (2012) by WitcherGeralt [alkorgun@gmail.com] expansion_register(exp_name) @@ -199,19 +199,20 @@ class expansion_temp(expansion): Desc = (ls.pop(0)).lower() if self.CrDesc.has_key(Desc): if len(ls) == 3: - Numb = (ls.pop(0)).lower() - if isNumber(Numb): + try: + Number = float(ls.pop(0)) + except ValueError: + answer = AnsBase[30] + else: Type = (ls.pop(0)).lower() ToType = (ls.pop(0)).lower() if self.CrDesc[Desc].has_key(Type) and self.CrDesc[Desc].has_key(ToType): if Desc == "temperature": - answer = str(self.ConvertTemp(float(Numb), Type, ToType)) + answer = str(self.ConvertTemp(Number, Type, ToType)) else: - answer = str(self.Convert(Desc, float(Numb), Type, ToType)) + answer = str(self.Convert(Desc, Number, Type, ToType)) else: answer = self.AnsBase[0] - else: - answer = AnsBase[30] elif not ls: data = get_file(self.file).decode("utf-8") data = get_text(data, '\t\t"%s"\:\s\{' % (Desc), '\},') diff --git a/expansions/exp_control/command.en b/expansions/exp_control/command.en index 8df5aeb..24241cd 100644 --- a/expansions/exp_control/command.en +++ b/expansions/exp_control/command.en @@ -1,4 +1,4 @@ -commands controller
+controller of the commands
command [command] [on/off]
*/command talkers off
bot would disable command "talkers"
diff --git a/expansions/get_iq/code.py b/expansions/get_iq/code.py index 51105b2..be02b2a 100644 --- a/expansions/get_iq/code.py +++ b/expansions/get_iq/code.py @@ -1,8 +1,8 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "get_iq" # /code.py v.x4 -# Id: 13~3b +exp_name = "get_iq" # /code.py v.x5 +# Id: 13~4b # Code © (2010-2011) by WitcherGeralt [alkorgun@gmail.com] expansion_register(exp_name) @@ -57,6 +57,7 @@ class expansion_temp(expansion): xname = x.getName() if xname == "name": Name = x.getData() + break answer = self.AnsBase[1] % (Name, str(answer)) else: answer = self.AnsBase[2] @@ -152,39 +153,73 @@ class expansion_temp(expansion): answer = self.AnsBase[6] Answer(answer, ltype, source, disp) - def command_afls(self, ltype, source, body, disp): + affs = ("owner", "admin", "member", "outcast") + + def command_aflist(self, ltype, source, body, disp): def get_req(body): - afls = ("owner", "admin", "member", "outcast") if DefLANG in ("RU", "UA"): - alsRU = [afl.decode("utf-8") for afl in ("овнер", "админ", "мембер", "бан")] - for afl in alsRU: - if body.count(afl): - return afls[alsRU.index(afl)] - return (body if afls.count(body) else None) + affsRU = ["овнер", "админ", "мембер", "бан"] + for name in affsRU: + if body.count(name.decode("utf-8")): + return self.affs[affsRU.index(name)] + return (body if self.affs.count(body) else None) if Chats.has_key(source[1]): if body: - list = body.split() - body = get_req((list.pop(0)).lower()) - if body: - Numb = 0 - if list: - if isNumber(list[0]): - x = int(list.pop(0)) - if x < 20: - Numb = 20 - else: - Numb = x - iq = xmpp.Iq(to = source[1], typ = Types[10]) - query = xmpp.Node(Types[18]) - query.setNamespace(xmpp.NS_MUC_ADMIN) - query.addChild("item", {AflRoles[0]: body}) - iq.addChild(node = query) - iq.setID("Bs-i%d" % Info["outiq"].plus()) - CallForResponse(disp, iq, self.answer_afls, {"ltype": ltype, "source": source, "Numb": Numb}) + ls = body.split() + body = (ls.pop(0)).lower() + if body in ("search", "искать".decode("utf-8")): + if ls: + data = (ls.pop(0)).lower() + desc = {} + for name in self.affs: + iq = xmpp.Iq(to = source[1], typ = Types[10]) + query = xmpp.Node(Types[18]) + query.setNamespace(xmpp.NS_MUC_ADMIN) + query.addChild("item", {aRoles[0]: name}) + iq.addChild(node = query) + iq.setID("Bs-i%d" % Info["outiq"].plus()) + CallForResponse(disp, iq, self.answer_aflist_search, {"desc": desc, "name": name, "data": data}) + for x in xrange(60): + time.sleep(0.2) + if len(desc.keys()) == 4: + break + Number = itypes.Number() + ls = [] + for name, matches in desc.iteritems(): + if matches: + ls.append(name.capitalize() + "s:") + for jid in matches: + ls.append("%d) %s" % (Number.plus(), jid)) + if ls: + Message(source[0], str.join(chr(10), ls), disp) + if ltype == Types[1]: + answer = AnsBase[11] + else: + answer = self.AnsBase[9] + else: + answer = AnsBase[2] else: - answer = AnsBase[2] + body = get_req(body) + if body: + Numb = 0 + if ls: + if isNumber(ls[0]): + x = int(ls.pop(0)) + if x < 20: + Numb = 20 + else: + Numb = x + iq = xmpp.Iq(to = source[1], typ = Types[10]) + query = xmpp.Node(Types[18]) + query.setNamespace(xmpp.NS_MUC_ADMIN) + query.addChild("item", {aRoles[0]: body}) + iq.addChild(node = query) + iq.setID("Bs-i%d" % Info["outiq"].plus()) + CallForResponse(disp, iq, self.answer_aflist, {"ltype": ltype, "source": source, "Numb": Numb}) + else: + answer = AnsBase[2] else: answer = AnsBase[1] else: @@ -192,7 +227,18 @@ class expansion_temp(expansion): if locals().has_key(Types[12]): Answer(answer, ltype, source, disp) - def answer_afls(self, disp, stanza, ltype, source, Numb): + def answer_aflist_search(self, disp, stanza, desc, name, data): + if xmpp.isResultNode(stanza): + matches = [] + for node in stanza.getChildren(): + for node in node.getChildren(): + if node and node != "None": + jid = node.getAttr("jid") + if jid and jid.count(data): + matches.append(jid) + desc[name] = matches + + def answer_aflist(self, disp, stanza, ltype, source, Numb): if xmpp.isResultNode(stanza): Number, answer = itypes.Number(), str() for node in stanza.getChildren(): @@ -228,5 +274,5 @@ class expansion_temp(expansion): (command_version, "version", 1,), (command_uptime, "uptime", 1,), (command_idle, "idle", 1,), - (command_afls, "list", 4,) + (command_aflist, "list", 4,) ) diff --git a/expansions/get_iq/insc.py b/expansions/get_iq/insc.py index cf0fdf4..64df36e 100644 --- a/expansions/get_iq/insc.py +++ b/expansions/get_iq/insc.py @@ -10,7 +10,8 @@ if DefLANG in ("RU", "UA"): "«%s» - сейчас нет в чате.", # 5 "Нет ответа.", # 6 "Время работы «%s» - %s.", # 7 - "Послеедняя активность «%s» - %s назад." # 8 + "Послеедняя активность «%s» - %s назад.", # 8 + "Нет cовпадений." # 9 )]) else: AnsBase_temp = ( @@ -22,5 +23,6 @@ else: "«%s» - isn't here now.", # 5 "No answer.", # 6 "%s's uptime is %s.", # 7 - "%s's last activity was %s ago." # 8 + "%s's last activity was %s ago.", # 8 + "No matches." # 9 )
\ No newline at end of file diff --git a/expansions/get_iq/list.en b/expansions/get_iq/list.en index ff9e1f7..46a2d3e 100644 --- a/expansions/get_iq/list.en +++ b/expansions/get_iq/list.en @@ -1,4 +1,6 @@ affiliation lists
-list [owner/admin/member/outcast]
+list [owner/admin/member/outcast]/[[search] [text]]
*/list owner
-bot would show list of conference's owners
\ No newline at end of file +bot would show list of conference's owners
+*/list search dude
+bot would search "dude" in chat's affiliation lists
\ No newline at end of file diff --git a/expansions/get_iq/list.ru b/expansions/get_iq/list.ru index 3ba0d20..bf2b9f5 100644 --- a/expansions/get_iq/list.ru +++ b/expansions/get_iq/list.ru @@ -1,4 +1,6 @@ списки аффиляций
-список [овнеров/админов/мемберов/бани]
+список [овнеров/админов/мемберов/бани]/[[искать] [текст]]
*/список мемберов
-бот покажет список постоянных участников конференции
\ No newline at end of file +бот покажет список постоянных участников конференции
+*/список искать dude
+бот будет искать "dude" в списках аффиляций
\ No newline at end of file diff --git a/expansions/info/code.py b/expansions/info/code.py index 2613654..d4dc4ca 100644 --- a/expansions/info/code.py +++ b/expansions/info/code.py @@ -32,11 +32,11 @@ class expansion_temp(expansion): text = nick.nick if acc and nick.source: text += " (%s)" % (nick.source) - if nick.role[0] == AflRoles[5]: + if nick.role[0] == aRoles[5]: owners.append(text) - elif nick.role[0] == AflRoles[4]: + elif nick.role[0] == aRoles[4]: admins.append(text) - elif nick.role[0] == AflRoles[3]: + elif nick.role[0] == aRoles[3]: members.append(text) else: none.append(text) diff --git a/expansions/muc/code.py b/expansions/muc/code.py index 431a443..94d8f5f 100644 --- a/expansions/muc/code.py +++ b/expansions/muc/code.py @@ -32,7 +32,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -71,7 +71,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -110,7 +110,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -149,7 +149,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -188,7 +188,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -227,7 +227,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -265,7 +265,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -303,7 +303,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: @@ -340,7 +340,7 @@ class expansion_temp(expansion): if body: if Chats[source[1]].isModer: Lock, BsNick = False, get_self_nick(source[1]) - if getattr(Chats[source[1]].get_user(BsNick), "role", (AflRoles[5],))[0] == AflRoles[5]: + if getattr(Chats[source[1]].get_user(BsNick), "role", (aRoles[5],))[0] == aRoles[5]: if not enough_access(source[1], source[2], 6): Lock = True if not Lock: diff --git a/expansions/sheriff/code.py b/expansions/sheriff/code.py index cce0092..1e616a9 100644 --- a/expansions/sheriff/code.py +++ b/expansions/sheriff/code.py @@ -344,7 +344,7 @@ class expansion_temp(expansion): GoodServers__ = lambda self, conf: (self.GoodServers + ChatsAttrs[conf]["laws"]["list"] + [self.get_server(conf, True)]) def check_wipe(self, conf, nick, role, inst): - if role == AflRoles[2]: + if role == aRoles[2]: BsNick = get_self_nick(conf) if ChatsAttrs[conf]["laws"]["sparta"]: jid = self.get_server(inst) @@ -372,7 +372,7 @@ class expansion_temp(expansion): ls = [] for sUser in Chats[conf].get_users(): if sUser.source and sUser.ishere: - if sUser.nick != BsNick and sUser.role[0] == AflRoles[2]: + if sUser.nick != BsNick and sUser.role[0] == aRoles[2]: if jid == self.get_server(sUser.source): if self.Federal_Jail[conf].has_key(sUser.source): if not self.Federal_Jail[conf][sUser.source].verif: @@ -384,7 +384,7 @@ class expansion_temp(expansion): else: for sUser in Chats[conf].get_users(): if sUser.source and sUser.ishere: - if sUser.nick != BsNick and sUser.role[0] == AflRoles[2]: + if sUser.nick != BsNick and sUser.role[0] == aRoles[2]: if jid == self.get_server(sUser.source): if self.Federal_Jail[conf].has_key(sUser.source): if not self.Federal_Jail[conf][sUser.source].verif: @@ -417,7 +417,7 @@ class expansion_temp(expansion): prisoner.Autenticated() self.check_wipe(conf, nick, role[0], source_) self.check_nick(conf, nick) - if ChatsAttrs[conf]["laws"]["verif"] and access < 2 and AflRoles[2] == role[0]: + if ChatsAttrs[conf]["laws"]["verif"] and access < 2 and aRoles[2] == role[0]: if not prisoner.verif and not prisoner.devoice: Chats[conf].visitor(nick, self.AnsBase[17] % get_self_nick(conf)) if not self.Questions: |