Answer the question
In order to leave comments, you need to log in
Why is there a key error when creating a dictionary in telebot?
class Player():
def __init__(self, name) -> object:
self.ref = 0
self.bal = 0
user_ur = {}
@bot.message_handler(content_types=['text'])
def send_text(message):
global user_ur
msg = message.chat.id
if message.text == 'Balance':
print(str(user_ur[msg].ref))
bot.send_message(message.chat.id,
' Your personal balance: 0.00' + ' Emerald' + '\n' + '\n' + ' Total partners: ' +
str(user_ur[msg].ref))
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