diff options
author | Al Korgun <alkorgun@gmail.com> | 2012-10-18 22:24:47 +0400 |
---|---|---|
committer | Al Korgun <alkorgun@gmail.com> | 2012-10-18 22:24:47 +0400 |
commit | 1d7825fc7ae8df8001cdb1d43ced31c388cc8d2f (patch) | |
tree | 05f4bab30484bbb80687713e85dfa04f5a313fdc | |
parent | 2463064775ffac7193828d78b6c7506a30525b08 (diff) |
expansion book added
-rw-r--r-- | BlackSmith.py | 8 | ||||
-rw-r--r-- | expansions/basic_control/code.py | 2 | ||||
-rw-r--r-- | expansions/books/books.en | 24 | ||||
-rw-r--r-- | expansions/books/books.name | 4 | ||||
-rw-r--r-- | expansions/books/books.ru | 24 | ||||
-rw-r--r-- | expansions/books/code.py | 473 | ||||
-rw-r--r-- | expansions/books/insc.py | 40 | ||||
-rw-r--r-- | expansions/books/library.en | 22 | ||||
-rw-r--r-- | expansions/books/library.name | 4 | ||||
-rw-r--r-- | expansions/books/library.ru | 22 | ||||
-rw-r--r-- | expansions/bot_sends/invite.name | 4 | ||||
-rw-r--r-- | expansions/bot_sends/invite.ru | 6 | ||||
-rw-r--r-- | expansions/cron/insc.py | 4 | ||||
-rw-r--r-- | expansions/help/insc.py | 12 | ||||
-rw-r--r-- | expansions/sconf_attrs/code.py | 2 | ||||
-rw-r--r-- | expansions/sconf_attrs/insc.py | 10 | ||||
-rw-r--r-- | expansions/session_stat/insc.py | 66 | ||||
-rw-r--r-- | expansions/sheriff/insc.py | 12 | ||||
-rw-r--r-- | expansions/talkers/insc.py | 4 | ||||
-rw-r--r-- | expansions/user_stats/insc.py | 16 | ||||
-rw-r--r-- | librarys.zip | bin | 84698 -> 86979 bytes | |||
-rw-r--r-- | static/insc.py | 68 |
22 files changed, 720 insertions, 107 deletions
diff --git a/BlackSmith.py b/BlackSmith.py index 6a3f892..095c700 100644 --- a/BlackSmith.py +++ b/BlackSmith.py @@ -164,7 +164,7 @@ Info = { "omsg": itypes.Number(), "outiq": itypes.Number() } -# Helpfull functions +# Helpful functions class SelfExc(Exception): pass @@ -264,7 +264,7 @@ GenConFile = static % ("config.ini") ConDispFile = static % ("clients.ini") ChatsFile = dynamic % ("chats.db") -(BsMark, BsVer, BsRev) = (2, 29, 0) +(BsMark, BsVer, BsRev) = (2, 30, 0) if os.access(SvnCache, os.R_OK): Cache = open(SvnCache).readlines() @@ -279,7 +279,7 @@ ProdName = "BlackSmith mark.%d" % (BsMark) ProdVer = "%d (r.%s)" % (BsVer, BsRev) Caps = "http://blacksmith-2.googlecode.com/svn/" CapsVer = "%d.%d" % (BsMark, BsVer) -FullName = "HellDev's %s CoreVer.%s (%s)" % (ProdName, ProdVer, Caps) +FullName = "HellDev's %s Ver.%s (%s)" % (ProdName, ProdVer, Caps) BotOs, BsPid = os.name, os.getpid() @@ -359,7 +359,7 @@ Handlers = { Sequence = iThr.Semaphore() -# call & execut Threads & handlers +# call & execute Threads & handlers def execute_handler(handler_instance, list = (), command = None): try: diff --git a/expansions/basic_control/code.py b/expansions/basic_control/code.py index 1f9d4ae..8e2c7f2 100644 --- a/expansions/basic_control/code.py +++ b/expansions/basic_control/code.py @@ -25,7 +25,7 @@ class expansion_temp(expansion): if body: ls = body.split() conf = (ls.pop(0)).lower() - if conf.count("@.") and conf.count(".") >= 2: + if conf.count("@") and conf.count(".") >= 2: if not Chats.has_key(conf): confname = dynamic % (conf) if not check_nosimbols(confname): diff --git a/expansions/books/books.en b/expansions/books/books.en new file mode 100644 index 0000000..7df3619 --- /dev/null +++ b/expansions/books/books.en @@ -0,0 +1,24 @@ +watch/read library content
+books ([show] (names)/([author/genre/cycle] [parameters]))/([info] [book's_name])/([read] ((page_number) [book's_name])/(next))
+*/books
+bot would show books count
+*/books show
+bot would show the list with ID's of books
+*/books show names
+bot would show the list with names of books
+*/books show author George Martin
+bot would show the list of George Martin's books
+*/books show genre sf_fantasy
+bot would show the list of sf_fantasy books
+*/books show cycle The Black Company
+bot would show the list of books of "The Black Company" cycle
+*/books info A Dance With Dragons
+bot would show information about "A Dance With Dragons"
+*/books read
+bot would send you the last page of the last book, which you read
+*/books read Call of Cthulhu
+bot would send you the first page of "Call of Cthulhu"
+*/books read 17 Call of Cthulhu
+bot would send you 17th page of "Call of Cthulhu"
+*/books read next
+bot would send you the next page
\ No newline at end of file diff --git a/expansions/books/books.name b/expansions/books/books.name new file mode 100644 index 0000000..6198279 --- /dev/null +++ b/expansions/books/books.name @@ -0,0 +1,4 @@ +{
+ "RU": "книги",
+ "UA": "книги"
+}
\ No newline at end of file diff --git a/expansions/books/books.ru b/expansions/books/books.ru new file mode 100644 index 0000000..a5b0df7 --- /dev/null +++ b/expansions/books/books.ru @@ -0,0 +1,24 @@ +просмотр/чтение содержимого библиотеки
+книги ([показать] (названия)/([автор/жанр/серию] [параметры]))/([инфо] [имя_книги])/([читать] ((номер_страницы) [имя_книги])/(далее))
+*/книги
+бот покажет количество книг в библиотеке
+*/книги показать
+бот покажет внутренние идентификаторы книг
+*/книги показать названия
+бот покажет оригинальные названия книг
+*/книги показать автор Анджей Сапковский
+бот покажет книги Анджея Сапковского (если имя автора в юникоде, необходимо указать его в полном соответствии с тем, как оно узазано в информации о книгах)
+*/книги показать жанр фентези
+бот покажет книги жанра фентези (если название жанра в юникоде, возникает проблема, описанная выше)
+*/книги показать серию The Black Company
+бот покажет книги из серии "The Black Company" (если название серии в юникоде, возникает проблема, описанная выше)
+*/книги инфо Танец с Драконами
+бот покажет информацию по книге "Танец с Драконами"
+*/книги читать
+бот отправит вам последнюю, открытую вами страницу, последней открытой вами книги
+*/книги читать Зов Ктулху
+бот отправит вам первую страницу книги "Зов Ктулху"
+*/книги читать 17 Зов Ктулху
+бот отправит вам 17ю страницу книги "Зов Ктулху"
+*/книги читать далее
+бот отправит вам следующую страницу
\ No newline at end of file diff --git a/expansions/books/code.py b/expansions/books/code.py new file mode 100644 index 0000000..bedc2a7 --- /dev/null +++ b/expansions/books/code.py @@ -0,0 +1,473 @@ +# coding: utf-8 + +# BlackSmith mark.2 +exp_name = "books" # /code.py v.x4 alpha +# Id: 29~4b +# Code © (2011-2012) by WitcherGeralt [alkorgun@gmail.com] + +expansion_register(exp_name) + +class expansion_temp(expansion): + + def __init__(self, name): + expansion.__init__(self, name) + + import fb2 + + BooksFile, ReadersFile = dynamic % ("books.db"), dynamic % ("readers.db") + + def importFB2(self, path): + book = get_file(path) + book_enc = self.fb2.get_enc(book) + if not book_enc: + raise SelfExc("Can't get encoding!") + (desc, body) = self.fb2.get_data(book.decode(book_enc)) + if not desc: + raise SelfExc("Can't get <description>!") + if not body: + raise SelfExc("Can't get <body>!") + (Name, author, date, genre, seq1, seq2, coverD, annt) = desc + if not Name: + raise SelfExc("Can't get <book-title>!") + a2 = self.getID(Name) + if not a2: + raise SelfExc("Can't make book-ID!") + with database(self.BooksFile) as db: + db("select * from books where id=?", (a2,)) + db_desc = db.fetchone() + if not db_desc: + db("insert into books (id, name, nick, date) values (?,?,?,?)", (a2, Name, "WitcherGeralt", time.asctime())) + if author: + db("update books set author=? where id=?", (author, a2)) + if date: + db("update books set year=? where id=?", (date, a2)) + if genre: + db("update books set genre=? where id=?", (genre, a2)) + if annt: + db("update books set annotation=? where id=?", (annt, a2)) + if seq1: + db("update books set seq1=? where id=?", (seq1, a2)) + if seq2: + db("update books set seq2=? where id=?", (seq2, a2)) + if coverD: + c0, cover = coverD + db("update books set c0=? where id=?", (c0, a2)) + db("update books set cover=? where id=?", (cover, a2)) + db("create table %s (page integer, data text)" % a2) + ls = [] + Numb = itypes.Number() + Number = itypes.Number() + lTotal = itypes.Number() + for line in body.splitlines(): + line = line.strip() + ls.append(line) + if Number.plus(len(line)) >= 2048: + db("insert into %s values (?,?)" % (a2), (Numb.plus(), str.join(chr(10), ls))) + lTotal.plus(Number._int()) + ls = [] + Number = itypes.Number() + if ls: + lTotal.plus(Number._int()) + db("insert into %s values (?,?)" % (a2), (Numb.plus(), str.join(chr(10), ls))) + db.commit() + raise SelfExc("Done. ID - '%s', total pages: %s" % (a2, lTotal._str())) + else: + raise SelfExc("A book with the same name is already in the libraly!") + + def getID(self, Name): + 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)) + return (Name if Name != "books" else None) + + def command_get_books(self, ltype, source, body, disp): + if body: + list = body.split() + a1 = (list.pop(0)).lower() + if a1 in ("show", "показать".decode("utf-8")): + if list: + a2 = (list.pop(0)).lower() + if a2 in ("names", "названия".decode("utf-8")): + with database(self.BooksFile) as db: + db("select name from books order by name") + db_desc = db.fetchall() + if db_desc: + ls, Numb = ["Books:"], itypes.Number() + for Name in db_desc: + ls.append("%d) %s" % (Numb.plus(), Name[0])) + answer = str.join(chr(10), ls) + else: + answer = self.AnsBase[0] + else: + a0, ls = a2, "author;genre;seq1".split(";") + desc = { + "автор".decode("utf-8"): ls[0], + "жанр".decode("utf-8"): ls[1], + "серию".decode("utf-8"): ls[2], + "cycle": ls[2] + } + if desc.has_key(a2): + a2 = desc.get(a2, None) + if a2 in ls and list: + a3 = body[((body.lower()).find(a0) + len(a0)):].strip() + with database(self.BooksFile) as db: + if a2 in ("author", "genre"): + db("select name from books where %s like ? order by name" % (a2), (a3,)) + db_desc = db.fetchall() + if db_desc: + ls, Numb = [a3 + ":"], itypes.Number() + for Name in db_desc: + ls.append("%d) %s" % (Numb.plus(), Name[0])) + answer = str.join(chr(10), ls) + else: + answer = self.AnsBase[1] % (a0) + else: + db("select seq1, seq2, name from books where seq1 like ? order by seq1, seq2", (a3,)) + db_desc = db.fetchall() + if db_desc: + ls, Numb = [a3 + ":"], itypes.Number() + for seq1, seq2, Name in db_desc: + ls.append("%d) %s #%d - %s" % (Numb.plus(), seq1, seq2, Name)) + answer = str.join(chr(10), ls) + else: + answer = self.AnsBase[2] + else: + answer = AnsBase[2] + else: + with database(self.BooksFile) as db: + db("select id, author from books order by author, id") + db_desc = db.fetchall() + if db_desc: + ls, Numb = ["Books:"], itypes.Number() + for id, author in db_desc: + ls.append("%d) '%s' - %s" % (Numb.plus(), id, author)) + answer = str.join(chr(10), ls) + else: + answer = self.AnsBase[0] + elif a1 in ("info", "инфо".decode("utf-8")): + if list: + a2 = body[((body.lower()).find(a1) + len(a1)):].strip() + a3 = self.getID(a2) + with database(self.BooksFile) as db: + db("select * from books where id=? or name like ?", (a3, a2)) + info = db.fetchone() + if info: + (id, Name, Author, Year, Genre, seq1, seq2, c0, Cover, Annt, link, Nick, Date) = info + del c0, Cover, info + ls = ["Name: %s" % (Name if Name else id)] + if Year: + ls.append("Year: %s" % (Year)) + if Genre: + ls.append("Genre: %s" % (Genre)) + if Author: + ls.append("Author: %s" % (Author)) + db("select page from %s" % id) + lines = db.fetchall() + if lines: + ls.append("Pages: %d" % max(lines)) + del lines + if seq1: + seq3 = "Series: %s" % ("%s #%s" % (seq1, seq2) if seq2 else seq1) + ls.append(seq3) + if link: + ls.append("Link: %s" % (link)) + if Annt: + ls.append("Annotation:\n\t%s" % (Annt)) + ls.append("\nAdded by: %s (Last Up.: %s)" % (Nick, Date)) + answer = str.join(chr(10), ls) + else: + answer = self.AnsBase[3] + else: + answer = AnsBase[2] + elif a1 in ("read", "читать".decode("utf-8")): + jid = get_source(source[1], source[2]) + if list: + a2 = (list.pop(0)).lower() + if a2 in ("next", "далее".decode("utf-8")): + if jid: + with database(self.ReadersFile) as db: + db("select book, page from readers where jid=?", (jid,)) + data = db.fetchone() + if data: + book, page = data + page += 1 + else: + answer = self.AnsBase[4] + else: + answer = self.AnsBase[5] + elif isNumber(a2): + book = self.getID(body[((body.lower()).find(a2) + len(a2)):]) + page = int(a2) + else: + book = self.getID(body[((body.lower()).find(a1) + len(a1)):]) + page = 1 + else: + if jid: + with database(self.ReadersFile) as db: + db("select book, page from readers where jid=?", (jid,)) + data = db.fetchone() + if data: + book, page = data + else: + answer = self.AnsBase[4] + else: + answer = self.AnsBase[5] + if locals().has_key("book"): + with database(self.BooksFile) as db: + db("select * from books where id=?", (book,)) + data = db.fetchone() + if data: + db("select data from %s where page=?" % (book), (page,)) + data = db.fetchone() + if data: + if ltype == Types[1]: + answer = AnsBase[11] + Msend(source[0], data[0], disp) + if jid: + with database(self.ReadersFile) as db: + db("select * from readers where jid=?", (jid,)) + data = db.fetchone() + if data: + db("update readers set book=?, page=? where jid=?", (book, page, jid)) + else: + db("insert into readers values (?,?,?)", (jid, book, page)) + else: + db("select page from %s" % book) + lines = db.fetchall() + if lines: + answer = self.AnsBase[6] % max(lines) + else: + answer = self.AnsBase[7] + else: + answer = self.AnsBase[3] + else: + answer = AnsBase[2] + else: + with database(self.BooksFile) as db: + db("select id from books") + db_desc = db.fetchall() + if db_desc: + answer = self.AnsBase[8] % len(db_desc) + else: + answer = self.AnsBase[0] + if locals().has_key(Types[12]): + Answer(answer, ltype, source, disp) + + def command_set_books(self, ltype, source, body, disp): + if body: + list = body.split() + if len(list) >= 2: + a1 = (list.pop(0)).lower() + if a1 in ("add", "добавить".decode("utf-8")): + a2 = (list.pop(0)).lower() + if a2 in ("file", "fb2", "файл".decode("utf-8")): + if list: + Path = body[((body.lower()).find(a2) + len(a2)):].strip() + try: + exists = os.path.isfile(Path) + except: + exists = False + if exists: + try: + self.importFB2(Path) + except SelfExc: + answer = exc_info()[1] + except: + collectExc(self.importFB2, "library add fb2 %s" % Path) + answer = AnsBase[7] + else: + answer = self.AnsBase[9] + else: + answer = AnsBase[2] + else: + Name = body[((body.lower()).find(a1) + len(a1)):].strip() + a2 = self.getID(Name) + if a2: + with database(self.BooksFile) as db: + db("select * from books where id=?", (a2,)) + db_desc = db.fetchone() + if db_desc: + answer = self.AnsBase[10] + else: + db("insert into books (id, name, nick, date) values (?,?,?,?)", (a2, Name, source[2].strip(), time.asctime())) + db("create table %s (page integer, data text)" % a2) + db.commit() + answer = self.AnsBase[11] % (a2) + else: + answer = self.AnsBase[15] + elif a1 in ("edit", "править".decode("utf-8")): + if len(list) >= 4: + a2 = self.getID(list.pop(0)) + if a2: + a3 = (list.pop(0)).lower() + if a3 in ("info", "инфо".decode("utf-8")): + a4 = (list.pop(0)).lower() + a0, ls = a4, "author;year;genre;seq1;seq2;cover;annotation;link;name;c0".split(";") + desc = { + "автор".decode("utf-8"): ls[0], + "год".decode("utf-8"): ls[1], + "жанр".decode("utf-8"): ls[2], + "серия".decode("utf-8"): ls[3], + "номер".decode("utf-8"): ls[4], + "аннотация".decode("utf-8"): ls[6], + "ссылка".decode("utf-8"): ls[7], + "название".decode("utf-8"): ls[8], + "number": ls[4], + "cover_ext": ls[9], + "cycle": ls[3] + } + if desc.has_key(a4): + a4 = desc.get(a4, None) + if a4 in ls: + a5 = (list.pop(0)).lower() + if a4 in (ls[1], ls[4]): + if isNumber(a5): + a5 = int(a5) + else: + a5 = ".0" + elif a5 in ("clear", "отчистить".decode("utf-8")): + a5 = None + else: + a5 = body[((body.lower()).find(a0) + len(a0)):].strip() + if a5 != ".0": + with database(self.BooksFile) as db: + db("select * from books where id=?", (a2,)) + db_desc = db.fetchone() + if db_desc: + db("update books set %s=?, date=? where id=?" % (a4), (a5, time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[3] + else: + answer = AnsBase[30] + else: + answer = self.AnsBase[12] + elif a3 in ("page", "страница".decode("utf-8")): + with database(self.BooksFile) as db: + db("select * from books where id=?", (a2,)) + db_desc = db.fetchone() + if db_desc: + db("select page from %s" % a2) + lines = db.fetchall() + llens = len(lines) + a4 = (list.pop(0)).lower() + if a4 in ("add", "добавить".decode("utf-8")): + a5 = body[((body.lower()).find(a4) + len(a4)):].strip() + if llens: + line = (llens + 1) + else: + line = 1 + db("insert into %s values (?,?)" % (a2), (line, a5)) + db("update books set date=? where id=?", (time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + elif a4 in ("delete", "удалить".decode("utf-8")): + a5 = (list.pop(0)).lower() + if list: + a6 = list.pop(0) + if isNumber(a6): + a6 = int(a6) + if a5 in ("before", "до".decode("utf-8")): + if 0 < a6 < llens: + page = itypes.Number() + for Numb in xrange(a6, (llens + 1)): + db("select data from %s where page=?" % (a2), (Numb,)) + data = db.fetchone() + db("update %s set data=? where page=?" % (a2), (data[0], page.plus())) + for Numb in xrange(page.plus(), (llens + 1)): + db("delete from %s where page=?" % (a2), (Numb,)) + db("update books set date=? where id=?", (time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[13] + elif a5 in ("only", "только".decode("utf-8")): + if 0 < a6 < (llens + 1): + for Numb in xrange(a6, (llens + 1)): + db("select data from %s where page=?" % (a2), ((Numb + 1),)) + data = db.fetchone() + db("update %s set data=? where page=?" % (a2), (data[0], Numb)) + db("delete from %s where page=?" % (a2), (llens,)) + db("update books set date=? where id=?", (time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[14] + elif a5 in ("after", "после".decode("utf-8")): + if 0 < a6 < (llens - 1): + for Numb in xrange((a6 + 1), (llens + 1)): + db("delete from %s where page=?" % (a2), (Numb,)) + db("update books set date=? where id=?", (time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[13] + else: + answer = AnsBase[2] + else: + answer = AnsBase[30] + else: + answer = AnsBase[2] + elif isNumber(a4): + if llens: + a5 = body[((body.lower()).find(a4) + len(a4)):].strip() + a4 = int(a4) + if 0 < a4 < (llens + 1): + db("update %s set data=? where page=?" % (a2), (a5, a4)) + db("update books set date=? where id=?", (time.asctime(), a2)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[14] + else: + answer = self.AnsBase[7] + else: + answer = AnsBase[2] + else: + answer = self.AnsBase[3] + else: + answer = AnsBase[2] + else: + answer = self.AnsBase[15] + else: + answer = AnsBase[2] + elif a1 in ("delete", "удалить".decode("utf-8")): + a2 = self.getID(list.pop(0)) + if a2: + with database(self.BooksFile) as db: + db("select * from books where id=?", (a2,)) + db_desc = db.fetchone() + if db_desc: + db("drop table %s" % a2) + db("delete from books where id=?", (a2,)) + db.commit() + answer = AnsBase[4] + else: + answer = self.AnsBase[3] + else: + answer = self.AnsBase[15] + else: + answer = AnsBase[2] + else: + answer = AnsBase[2] + else: + answer = AnsBase[1] + Answer(answer, ltype, source, disp) + + def init_books_base(self): + if not os.path.isfile(self.BooksFile): + with database(self.BooksFile) as db: + db("create table books (id text, name text, author text, year integer, genre text, seq1 text, seq2 integer, c0 text, cover text, annotation text, link text, nick text, date text)") + db.commit() + if not os.path.isfile(self.ReadersFile): + with database(self.ReadersFile) as db: + db("create table readers (jid text, book text, page integer)") + db.commit() + + commands = ( + (command_get_books, "books", 2,), + (command_set_books, "library", 7,) + ) + + handlers = ((init_books_base, "00si"),) diff --git a/expansions/books/insc.py b/expansions/books/insc.py new file mode 100644 index 0000000..4bb71e2 --- /dev/null +++ b/expansions/books/insc.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +if DefLANG in ("RU", "UA"): + AnsBase_temp = tuple([line.decode("utf-8") for line in ( + "Библиотека пуста.", # 0 + "Данный %.5s в библиотеке отсутствует.", # 1 + "В библиотеке нет такой серии.", # 2 + "Этой книги в библиотеке нет.", # 3 + "У тебя нет закладок.", # 4 + "Я не могу тайти твои закладки, ибо я не знаю твой JID.", # 5 + "Последняя страница книги - %d.", # 6 + "Книга пуста.", # 7 + "Всего в библиотеке %d книг.", # 8 + "Этого файла не существует.", # 9 + "Уже в библиотеке.", # 10 + "Добавлено с id='%s'.", # 11 + "Такого пункта в библиотечной карте нет.", # 12 + "Неверный номер страницы.", # 13 + "Нет такой страницы.", # 14 + "Неверное название." # 15 + )]) +else: + AnsBase_temp = ( + "The library is empty.", # 0 + "No such %s in base.", # 1 + "No such cycle in base.", # 2 + "No such book in library.", # 3 + "You haven't any bookmarks.", # 4 + "I can't find your bookmark, because I don't know your JID.", # 5 + "The last page is %d.", # 6 + "The book is empty.", # 7 + "There are %d books in library.", # 8 + "File is not exist.", # 9 + "Already in.", # 10 + "Added with id='%s'.", # 11 + "No such data field in base.", # 12 + "Incorrect page number.", # 13 + "No such page.", # 14 + "Incorrect name." # 15 + )
\ No newline at end of file diff --git a/expansions/books/library.en b/expansions/books/library.en new file mode 100644 index 0000000..7ab4c4c --- /dev/null +++ b/expansions/books/library.en @@ -0,0 +1,22 @@ +library control
+library [[add] [book's_name]/[[fb2] [path]]]/[[edit] [book's_id] [[info] [author/year/genre/cycle/number/annotation/link/name] [clear/parametres]]/[[page] [[add] [text]]/[[delete] [before/only/after] [page_number]]/[[page_number] [text]]]]/[[delete] [book's_id]]
+*/library add The Hobbit
+bot would create empty blank for book with name "The Hobbit"
+*/library add fb2 /home/books/The_Hobbit.fb2
+bot would import "The Hobbit" from fb2
+*/library edit The_Two_Towers info number 2
+bot would set the book's number in cycle
+*/library edit The_Two_Towers info link http://example.com/book.html
+bot would add the link to the book's information
+*/library edit Star_Wars page add A long time ago, in a galaxy far far away...
+bot would create the new page with the specified text
+*/library edit Star_Wars page delete before 10
+bot would delete pages before 10th page (10th page would become the first)
+*/library edit Star_Wars page delete after 10
+bot would delete pages after 10th page (10th page would become the last)
+*/library edit Star_Wars page delete only 10
+bot would delete 10th page (11th page would become 10th)
+*/library edit Star_Wars page 10 It is a period of civil war. Rebel spaceships...
+bot would rewrite 10th page with the specified text
+*/library delete Harry_Potter
+bot would remove the book with such ID from the library
\ No newline at end of file diff --git a/expansions/books/library.name b/expansions/books/library.name new file mode 100644 index 0000000..42b36a7 --- /dev/null +++ b/expansions/books/library.name @@ -0,0 +1,4 @@ +{
+ "RU": "библиотека",
+ "UA": "библиотека"
+}
\ No newline at end of file diff --git a/expansions/books/library.ru b/expansions/books/library.ru new file mode 100644 index 0000000..9594d0b --- /dev/null +++ b/expansions/books/library.ru @@ -0,0 +1,22 @@ +управление библиотекой
+библиотека [[добавить] [имя_книги]/[[файл] [путь_к_fb2]]]/[[править] [идентификатор_книги] [[инфо] [автор/год/жанр/серия/номер/аннотация/ссылка/название] [отчистить/параметры]]/[[страница] [[добавить] [текст]]/[[удалить] [до/только/после] [номер_страницы]]/[[номер_страницы] [текст]]]]/[[удалить] [идентификатор_книги]]
+*/библиотека добавить The Hobbit
+бот создаст болванку книги с названием "The Hobbit"
+*/библиотека добавить файл /home/books/The_Hobbit.fb2
+бот импортирует книгу "The Hobbit" из fb2
+*/библиотека править Две_Крепости инфо номер 2
+бот запишет номер книги в серии
+*/библиотека править Две_Крепости инфо ссылка http://example.com/book.html
+бот запишет ссылку в информацию о книге
+*/библиотека править Star_Wars страница добавить A long time ago, in a galaxy far far away...
+бот новую страницу, с соответствующим содержанием
+*/библиотека править Star_Wars страница удалить до 10
+бот удалит всё до 10й страницы (десятая станет первой)
+*/библиотека править Star_Wars страница удалить после 10
+бот удалит всё после 10й страницы (десятая станет последней)
+*/библиотека править Star_Wars страница удалить только 10
+бот удалить 10ю страницу (одиннадцатая станет десятой)
+*/библиотека править Star_Wars страница 10 It is a period of civil war. Rebel spaceships...
+бот пот перезапишет 10ю страницу, соответствующим содержанием
+*/библиотека удалить Harry_Potter
+бот удалит книгу c идентификатором "Harry_Potter" из библиотеки
\ No newline at end of file diff --git a/expansions/bot_sends/invite.name b/expansions/bot_sends/invite.name index af4b3e9..eef4715 100644 --- a/expansions/bot_sends/invite.name +++ b/expansions/bot_sends/invite.name @@ -1,4 +1,4 @@ {
- "RU": "пригласить",
- "UA": "пригласить"
+ "RU": "пригласи",
+ "UA": "пригласи"
}
\ No newline at end of file diff --git a/expansions/bot_sends/invite.ru b/expansions/bot_sends/invite.ru index 0a36df1..4be6bb1 100644 --- a/expansions/bot_sends/invite.ru +++ b/expansions/bot_sends/invite.ru @@ -1,4 +1,4 @@ -отправка приглашения пользователю
-пригласить [jid/nick]
-*/пригласить someone@jabber.ru
+отправка приглашения в конференцию пользователю
+пригласи [jid/nick]
+*/пригласи someone@jabber.ru
бот отошлёт приглашение someone@jabber.ru
\ No newline at end of file diff --git a/expansions/cron/insc.py b/expansions/cron/insc.py index c72093f..9bf70a0 100644 --- a/expansions/cron/insc.py +++ b/expansions/cron/insc.py @@ -8,7 +8,7 @@ if DefLANG in ("RU", "UA"): "\n+ ещё %d раз.", # 3 "Выполню в:\n%s", # 4 "Тайм-аут не может быть меньше минуты и больше 48 дней.", # 5 - "Выполню в %s", # 6 + "Выполню в %s.", # 6 "Нет запланированных заданий.", # 7 "\n[№][ID][Команда][Deadline]\n%s", # 8 "Дата/Время введены некорректно." # 9 @@ -21,7 +21,7 @@ else: "\n+ %d more times.", # 3 "It will be executed at:\n%s", # 4 "The timeout can't be less than 60 seconds and more than 48 days.", # 5 - "It will be executed at %s", # 6 + "It will be executed at %s.", # 6 "There are no tasks.", # 7 "\n[#][ID][Command][Deadline]\n%s", # 8 "Date/Time are incorrect." # 9 diff --git a/expansions/help/insc.py b/expansions/help/insc.py index f38a38d..42d0205 100644 --- a/expansions/help/insc.py +++ b/expansions/help/insc.py @@ -3,11 +3,11 @@ if DefLANG in ("RU", "UA"): AnsBase_temp = tuple([line.decode("utf-8") for line in ( "Команда «%s» находится в плагине -» %s", # 0 - "Доступ к команде «%s» - %d", # 1 + "Доступ к команде «%s» - %d.", # 1 "\n%s\nСинтаксис:\n»»» %s", # 2 "\nПримеры:", # 3 "Файл с описанием этой команды отсутствует...", # 4 - "Пиши «комлист» для получения полного списка команд, пиши «хелп [команда]» чтобы понять как она работает", # 5 + "Пиши «комлист» для получения полного списка команд, пиши «хелп [команда]», чтобы понять как она работает.", # 5 "Полный список команд%s", # 6 " (Командный префикс - «%s»):", # 7 "\n\n• Команды для Суперадмина [доступ 8] - %s:\n%s", # 8 @@ -18,17 +18,17 @@ if DefLANG in ("RU", "UA"): "\n\n• Команды для Модеров [доступ 3] - %s:\n%s", # 13 "\n\n• Команды для Участников/Мемберов [доступ 2] - %s:\n%s", # 14 "\n\n• Команды для Участников [доступ 1] - %s:\n%s", # 15 - "\n\nТвой уровень доступа - %s", # 16 + "\n\nТвой уровень доступа - %s.", # 16 "Файл со справкой повреждён!" # 17 )]) else: AnsBase_temp = ( "Command '%s' located in expansion %s", # 0 - "%s's access - %d", # 1 + "%s's access - %d.", # 1 "\n%s\nSyntax:\n*** %s", # 2 "\nExamples:", # 3 "Help-file for this command isn't exists...", # 4 - "Type 'commands' for a complete list of commands, type 'help [command]' to know how it works", # 5 + "Type 'commands' for a complete list of commands, type 'help [command]', to know how it works.", # 5 "Full command list%s", # 6 " (Command prefix - '%s'):", # 7 "\n\n# Superadmin's commands [access 8] - %s:\n%s", # 8 @@ -39,6 +39,6 @@ else: "\n\n# Moder's commands [access 3] - %s:\n%s", # 13 "\n\n# User/Member's commands [access 2] - %s:\n%s", # 14 "\n\n# User's commands [access 1] - %s:\n%s", # 15 - "\n\nYour access level - %s", # 16 + "\n\nYour access level - %s.", # 16 "Help file is damaged!" # 17 )
\ No newline at end of file diff --git a/expansions/sconf_attrs/code.py b/expansions/sconf_attrs/code.py index 6dfa322..e91d95e 100644 --- a/expansions/sconf_attrs/code.py +++ b/expansions/sconf_attrs/code.py @@ -81,7 +81,7 @@ class expansion_temp(expansion): else: answer = self.AnsBase[9] % (body) else: - answer = self.AnsBase[10] % (", ".join(cPrefs)) + answer = self.AnsBase[10] % ("', '".join(cPrefs)) else: answer = AnsBase[10] elif Chats[source[1]].cPref: diff --git a/expansions/sconf_attrs/insc.py b/expansions/sconf_attrs/insc.py index 013ace3..fbbf4e8 100644 --- a/expansions/sconf_attrs/insc.py +++ b/expansions/sconf_attrs/insc.py @@ -5,14 +5,14 @@ if DefLANG in ("RU", "UA"): "Сдаётся мне '%s' сейчас оффлайн.", # 0 "Сдаётся мне '%s' итак закреплён за этой конфой.", # 1 "'%s' нет среди доступных клиентов!", # 2 - "смена jid'а", # 3 - "Переименовался в «%s»", # 4 + "Смена jid'а...", # 3 + "Переименовался в «%s».", # 4 "В моём нике не должно быть больше 16ти символов.", # 5 "Префикс удалён.", # 6 "Префикс и без того отсутствует.", # 7 "Отныне знак '%s' является префиксом здесь.", # 8 "Знак '%s' итак префикс здесь.", # 9 - "Недоступный знак для префикса! Доступные: %s", # 10 + "Недоступный знак для префикса! Доступные: '%s'.", # 10 "'%s' является здесь префиксом.", # 11 "Префикс не установлен.", # 12 "Статус '%s' мне неизвестен." # 13 @@ -23,13 +23,13 @@ else: "'%s' is alredy owned by this conferense.", # 1 "'%s' not in available clients.", # 2 "Jabber ID changing...", # 3 - "My new nick is '%s'", # 4 + "My new nick is '%s'.", # 4 "My nick can't be longer than 16 symbols.", # 5 "Prefix was deleted.", # 6 "So there is no prefix.", # 7 "'%s' is prefix now here.", # 8 "So symbol '%s' is prefix here.", # 9 - "Unavalable symbol for prefix! Avalable: %s", # 10 + "Unavalable symbol for prefix! Avalable: '%s'.", # 10 "'%s' is current prefix here.", # 11 "Prefix wasn't set.", # 12 "'%s' isn't a status." # 13 diff --git a/expansions/session_stat/insc.py b/expansions/session_stat/insc.py index 989cad0..0e27e87 100644 --- a/expansions/session_stat/insc.py +++ b/expansions/session_stat/insc.py @@ -3,24 +3,24 @@ if DefLANG in ("RU", "UA"): AnsBase_temp = tuple([line.decode("utf-8") for line in ( "\n*// Статистика работы (Pid: %d):", # 0 - "\n-//- Время работы %s", # 1 - "\n-//- Последняя сессия %s", # 2 - "\n-//- Получено %s сообщений", # 3 - "\n-//- Выполнено %s команд", # 4 - "\n-//- Обработано %s презенсов и %s iq-запросов", # 5 - "\n-//- Отправлено %s сообщений и %s iq-запросов", # 6 - "\n-//- Обслуживаю %d конференций", # 7 - "\n-//- Зафиксировано %d пользователей", # 8 + "\n# Время работы %s", # 1 + "\n# Последняя сессия %s", # 2 + "\n# Получено %s сообщений", # 3 + "\n# Выполнено %s команд", # 4 + "\n# Обработано %s презенсов и %s iq-запросов", # 5 + "\n# Отправлено %s сообщений и %s iq-запросов", # 6 + "\n# Обслуживаю %d конференций", # 7 + "\n# Зафиксировано %d пользователей", # 8 "", # 9 - "\n-//- Произошло %d ошибок и %s Dispatch Errors", # 10 - "\n-//- Записей crash логов %s", # 11 - "\n-//- Создано %s тредов, %d из них активно", # 12 - "\n-//- Потрачено %.2f секунд процессора", # 13 - "\n-//- Потрачено %s мегабайт оперативной памяти", # 14 - "\nВремя работы: %s", # 15 - "\nПоследняя сессия: %s\nВсего %s перезагрузок:\n%s", # 16 + "\n# Произошло %d ошибок и %s Dispatch Errors", # 10 + "\n# Записей crash логов %s", # 11 + "\n# Создано %s тредов, %d из них активно", # 12 + "\n# Потрачено %.2f секунд процессора", # 13 + "\n# Потрачено %s мегабайт оперативной памяти", # 14 + "\nВремя работы: %s.", # 15 + "\nПоследняя сессия: %s.\nВсего %s перезагрузок:\n%s.", # 16 " - Работаю без перезагрузок!", # 17 - "\nСтатистика по команде '%s':\nВсего использовали - %s раз (%d юзеров)", # 18 + "\nСтатистика по команде '%s':\nВсего использовали - %s раз (%d юзеров).", # 18 "\n[№][Команда][Использований][Юзеров]", # 19 "Невозможно отправить ошибку, смотри к крешлогах.", # 20 "Ошибки №%s не существует!", # 21 @@ -29,24 +29,24 @@ if DefLANG in ("RU", "UA"): else: AnsBase_temp = ( "\n*// Session statistics (Pid: %d):", # 0 - "\n-//- Bot uptime %s", # 1 - "\n-//- Last working set %s", # 2 - "\n-//- Obtained %s messages", # 3 - "\n-//- Completed %s commands", # 4 - "\n-//- Processed %s presences & %s iq-request", # 5 - "\n-//- Sent %s messages & %s iq-request", # 6 - "\n-//- Serve %d conferences", # 7 - "\n-//- Fixed %d users", # 8 + "\n# Bot uptime %s", # 1 + "\n# Last working set %s", # 2 + "\n# Obtained %s messages", # 3 + "\n# Completed %s commands", # 4 + "\n# Processed %s presences & %s iq-request", # 5 + "\n# Sent %s messages & %s iq-request", # 6 + "\n# Serve %d conferences", # 7 + "\n# Fixed %d users", # 8 "", # 9 - "\n-//- Happened %d exceptions & %s Dispatch Errors", # 10 - "\n-//- Wrote crash logs %s", # 11 - "\n-//- Created %s threads, %d is now active", # 12 - "\n-//- Used %.2f processor seconds", # 13 - "\n-//- Used %s megabyte RAM", # 14 - "\nBot uptime: %s", # 15 - "\nLast working set: %s\nReloads (%s):\n%s", # 16 - " - Work without reboots!", # 17 - "\nCommand '%s' usage statistics:\nTotal used - %s times (%d users)", # 18 + "\n# Happened %d exceptions & %s Dispatch Errors", # 10 + "\n# Wrote crash logs %s", # 11 + "\n# Created %s threads, %d is now active", # 12 + "\n# Used %.2f processor seconds", # 13 + "\n# Used %s megabyte RAM", # 14 + "\nBot's uptime: %s.", # 15 + "\nLast working set: %s.\nReloads (%s):\n%s.", # 16 + " - Working without restarts!", # 17 + "\nCommand '%s' usage statistics:\nTotal used - %s times (%d users).", # 18 "\n[#][Command][Used][Users used]", # 19 "Unable to send error, look for crash logs.", # 20 "Exception #%s isn't exists!", # 21 diff --git a/expansions/sheriff/insc.py b/expansions/sheriff/insc.py index acac4c1..88e6070 100644 --- a/expansions/sheriff/insc.py +++ b/expansions/sheriff/insc.py @@ -45,9 +45,9 @@ if DefLANG in ("RU", "UA"): "\nМаксимальная длинна сообщения: %d\nАнтикапс: ", # 31 "\nМаксимальная длинна презенса: %d\nРежим Спарты: ", # 32 "бляд/ блят/ бля / блять / плять /хуй/ ибал/ ебал/ хуи/хуител/хуя/ хую/ хуе/ ахуе/ охуе/хуев/ хер /хер/ пох / нах /писд/пизд/рizd/ пздц / еб/ епана / епать / ипать / выепать / ибаш/ уеб/проеб/праеб/приеб/съеб/взъеб/взьеб/въеб/вьеб/выебан/перееб/недоеб/долбоеб/долбаеб/ ниибац/ неебац/ неебат/ ниибат/ пидар/ рidаr/ пидар/ пидор/педор/пидор/пидарас/пидараз/ педар/педри/пидри/ заеп/ заип/ заеб/ебучий/ебучка /епучий/епучка / заиба/заебан/заебис/ выеб/выебан/ поеб/ наеб/ наеб/сьеб/взьеб/вьеб/ гандон/ гондон/пахуи/похуис/ манда /мандав/залупа/ залупог", # 33 - "сервер в белом списке", # 34 - "сервера нет в дополнительном белом списке", # 35 - "это не сервер" # 36 + "Сервер в белом списке.", # 34 + "Сервера нет в дополнительном белом списке.", # 35 + "Это не сервер." # 36 )]) else: AnsBase_temp = ( @@ -94,7 +94,7 @@ else: "\nMaximum message length: %d\nAnticaps: ", # 31 "\nMaximum presence length: %d\nSparta mode: ", # 32 " fuck / shit /motherfucker/unclefucker/ bitch / faggot / cock / cunt ", # 33 - "server already in the white list", # 34 - "server not in extra white list", # 35 - "this is not a server" # 36 + "Server already in the white list.", # 34 + "Server not in extra white list.", # 35 + "This is not a server." # 36 )
\ No newline at end of file diff --git a/expansions/talkers/insc.py b/expansions/talkers/insc.py index aa1bfdb..071554f 100644 --- a/expansions/talkers/insc.py +++ b/expansions/talkers/insc.py @@ -3,14 +3,14 @@ if DefLANG in ("RU", "UA"): AnsBase_temp = tuple([line.decode("utf-8") for line in ( "\n[№][Юзер][Фраз][Слов][Коэф.]", # 0 - "нет статистики", # 1 + "Нет статистики.", # 1 "\n[Фраз][Слов][Коэф.]\n%d\t%d\t%s", # 2 "\n*! Поиск в базе произведён по ключу." # 3 )]) else: AnsBase_temp = ( "\n[#][User][Messages][Words][Coef.]", # 0 - "no statistics", # 1 + "No statistics.", # 1 "\n[Messages][Words][Coef.]\n%d\t%d\t%s", # 2 "\n*! Search the database produced by the key." # 3 )
\ No newline at end of file diff --git a/expansions/user_stats/insc.py b/expansions/user_stats/insc.py index c75be61..cd07397 100644 --- a/expansions/user_stats/insc.py +++ b/expansions/user_stats/insc.py @@ -5,18 +5,18 @@ if DefLANG in ("RU", "UA"): "\nВсего входов - %d\nВремя последнего входа - %s\nПоследняя роль - %s", # 0 "\nВремя последнего выхода - %s\nПричина выхода - %s", # 1 "\nНики: %s", # 2 - "нет статистики", # 3 - "«%s» сидит здесь - %s", # 4 - "ты провёл здесь - %s", # 5 - "здесь нет такого юзера" # 6 + "Нет статистики.", # 3 + "«%s» сидит здесь - %s.", # 4 + "Ты провёл здесь - %s.", # 5 + "Здесь нет такого юзера." # 6 )]) else: AnsBase_temp = ( "\nTotal joins - %d\nLast join time - %s\nLast role - %s", # 0 "\nLast leave time - %s\nExit reason - %s", # 1 "\nNicks: %s", # 2 - "no statistics", # 3 - "'%s' spent here - %s", # 4 - "You spent here - %s", # 5 - "No sutch user here" # 6 + "No statistics.", # 3 + "'%s' spent here - %s.", # 4 + "You spent here - %s.", # 5 + "No such user here." # 6 )
\ No newline at end of file diff --git a/librarys.zip b/librarys.zip Binary files differindex 98faac3..d3861df 100644 --- a/librarys.zip +++ b/librarys.zip diff --git a/static/insc.py b/static/insc.py index 63e4a2c..b659dba 100644 --- a/static/insc.py +++ b/static/insc.py @@ -2,29 +2,29 @@ if DefLANG in ("RU", "UA"): AnsBase = tuple([line.decode("utf-8") for line in ( - "данная команда доступна исключительно в конференциях", # 0 - "данная команда подразумевает использование параметров", # 1 - "инвалид синтакс", # 2 - "«%s» нет в списке конференций", # 3 - "сделано", # 4 - "слишком длинные параметры", # 5 - "нет такой команды", # 6 - "не могу", # 7 - "меня нет в этой конференции", # 8 - "тип указан не корректно", # 9 - "недостаточный доступ", # 10 - "ответ в привате", # 11 + "Данная команда доступна исключительно в конференциях.", # 0 + "Данная команда подразумевает использование параметров.", # 1 + "Инвалид синтакс.", # 2 + "«%s» нет в списке конференций.", # 3 + "Сделано.", # 4 + "Слишком длинные параметры.", # 5 + "Нет такой команды.", # 6 + "Не могу.", # 7 + "Меня нет в этой конференции.", # 8 + "Тип указан не корректно.", # 9 + "Недостаточный доступ.", # 10 + "Ответ в привате.", # 11 "№ %d. - %s", # 12 - "команды «%s» (%s)", # 13 - "процесса «%s»", # 14 + "Команды «%s» (%s)", # 13 + "Процесса «%s»", # 14 "При выполнении %s --» произошла ошибка!", # 15 "Ошибку смотри по команде --» 'ошибка %d' (Крэшфайл --» %s)", # 16 "Ошибку смотри по командам --» 'ошибка %d', 'sh cat %s'", # 17 "%s[...]\n\n** Лимит %d знаков! Продолжение по команде «далее».", # 18 "Команда '%s' сейчас недоступна!", # 19 - "Ошибка %s (%s) - конфа: «%s»", # 20 - "Ошибка %s (%s), полный выход из «%s»", # 21 - "Ошибка %s (%s), пришлось выйти из «%s»", # 22 + "Ошибка %s (%s) - конфа: «%s».", # 20 + "Ошибка %s (%s), полный выход из «%s».", # 21 + "Ошибка %s (%s), пришлось выйти из «%s».", # 22 "Отказываюсь работать без прав!", # 23 "Отключаю все функции до получения прав админа!", # 24 "Получение прав...", # 25 @@ -32,22 +32,22 @@ if DefLANG in ("RU", "UA"): "Помощь по команде «ХЕЛП» (последнее действие - %s)", # 27 "Клиент «%s» упал!", # 28 "JID «%s» используется в другом клиенте! (отключаю его)", # 29 - "это не число" # 30 + "Это не число." # 30 )]) else: AnsBase = ( - "This command is available only in conferences", # 0 - "This command implies arguments using", # 1 - "Invalid syntax", # 2 - "There is not '%s' in chats list", # 3 - "Done", # 4 - "Parameters should be shorter", # 5 - "Such command isn't exists", # 6 - "I can't", # 7 - "There is not such conference in my list", # 8 - "Type specified is incorrect", # 9 - "You need to access higher", # 10 - "You should to look in to your private", # 11 + "This command is available only in conferences.", # 0 + "This command implies arguments using.", # 1 + "Invalid syntax.", # 2 + "There is not '%s' in chats list.", # 3 + "Done.", # 4 + "Parameters should be shorter.", # 5 + "Such command isn't exists.", # 6 + "I can't.", # 7 + "There is not such conference in my list.", # 8 + "Type specified is incorrect.", # 9 + "You need to access higher.", # 10 + "You should to look in to your private.", # 11 "# %d. - %s", # 12 "command '%s' (%s)", # 13 "prosess '%s'", # 14 @@ -56,9 +56,9 @@ else: "Type --> 'excinfo %d' or 'sh cat %s' to show error", # 17 "%s[...]\n\n** %d symbols limit! Type 'more' to show rest of the text.", # 18 "Command '%s' is unavalable now!", # 19 - "Error %s (%s) - conference: '%s'", # 20 - "Error %s (%s), full exit from '%s'", # 21 - "Error %s (%s), I leaved '%s'", # 22 + "Error %s (%s) - conference: '%s'.", # 20 + "Error %s (%s), full exit from '%s'.", # 21 + "Error %s (%s), I leaved '%s'.", # 22 "Service without admin affilation is unavalable!", # 23 "I Disable all functions until I'll become an admin!", # 24 "Obtaining rights...", # 25 @@ -66,5 +66,5 @@ else: "Type HELP to know more (last action - %s)", # 27 "Client '%s' falled!", # 28 "JID '%s' used in another client! (I have to disconnect it)", # 29 - "This is not a number" # 30 + "This is not a number." # 30 )
\ No newline at end of file |