描述
新的 Aiogram3 版本 3.0.0b7。机器人不响应消息,只向控制台输出日志(据我所知,机器人无法从服务器接收更新)。蟒蛇版本:3.10.9
日志
Failed to fetch updates - TelegramConflictError: Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first
Sleep for 1.000000 seconds and try again... (tryings = 0, bot id = 5082045144)
ETC。
代码
from aiogram import Bot, Dispatcher
from aiogram.types import Message
import asyncio
token = "<token>"
async def get_start(message: Message, bot: Bot):
await message.reply(f"Привет, {message.from_user.first_name}!")
async def start():
bot = Bot(token=token)
dp = Dispatcher()
dp.message.register(get_start)
try:
await dp.start_polling(bot)
finally:
await bot.session.close()
if __name__ == "__main__":
asyncio.run(start())
我该如何解决机器人的这个问题?
您启用了WebHook,
getUpdates
启用后不起作用,禁用使用await bot.delete_webhook()