Answer the question
In order to leave comments, you need to log in
Error in code 'UserXtrCounters' object is not subscriptable. How to fix?
code:
@bot.on.chat_message(text='bank', lower=True)
async def Bank(ans: Message):
chat_id = ans.chat_id
c.execute('SELECT stavki FROM chat_1 WHERE chat_id=%d' % chat_id )
res = c.fetchone()[0]
print(f'\n{res}')
bank = ''
result = res.split(';')
del result[0]
del result[-1]
bank = ' '
print(result)
for ell in result:
el = ell.split(':')
data = await bot.api.users.get(user_ids=el[0])
name = await data[0]['first_name'] + ' ' + data[0]['last_name']
bank += f"@id{el[0]}({name}) placed {el[2]} VkCoins on {el[1]}\n\n "
await ans(f'{bank}')
error
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question