Answer the question
In order to leave comments, you need to log in
What to do if the variable is not sent to pyTelegramBotAPI?
Here is the code:
import telebot
import requests
response = requests.get(
'https://api.fortnitetracker.com/v1/profile/pc/Pikachu',
headers= {'TRN-Api-Key':TRN}
)
r = response.json()
r2 = r['lifeTimeStats']
# Здесь я пропустил функцию /start, клавиатуру и ещё парочку функций
@bot.message_handler(content_types=['text'])
def static(message):
if message.text == 'Всего Побед ':
for x in r2:
if x.get('key') == 'Wins':
x2 = x.get('value')
bot.send_message(message.chat.id, 'Всего побед: ', x2)
Answer the question
In order to leave comments, you need to log in
Because send_message is not similar to print, where you can list variables separated by commas, and they will be displayed, more correctly f"Total wins : {x2}", that is, the finished string must be transferred immediately
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question