1

fix: wot clans

This commit is contained in:
denis-kostin
2015-09-11 23:32:46 +04:00
parent e697c71390
commit e093e83746

View File

@@ -335,17 +335,16 @@ def wotclan(type, jid, nick, text):
if text: if text:
try: try:
data = wot_api.fetch('wgn/clans/list/', 'search=%s' % text) data = wot_api.fetch('wgn/clans/list/', 'search=%s' % text)
claninfo = [i for i in data if i['abbreviation'] == text] claninfo = [i for i in data if i['tag'] == text]
if claninfo: if claninfo:
claninfo = claninfo[0] claninfo = claninfo[0]
clid = claninfo['clan_id'] clid = claninfo['clan_id']
owner = claninfo['owner_name']
created_at = claninfo['created_at'] created_at = claninfo['created_at']
abbrev = claninfo['abbreviation'] abbrev = claninfo['tag']
data = wot_api.fetch('wot/clan/info/', 'clan_id=%s' % clid) data = wot_api.fetch('wgn/clans/info/', 'clan_id=%s' % clid)
claninfo2 = data[str(clid)] claninfo2 = data[str(clid)]
msg = L('Name: %s [%s]','%s/%s'%(jid,nick)) % (claninfo2['name'], abbrev) msg = L('Name: %s [%s]','%s/%s'%(jid,nick)) % (claninfo2['name'], abbrev)
msg += L('\nOwner: %s','%s/%s'%(jid,nick)) % owner msg += L('\nOwner: %s','%s/%s'%(jid,nick)) % claninfo2['creator_name']
msg += L('\nCreated at: %s','%s/%s'%(jid,nick)) % time.ctime(created_at) msg += L('\nCreated at: %s','%s/%s'%(jid,nick)) % time.ctime(created_at)
msg += L('\nCount of members: %s','%s/%s'%(jid,nick)) % claninfo2['members_count'] msg += L('\nCount of members: %s','%s/%s'%(jid,nick)) % claninfo2['members_count']
msg += L('\nMotto: %s','%s/%s'%(jid,nick)) % claninfo2['motto'] msg += L('\nMotto: %s','%s/%s'%(jid,nick)) % claninfo2['motto']