diff options
author | VitaliyS <vitaliy@root.ua> | 2014-02-06 03:18:18 +0400 |
---|---|---|
committer | VitaliyS <vitaliy@root.ua> | 2014-02-06 03:18:18 +0400 |
commit | 3d1b816742ffa69eb8ce3375f1aba3d5269b25ac (patch) | |
tree | 68b73f1dcf1ddc83094f309518611c17c7b72843 | |
parent | 93ac8c34b08177dfadc44a6b93c2fdacd4192d43 (diff) |
upd: wot.py
-rw-r--r-- | data/locales/ru.txt | 26 | ||||
-rw-r--r-- | data/locales/ua.txt | 28 | ||||
-rw-r--r-- | plugins/wot.py | 8 |
3 files changed, 48 insertions, 14 deletions
diff --git a/data/locales/ru.txt b/data/locales/ru.txt index bc900e4..f4520df 100644 --- a/data/locales/ru.txt +++ b/data/locales/ru.txt @@ -1,7 +1,22 @@ -#--------------------------------------------- -# Autogenerate for locales -# (c) Disabler Production Lab. -#--------------------------------------------- +# --------------------------------------------------------------------------- # +# # +# Russian locale (woman) for iSida Jabber Bot # +# Copyright (C) diSabler <dsy@dsy.name> # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <http://www.gnu.org/licenses/>. # +# # +# --------------------------------------------------------------------------- # # file: kernel.py Error! Ошибка! @@ -1382,7 +1397,7 @@ Name: %s [%s] Название: %s [%s] \nMotto: %s \nДевиз: %s Clan not found Клан не найден Impossible to get info Невозможно получить информацию -World of Tanks - info about user. Usage: wot nick [tank] World of Tanks - информация о пользователе. Использование: wot ник [танк] +World of Tanks - info about user. Usage: wot [nick [tank]] World of Tanks - информация о пользователе. Использование: wot [ник [танк]] World of Tanks - info about clan. Usage: wotclan clan World of Tanks - информация о клане. Пример: wotclan клан World of Tanks - info about offers. Usage: wotoffers [active|all] [real|prem|info] World of Tanks - информация о акциях. Пример: wotoffers [active|all] [real|prem|info] @@ -1818,4 +1833,3 @@ API settings Настройки API # write locale file: ru.txt # total: 1479 # missed translations: 1 - diff --git a/data/locales/ua.txt b/data/locales/ua.txt index 853660c..dddd0dc 100644 --- a/data/locales/ua.txt +++ b/data/locales/ua.txt @@ -1,7 +1,22 @@ -#--------------------------------------------- -# Autogenerate for locales -# (c) Disabler Production Lab. -#--------------------------------------------- +# --------------------------------------------------------------------------- # +# # +# Ukrainian locale (woman) for iSida Jabber Bot # +# Copyright (C) Vit@liy <vitaliy@root.ua> # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <http://www.gnu.org/licenses/>. # +# # +# --------------------------------------------------------------------------- # # file: kernel.py Error! Помилка! @@ -1382,7 +1397,7 @@ Name: %s [%s] Назва: %s [%s] \nMotto: %s \nДевіз: %s Clan not found Клан не знайдено Impossible to get info Неможливо отримати інформацію -World of Tanks - info about user. Usage: wot nick [tank] World of Tanks - інформація про користувача. Використання: wot нік [танк] +World of Tanks - info about user. Usage: wot [nick [tank]] World of Tanks - інформація про користувача. Використання: wot [нік [танк]] World of Tanks - info about clan. Usage: wotclan clan World of Tanks - інформація про клан. Приклад: wotclan клан World of Tanks - info about offers. Usage: wotoffers [active|all] [real|prem|info] World of Tanks - інформація про акції. Приклад: wotoffers [active|all] [real|prem|info] @@ -1817,5 +1832,4 @@ API settings Налаштування API # write locale file: ua.txt # total: 1479 -# missed translations: 3 - +# missed translations: 1 diff --git a/plugins/wot.py b/plugins/wot.py index 336b91d..341ebe5 100644 --- a/plugins/wot.py +++ b/plugins/wot.py @@ -25,6 +25,8 @@ API_ADDR = 'http://api.worldoftanks.ru';
APP_ID = '171745d21f7f98fd8878771da1000a31';
+clantags = re.compile('(\(.*?\))|(\[.*?\])')
+
def get_tanks_data():
data = urllib.urlopen('%s/2.0/encyclopedia/tanks/?application_id=%s&fields=level,name_i18n,name' % (API_ADDR, APP_ID))
d = json.load(data)
@@ -46,6 +48,10 @@ except: def wot(type, jid, nick, text):
text = text.strip()
+ if not text:
+ tmp_text = clantags.sub('', nick).strip().split(' ', 1)[0]
+ if re.match('[\da-zA-Z_].*?', tmp_text):
+ text = tmp_text
if text:
text = text.split(' ', 1)
if len(text) == 1:
@@ -270,6 +276,6 @@ def wotoffers(type, jid, nick, text): global execute
-execute = [(3, 'wot', wot, 2, 'World of Tanks - info about user. Usage: wot nick [tank]'),
+execute = [(3, 'wot', wot, 2, 'World of Tanks - info about user. Usage: wot [nick [tank]]'),
(3, 'wotclan', wotclan, 2, 'World of Tanks - info about clan. Usage: wotclan clan'),
(3, 'wotoffers', wotoffers, 2, 'World of Tanks - info about offers. Usage: wotoffers [active|all] [real|prem|info]')]
|