我正在尝试按照使用ConversationHandler启动机器人的示例代码运行。
#!/usr/bin/env python
# pylint: disable=unused-argument, wrong-import-position
# This program is dedicated to the public domain under the CC0 license.
"""
First, a few callback functions are defined. Then, those functions are passed to
the Application and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Example of a bot-user conversation using ConversationHandler.
Send /start to initiate the conversation.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
import logging
from telegram import __version__ as TG_VER
try:
from telegram import __version_info__
except ImportError:
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
if __version_info__ < (20, 0, 0, "alpha", 5):
raise RuntimeError(
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
f"{TG_VER} version of this example, "
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
)
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
from telegram.ext import (
Application,
CommandHandler,
ContextTypes,
ConversationHandler,
MessageHandler,
filters,
)
# Enable logging
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
logger = logging.getLogger(__name__)
GENDER, PHOTO, LOCATION, BIO = range(4)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Starts the conversation and asks the user about their gender."""
reply_keyboard = [["Boy", "Girl", "Other"]]
await update.message.reply_text(
"Hi! My name is Professor Bot. I will hold a conversation with you. "
"Send /cancel to stop talking to me.\n\n"
"Are you a boy or a girl?",
reply_markup=ReplyKeyboardMarkup(
reply_keyboard, one_time_keyboard=True, input_field_placeholder="Boy or Girl?"
),
)
return GENDER
async def gender(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Stores the selected gender and asks for a photo."""
user = update.message.from_user
logger.info("Gender of %s: %s", user.first_name, update.message.text)
await update.message.reply_text(
"I see! Please send me a photo of yourself, "
"so I know what you look like, or send /skip if you don't want to.",
reply_markup=ReplyKeyboardRemove(),
)
return PHOTO
async def photo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Stores the photo and asks for a location."""
user = update.message.from_user
photo_file = await update.message.photo[-1].get_file()
await photo_file.download_to_drive("user_photo.jpg")
logger.info("Photo of %s: %s", user.first_name, "user_photo.jpg")
await update.message.reply_text(
"Gorgeous! Now, send me your location please, or send /skip if you don't want to."
)
return LOCATION
async def skip_photo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Skips the photo and asks for a location."""
user = update.message.from_user
logger.info("User %s did not send a photo.", user.first_name)
await update.message.reply_text(
"I bet you look great! Now, send me your location please, or send /skip."
)
return LOCATION
async def location(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Stores the location and asks for some info about the user."""
user = update.message.from_user
user_location = update.message.location
logger.info(
"Location of %s: %f / %f", user.first_name, user_location.latitude, user_location.longitude
)
await update.message.reply_text(
"Maybe I can visit you sometime! At last, tell me something about yourself."
)
return BIO
async def skip_location(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Skips the location and asks for info about the user."""
user = update.message.from_user
logger.info("User %s did not send a location.", user.first_name)
await update.message.reply_text(
"You seem a bit paranoid! At last, tell me something about yourself."
)
return BIO
async def bio(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Stores the info about the user and ends the conversation."""
user = update.message.from_user
logger.info("Bio of %s: %s", user.first_name, update.message.text)
await update.message.reply_text("Thank you! I hope we can talk again some day.")
return ConversationHandler.END
async def cancel(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
"""Cancels and ends the conversation."""
user = update.message.from_user
logger.info("User %s canceled the conversation.", user.first_name)
await update.message.reply_text(
"Bye! I hope we can talk again some day.", reply_markup=ReplyKeyboardRemove()
)
return ConversationHandler.END
def main() -> None:
"""Run the bot."""
# Create the Application and pass it your bot's token.
application = Application.builder().token("TOKEN").build()
# Add conversation handler with the states GENDER, PHOTO, LOCATION and BIO
conv_handler = ConversationHandler(
entry_points=[CommandHandler("start", start)],
states={
GENDER: [MessageHandler(filters.Regex("^(Boy|Girl|Other)$"), gender)],
PHOTO: [MessageHandler(filters.PHOTO, photo), CommandHandler("skip", skip_photo)],
LOCATION: [
MessageHandler(filters.LOCATION, location),
CommandHandler("skip", skip_location),
],
BIO: [MessageHandler(filters.TEXT & ~filters.COMMAND, bio)],
},
fallbacks=[CommandHandler("cancel", cancel)],
)
application.add_handler(conv_handler)
# Run the bot until the user presses Ctrl-C
application.run_polling()
if __name__ == "__main__":
main()
不幸的是它不起作用并且机器人没有运行。当我用这种方式用 MessageHandler 替换entry_points行时
entry_points=[MessageHandler(filters.TEXT, start)]
开始被调用但是机器人在点击任何按钮或发送/取消命令时什么都不做。
我使用 python 3.11.2 和 python-telegram-bot v20.1
感谢任何帮助。
更新:错误日志
2023-04-17 15:09:57,475 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,476 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,476 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,476 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,476 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,485 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,485 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,485 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,485 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,485 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,495 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,495 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,495 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,495 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,495 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,504 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,505 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,505 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,505 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,505 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,513 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,514 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,514 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,514 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,514 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,522 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,523 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,523 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,523 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,523 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,551 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,552 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,552 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,552 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,552 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,567 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,568 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,568 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,568 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,568 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,652 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,653 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,653 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,653 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,653 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,661 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,662 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,663 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,663 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,663 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,670 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,671 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,671 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,671 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,671 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,681 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,682 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,682 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,682 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,682 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,691 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,692 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,693 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,693 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,693 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,701 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,702 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,702 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,702 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,702 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,709 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,710 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,710 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,710 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,710 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,718 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,719 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,719 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,719 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,719 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,728 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,729 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,729 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,729 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,729 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,737 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,738 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,738 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,738 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,738 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,746 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,746 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,746 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,747 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,747 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,753 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,754 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,754 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,754 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,754 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,762 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,763 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,763 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,763 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,763 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,771 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,772 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,772 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,772 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,773 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,780 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,781 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,781 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,781 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,781 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,789 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,790 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,790 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,790 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,790 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,798 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,799 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,799 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,799 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,799 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,812 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,814 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,814 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,814 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,814 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,822 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,823 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,823 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,823 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,823 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,832 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,832 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,833 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,833 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,833 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,842 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,843 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,843 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,843 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,843 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,851 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,852 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,852 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,852 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,852 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,860 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,861 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,861 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,861 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,861 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,871 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,872 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,872 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,872 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,872 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,880 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,881 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,881 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,881 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,881 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,888 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 200 OK"
2023-04-17 15:09:57,889 - telegram._bot - DEBUG - No new updates found.
2023-04-17 15:09:57,889 - telegram._bot - DEBUG - ()
2023-04-17 15:09:57,889 - telegram._bot - DEBUG - Exiting: get_updates
2023-04-17 15:09:57,889 - telegram._bot - DEBUG - Entering: get_updates
2023-04-17 15:09:57,896 - httpx._client - DEBUG - HTTP Request: POST https://tapi.bale.ai/********************************************/getUpdates "HTTP/1.1 429 Too Many Requests"
2023-04-17 15:09:57,897 - telegram.ext._updater - ERROR - Error while getting Updates: Invalid server response
2023-04-17 15:09:57,897 - telegram.ext._application - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\request\_baserequest.py", line 355, in parse_json_payload
return json.loads(decoded_s)
File "C:\Users\amar\AppData\Local\Programs\Python\Python311\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\amar\AppData\Local\Programs\Python\Python311\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\amar\AppData\Local\Programs\Python\Python311\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\ext\_updater.py", line 607, in _network_loop_retry
if not await action_cb():
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\ext\_updater.py", line 335, in polling_action_cb
raise exc
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\ext\_updater.py", line 320, in polling_action_cb
updates = await self.bot.get_updates(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\ext\_extbot.py", line 524, in get_updates
updates = await super().get_updates(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\_bot.py", line 365, in decorator
result = await func(*args, **kwargs) # skipcq: PYL-E1102
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\_bot.py", line 3544, in get_updates
await self._post(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\_bot.py", line 453, in _post
return await self._do_post(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\ext\_extbot.py", line 306, in _do_post
return await super()._do_post(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\_bot.py", line 484, in _do_post
return await request.post(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\request\_baserequest.py", line 165, in post
result = await self._request_wrapper(
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\request\_baserequest.py", line 296, in _request_wrapper
response_data = self.parse_json_payload(payload)
File "C:\Users\amar\PycharmProjects\pythonProject\venv\lib\site-packages\python_telegram_bot-20.1-py3.11.egg\telegram\request\_baserequest.py", line 357, in parse_json_payload
raise TelegramError("Invalid server response") from exc
telegram.error.TelegramError: Invalid server response