diff options
author | Al Korgun <alkorgun@gmail.com> | 2012-11-22 23:25:56 +0400 |
---|---|---|
committer | Al Korgun <alkorgun@gmail.com> | 2012-11-22 23:25:56 +0400 |
commit | 4c3a832c9f544f56df0887b62280c8c326e4b11d (patch) | |
tree | 29d7d2ff8a0f07a494fe3d7107b4aaf8d06f106e | |
parent | e72c9cd1854b8e6a48aa54eb945494b55f6e99b6 (diff) |
command "turbo" added
-rw-r--r-- | expansions/access/code.py | 6 | ||||
-rw-r--r-- | expansions/exp_control/code.py | 6 | ||||
-rw-r--r-- | expansions/extra_control/code.py | 63 | ||||
-rw-r--r-- | expansions/extra_control/remote.en | 4 | ||||
-rw-r--r-- | expansions/extra_control/remote.ru | 2 | ||||
-rw-r--r-- | expansions/extra_control/turbo.en | 4 | ||||
-rw-r--r-- | expansions/extra_control/turbo.name | 4 | ||||
-rw-r--r-- | expansions/extra_control/turbo.ru | 4 | ||||
-rw-r--r-- | expansions/help/code.py | 6 | ||||
-rw-r--r-- | expansions/interpreter/exec.en | 2 | ||||
-rw-r--r-- | expansions/session_stat/insc.py | 8 |
11 files changed, 78 insertions, 31 deletions
diff --git a/expansions/access/code.py b/expansions/access/code.py index e1d6b50..53cec36 100644 --- a/expansions/access/code.py +++ b/expansions/access/code.py @@ -18,8 +18,10 @@ class expansion_temp(expansion): def command_get_access(self, ltype, source, body, disp): def get_acc(access): - if access >= 8: - access = "%d (BOSS)" % (access) + if access > 8: + access = "%d (Gandalf)" % (access) + elif access == 8: + access = "8 (God)" elif access == 7: access = "7 (Chief)" else: diff --git a/expansions/exp_control/code.py b/expansions/exp_control/code.py index cd2ad11..7c24c05 100644 --- a/expansions/exp_control/code.py +++ b/expansions/exp_control/code.py @@ -1,8 +1,8 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "exp_control" # /code.py v.x7 -# Id: 09~7b +exp_name = "exp_control" # /code.py v.x8 +# Id: 09~8b # Code © (2011-2012) by WitcherGeralt [alkorgun@gmail.com] expansion_register(exp_name) @@ -61,7 +61,7 @@ class expansion_temp(expansion): def command_expload(self, ltype, source, body, disp): if body: - exp_name = body.lower() + exp_name = body.strip("\\/").lower() if check_nosimbols(exp_name): if expansions.has_key(exp_name): if os.path.isfile(expansions[exp_name].file): diff --git a/expansions/extra_control/code.py b/expansions/extra_control/code.py index 18f3d70..4b7cc2f 100644 --- a/expansions/extra_control/code.py +++ b/expansions/extra_control/code.py @@ -1,9 +1,9 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "extra_control" # /code.py v.x7 -# Id: 01~5b -# Code © (2009-2011) by WitcherGeralt [alkorgun@gmail.com] +exp_name = "extra_control" # /code.py v.x8 +# Id: 01~6b +# Code © (2009-2012) by WitcherGeralt [alkorgun@gmail.com] expansion_register(exp_name) @@ -12,12 +12,42 @@ class expansion_temp(expansion): def __init__(self, name): expansion.__init__(self, name) + sep = chr(38)*2 + + def command_turbo(self, ltype, source, body, disp): + if body: + if self.sep in body: + ls = body.split(self.sep) + lslen = len(ls) - 1 + if lslen < 4 or enough_access(source[1], source[2], 7): + for numb, body in enumerate(ls): + body = body.split(None, 1) + cmd = (body.pop(0)).lower() + if Cmds.has_key(cmd): + if body: + body = body[0] + else: + body = "" + Cmds[cmd].execute(ltype, source, body, disp) + if numb not in (0, lslen): + time.sleep(2) + else: + answer = AnsBase[6] + else: + answer = AnsBase[10] + else: + answer = AnsBase[2] + else: + answer = AnsBase[1] + if locals().has_key(Types[12]): + Answer(answer, ltype, source, disp) + def command_remote(self, ltype, source, body, disp): confs = sorted(Chats.keys()) if body: - ls = body.split() - if len(ls) >= 3: - x = (ls.pop(0)).lower() + body = body.split(None, 3) + if len(body) >= 3: + x = (body.pop(0)).lower() if x in confs: conf = x elif isNumber(x): @@ -29,7 +59,7 @@ class expansion_temp(expansion): else: conf = False if conf: - itype = (ls.pop(0)).lower() + itype = (body.pop(0)).lower() if itype in (Types[14], Types[0]): type2 = Types[1] elif itype in (Types[15], Types[6]): @@ -37,12 +67,12 @@ class expansion_temp(expansion): else: type2 = False if type2: - cmd = (ls.pop(0)).lower() - if ls: - body = body[((body.lower()).find(cmd) + len(cmd)):].strip() + cmd = (body.pop(0)).lower() + if body: + body = body[0] else: body = "" - if 1024 >= len(body): + if 2048 >= len(body): if Cmds.has_key(cmd): inst = Cmds[cmd] if inst.isAvalable and inst.handler: @@ -57,7 +87,7 @@ class expansion_temp(expansion): if source and source not in inst.desc: inst.desc.append(source) else: - Answer(AnsBase[19] % (inst.name), ltype, source, disp) + answer = AnsBase[19] % (inst.name) else: answer = AnsBase[6] else: @@ -76,11 +106,11 @@ class expansion_temp(expansion): def command_private(self, ltype, source, body, disp): if Chats.has_key(source[1]): if body: - ls = body.split() - cmd = (ls.pop(0)).lower() + body = body.split(None, 1) + cmd = (body.pop(0)).lower() if Cmds.has_key(cmd): - if ls: - body = body[((body.lower()).find(cmd) + len(cmd)):].strip() + if body: + body = body[0] else: body = "" Cmds[cmd].execute(Types[0], source, body, disp) @@ -94,6 +124,7 @@ class expansion_temp(expansion): Answer(answer, ltype, source, disp) commands = ( + (command_turbo, "turbo", 1,), (command_remote, "remote", 8,), (command_private, "private", 1,) ) diff --git a/expansions/extra_control/remote.en b/expansions/extra_control/remote.en index c006839..ea42733 100644 --- a/expansions/extra_control/remote.en +++ b/expansions/extra_control/remote.en @@ -1,7 +1,7 @@ executes the specified command remotely
-remote ([conference/conf. number in list] [chat/private] [command] (parameters))
+remote ([conference/chats's_number_in_list] [chat/private] [command] (parameters))
*/remote witcher@conference.jabber.ru private clean
-executes the command like as would you set it while in "witcher@conference.jabber.ru", and send the results to you in private
+executes the command like as would you set it while in "witcher@conference.jabber.ru", and send the results to you in private
*/remote 1 chat ping EdenPowers
executes the command in the room from the list at number 1, and report the results in to this conference
*/remote
diff --git a/expansions/extra_control/remote.ru b/expansions/extra_control/remote.ru index 335b702..ae2c85a 100644 --- a/expansions/extra_control/remote.ru +++ b/expansions/extra_control/remote.ru @@ -1,5 +1,5 @@ выполняет заданную команду дистанционно
-ремоут ([конференция/номер конфы в списке] [чат/приват] [команда] (параметры))
+ремоут ([конференция/номер_конференции_в_списке] [чат/приват] [команда] (параметры))
*/ремоут witcher@conference.jabber.ru приват чисть
выполнит команду так, как еслы бы вы задали её, находясь в "witcher@conference.jabber.ru", и оправит результат вам в приват
*/ремоут 1 чат пинг EdenPowers
diff --git a/expansions/extra_control/turbo.en b/expansions/extra_control/turbo.en new file mode 100644 index 0000000..943cff9 --- /dev/null +++ b/expansions/extra_control/turbo.en @@ -0,0 +1,4 @@ +executes sequence of 2-4 commands (users with access more than 7 can use more than 4 commands)
+turbo [[command] (parameters)] [&&] [[command] (parameters)]
+*/turbo ping User#1 && ping User#2 && ping User#3 && ping
+bot would 'ping' you and three users
\ No newline at end of file diff --git a/expansions/extra_control/turbo.name b/expansions/extra_control/turbo.name new file mode 100644 index 0000000..9a83b0a --- /dev/null +++ b/expansions/extra_control/turbo.name @@ -0,0 +1,4 @@ +{
+ "RU": "турбо",
+ "UA": "турбо"
+}
\ No newline at end of file diff --git a/expansions/extra_control/turbo.ru b/expansions/extra_control/turbo.ru new file mode 100644 index 0000000..21f1d49 --- /dev/null +++ b/expansions/extra_control/turbo.ru @@ -0,0 +1,4 @@ +выполнение до четырех команд последовательно (при доступе от 7 количество команд не ограничено)
+турбо [[команда] (параметры)] [&&] [[команда] (параметры)]
+*/турбо пинг Юзер#1 && пинг Юзер#2 && пинг Юзер#3 && пинг
+бот пропингует тебя и трех юзеров
\ No newline at end of file diff --git a/expansions/help/code.py b/expansions/help/code.py index 934a8cd..b371e6d 100644 --- a/expansions/help/code.py +++ b/expansions/help/code.py @@ -93,8 +93,10 @@ class expansion_temp(expansion): if cmds.has_key(1): answer += self.AnsBase[15] % (lcmds[1]._str(), ", ".join(cmds[1])) access = get_access(source[1], source[2]) - if access >= 8: - access = "%d (BOSS)" % (access) + if access > 8: + access = "%d (Gandalf)" % (access) + elif access == 8: + access = "8 (God)" elif access == 7: access = "7 (Chief)" else: diff --git a/expansions/interpreter/exec.en b/expansions/interpreter/exec.en index 8e0cdad..8e703a1 100644 --- a/expansions/interpreter/exec.en +++ b/expansions/interpreter/exec.en @@ -1,4 +1,4 @@ executes python's code
exec [code]
*/exec delivery("Aaa!!")
-bot would send "Aaa!!" in to BOSS's JID
\ No newline at end of file +bot would send "Aaa!!" in to Superadmin's JID
\ No newline at end of file diff --git a/expansions/session_stat/insc.py b/expansions/session_stat/insc.py index 5b340ec..5d33f8c 100644 --- a/expansions/session_stat/insc.py +++ b/expansions/session_stat/insc.py @@ -36,13 +36,13 @@ else: "\n# Processed %s presences & %s iq-requests", # 5 "\n# Sent %s messages & %s iq-requests", # 6 "\n# Serve %d conferences", # 7 - "\n# Fixed %d users", # 8 + "\n# Counted %d users", # 8 "", # 9 "\n# Happened %d exceptions & %s Dispatch-Errors", # 10 - "\n# Wrote crash logs %s", # 11 + "\n# Wrote %s crash logs", # 11 "\n# Created %s threads, %d is now active", # 12 - "\n# Used %.2f processor seconds", # 13 - "\n# Used %s megabyte RAM", # 14 + "\n# Used %.2f processor's seconds", # 13 + "\n# Used %s megabytes RAM", # 14 "\nBot's uptime: %s.", # 15 "\nThe last working set: %s.\nReloads (%s):\n%s.", # 16 " - Working without restarts!", # 17 |