Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alkorgun/blacksmith-2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Korgun <alkorgun@gmail.com>2012-10-19 21:34:10 +0400
committerAl Korgun <alkorgun@gmail.com>2012-10-19 21:34:10 +0400
commitf15d2e200904e2c64b3af6ce1c3ddc9c6c074cfb (patch)
tree29e3cadf77215be15affb8e8c6b176e3a9e62f27
parent1d7825fc7ae8df8001cdb1d43ced31c388cc8d2f (diff)
some modifications
-rw-r--r--LICENSE4
-rw-r--r--NOTICE2
-rw-r--r--expansions/books/code.py6
-rw-r--r--expansions/bot_sends/code.py6
-rw-r--r--expansions/talkers/code.py24
-rw-r--r--expansions/talkers/talkers.en6
-rw-r--r--expansions/talkers/talkers.ru6
7 files changed, 36 insertions, 18 deletions
diff --git a/LICENSE b/LICENSE
index 0c5a5f7..9dbeff1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright (2011) Al Korgun [alkorgun@gmail.com]
+ Copyright (2011-2012) Al Korgun [alkorgun@gmail.com]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -199,4 +199,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
- limitations under the License. \ No newline at end of file
+ limitations under the License.
diff --git a/NOTICE b/NOTICE
index 7044856..8033f3b 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
BlackSmith mark.2 xmpp bot
- Copyright (2011) Al Korgun [alkorgun@gmail.com]
+ Copyright (2011-2012) Al Korgun [alkorgun@gmail.com]
This product based on Python Programming Language (http://python.org/).
diff --git a/expansions/books/code.py b/expansions/books/code.py
index bedc2a7..8ea54d2 100644
--- a/expansions/books/code.py
+++ b/expansions/books/code.py
@@ -1,8 +1,8 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "books" # /code.py v.x4 alpha
-# Id: 29~4b
+exp_name = "books" # /code.py v.x5 alpha
+# Id: 29~5b
# Code © (2011-2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -75,6 +75,8 @@ class expansion_temp(expansion):
raise SelfExc("A book with the same name is already in the libraly!")
def getID(self, Name):
+ while Name.startswith(("1","2","3","4","5","6","7","8","9","0")):
+ Name = Name[1:]
Name = sub_desc(Name, ((chr(95), chr(32)),)).lower()
Name = sub_desc(Name, CharCase[3]).strip()
Name = sub_desc(Name, (chr(32), chr(10), chr(13), chr(9)), chr(95))
diff --git a/expansions/bot_sends/code.py b/expansions/bot_sends/code.py
index 1e4ec7b..d3b153d 100644
--- a/expansions/bot_sends/code.py
+++ b/expansions/bot_sends/code.py
@@ -17,8 +17,8 @@ class expansion_temp(expansion):
if ChatsAttrs[source[1]]["dirt"]:
ChatsAttrs[source[1]]["dirt"] = None
if ltype == Types[1]:
- s1_buckup = Chats[source[1]].state
- s2_buckup = Chats[source[1]].status
+ s1_backup = Chats[source[1]].state
+ s2_backup = Chats[source[1]].status
Chats[source[1]].change_status(sList[2], self.AnsBase[0])
zero = xmpp.Message(to = source[1], typ = Types[1])
for Numb in xrange(24):
@@ -28,7 +28,7 @@ class expansion_temp(expansion):
if (Numb != 23):
time.sleep(1.4)
if ltype == Types[1]:
- Chats[source[1]].change_status(s1_buckup, s2_buckup)
+ Chats[source[1]].change_status(s1_backup, s2_backup)
ChatsAttrs[source[1]]["dirt"] = True
else:
answer = self.AnsBase[9]
diff --git a/expansions/talkers/code.py b/expansions/talkers/code.py
index 78f78cf..3657f4d 100644
--- a/expansions/talkers/code.py
+++ b/expansions/talkers/code.py
@@ -1,9 +1,9 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "talkers" # /code.py v.x4
-# Id: 14~3b
-# Code © (2010-2011) by WitcherGeralt [alkorgun@gmail.com]
+exp_name = "talkers" # /code.py v.x5
+# Id: 14~4b
+# Code © (2010-2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -22,14 +22,20 @@ class expansion_temp(expansion):
ls = body.split()
if len(ls) >= 2:
a1 = (ls.pop(0)).lower()
- a2 = body[((body.lower()).find(a1) + len(a1)):].strip()
if a1 in ("top", "топ".decode("utf-8")):
+ a2 = (ls.pop(0)).lower()
+ if ls and isNumber(ls[0]):
+ Number = int(ls.pop(0))
+ if Number > 256:
+ Number = 256
+ else:
+ Number = 0
if a2 in ("local", "локальный".decode("utf-8")):
filename = cefile(chat_file(source[1], self.TalkersFile))
with self.TalkersDesc[source[1]]:
with database(filename) as db:
db("select * from talkers order by -msgs")
- db_desc = db.fetchmany(10)
+ db_desc = db.fetchmany(Number if Number > 0 else 10)
if db_desc:
answer, Numb = self.AnsBase[0], itypes.Number()
for x in db_desc:
@@ -43,7 +49,7 @@ class expansion_temp(expansion):
with self.TalkersDesc[conf]:
with database(filename) as db:
db("select * from talkers order by -msgs")
- db_desc = db.fetchmany(99)
+ db_desc = db.fetchmany(256)
for x in db_desc:
if Glob_dbs.has_key(x[0]):
Glob_dbs[x[0]][2] += x[2]
@@ -51,7 +57,7 @@ class expansion_temp(expansion):
else:
Glob_dbs[x[0]] = list(x)
if Glob_dbs:
- Top_list = []
+ Top_list, limit = [], (Number if Number > 0 else 20)
for x, y in Glob_dbs.items():
Top_list.append([y[2], y[3], y[1]])
del Glob_dbs
@@ -60,13 +66,14 @@ class expansion_temp(expansion):
Top_list.reverse()
for x in Top_list:
answer += "\n%d. %s\t\t%d\t%d\t%s" % (Numb.plus(), x[2], x[0], x[1], str(round((float(x[1]) / x[0]), 1)))
- if Numb._int() >= 20:
+ if Numb._int() >= limit:
break
else:
answer = self.AnsBase[1]
else:
answer = AnsBase[2]
elif a1 in ("global", "глобальный".decode("utf-8")):
+ a2 = body[((body.lower()).find(a1) + len(a1)):].strip()
def get_talker_stat(source_):
x, y = 0, 0
@@ -130,6 +137,7 @@ class expansion_temp(expansion):
else:
answer = self.AnsBase[1]
elif a1 in ("local", "локальный".decode("utf-8")):
+ a2 = body[((body.lower()).find(a1) + len(a1)):].strip()
def get_talker_stat(source_, conf):
filename = cefile(chat_file(conf, self.TalkersFile))
diff --git a/expansions/talkers/talkers.en b/expansions/talkers/talkers.en
index 6711c92..5fbffa8 100644
--- a/expansions/talkers/talkers.en
+++ b/expansions/talkers/talkers.en
@@ -1,13 +1,17 @@
statistic of talkers
-talkers [[top] [global/local]]/[[global/local] [mine/nick/jid]]
+talkers [[top] [global/local] (number)]/[[global/local] [mine/nick/jid]]
*/talkers local mine
bot would show your statistic in current conference
*/talkers global mine
bot would show your statistic in all of the conferences where bot serves
*/talkers top local
bot would show talkers top of current conference
+*/talkers top local 50
+bot would show top 50 talkers of current conference
*/talkers top global
bot would show talkers top of all of the conferences where bot serves
+*/talkers top global 100
+bot would show top 100 talkers of all of the conferences where bot serves
*/talkers local Dude
bot would show Dude's statistic in current conference
*/talkers global dude@jub.net
diff --git a/expansions/talkers/talkers.ru b/expansions/talkers/talkers.ru
index a724591..800adf6 100644
--- a/expansions/talkers/talkers.ru
+++ b/expansions/talkers/talkers.ru
@@ -1,13 +1,17 @@
статистика ботлунов
-трёп [[топ] [глобальный/локальный]]/[[глобальный/локальный] [мой/nick/jid]]
+трёп [[топ] [глобальный/локальный] (число)]/[[глобальный/локальный] [мой/nick/jid]]
*/трёп локальный мой
покажет вашу статистику в текущей конференции
*/трёп глобальный мой
покажет вашу сводную статистику по всем конференциям в которых сидит бот
*/трёп топ локальный
покажет таблицу болтунов текущей конференции
+*/трёп топ локальный 50
+покажет топ 50 болтунов текущей конференции
*/трёп топ глобальный
покажет сводную таблицу болтунов всех конференций в которых сидит бот
+*/трёп топ глобальный 100
+покажет топ 100 болтунов всех конференций в которых сидит бот
*/трёп локальный Dude
покажет статистику "Dude" в текущей конференции
*/трёп глобальный dude@jub.net