diff options
author | VitaliyS <hetleven@yandex.ua> | 2014-12-27 03:58:12 +0300 |
---|---|---|
committer | VitaliyS <hetleven@yandex.ua> | 2014-12-27 03:58:12 +0300 |
commit | 8fe2ca26467c28ce9a86491ad5b42d403420e789 (patch) | |
tree | 2b13e747cddf8d81f3fa5db3e3a477fc521bebde | |
parent | 15c0f74823baea91409b557aa08249cc6e82551e (diff) |
upd: WoT plugin - added info about last visit
-rw-r--r-- | data/locales/ru.txt | 8 | ||||
-rw-r--r-- | data/locales/ua.txt | 8 | ||||
-rw-r--r-- | plugins/wot.py | 13 |
3 files changed, 18 insertions, 11 deletions
diff --git a/data/locales/ru.txt b/data/locales/ru.txt index 84adc74..7660f53 100644 --- a/data/locales/ru.txt +++ b/data/locales/ru.txt @@ -1404,6 +1404,9 @@ Impossible to get tanks' statistics Невозможно получить ста - deerhead 2nd class - оленевод 2-го класса - deerhead 1st class - оленевод 1-го класса - master deerhead - мастер-оленевод +\nLast seen: \nПоследний раз замечен: +%s\n- in battle: %s %s\n- в бою: %s +%s\n- online: %s %s\n- в сети: %s Impossible to get statistics Невозможно получить статистику Query error Ошибка запроса Player not found Игрок не найден @@ -1416,7 +1419,6 @@ 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 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] # file: plugins/wtf.py I know that %s is %s Я знаю, что %s - %s @@ -1855,5 +1857,5 @@ API settings Настройки API World of Tanks settings Настройки плагина World of Tanks # write locale file: ru.txt -# total: 1432 -# regenarated without mistakes! +# total: 1434 +# missed translations: 3 diff --git a/data/locales/ua.txt b/data/locales/ua.txt index ca74162..700b205 100644 --- a/data/locales/ua.txt +++ b/data/locales/ua.txt @@ -1404,6 +1404,9 @@ Impossible to get tanks' statistics Неможливо отримати стат - deerhead 2nd class - оленевід 2-го класу - deerhead 1st class - оленевід 1-го класу - master deerhead - майстер-оленевід +\nLast seen: \nОстанній раз помічений: +%s\n- in battle: %s %s\n- в бою: %s +%s\n- online: %s %s\n- в мережі: %s Impossible to get statistics Неможливо отримати статистику Query error Помилка запиту Player not found Гравця не знайдено @@ -1416,7 +1419,6 @@ 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 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] # file: plugins/wtf.py I know that %s is %s Я знаю, що %s - %s @@ -1855,5 +1857,5 @@ API settings Налаштування API World of Tanks settings Налаштування плагіна World of Tanks # write locale file: ua.txt -# total: 1432 -# regenarated without mistakes! +# total: 1434 +# missed translations: 3 diff --git a/plugins/wot.py b/plugins/wot.py index 5e2a3b7..b3fe7d4 100644 --- a/plugins/wot.py +++ b/plugins/wot.py @@ -61,7 +61,7 @@ def wot(type, jid, nick, text): vdata = wot_api.fetch('wot/tanks/stats', 'account_id=%s' % player_id)
- pdata = wot_api.fetch('wot/account/info', 'account_id=%s&fields=nickname,statistics,global_rating' % player_id)
+ pdata = wot_api.fetch('wot/account/info', 'account_id=%s&fields=nickname,statistics,global_rating,last_battle_time,logout_at' % player_id)
stat = pdata[player_id]['statistics']
claninfo = wot_api.fetch('wot/clan/membersinfo', 'member_id=%s' % player_id)
@@ -114,7 +114,7 @@ def wot(type, jid, nick, text): msg = '%s: %s/%s' % (wotname, wins, battles)
else:
- try:
+ if 1: #try:
win_percent = round(100.0 * wins / battles, 2)
msg = '%s: %s/%s (%s%%)' % (wotname, wins, battles, win_percent)
@@ -219,9 +219,12 @@ def wot(type, jid, nick, text): msg += L(' - master deerhead','%s/%s'%(jid,nick))
except:
pass
-
- except:
- msg = L('Impossible to get statistics','%s/%s'%(jid,nick))
+ msg += L('\nLast seen:','%s/%s'%(jid,nick))
+ msg = L('%s\n- in battle: %s','%s/%s'%(jid,nick)) % (msg, datetime.datetime.fromtimestamp(pdata[player_id]['last_battle_time']))
+ msg = L('%s\n- online: %s','%s/%s'%(jid,nick)) % (msg, datetime.datetime.fromtimestamp(pdata[player_id]['logout_at']))
+
+ #except:
+ # msg = L('Impossible to get statistics','%s/%s'%(jid,nick))
elif not pdata['status']:
msg = L('Query error','%s/%s'%(jid,nick))
else:
|