Answer the question
In order to leave comments, you need to log in
aigram error aiogram.utils.exceptions.ChatNotFound: Chat not found how to fix?
I made a simple bot that will send to a specific chat, everything that he writes in a PM.
Here is the code:
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
bot = Bot(token="5140444427:AAHlqr4XNw8CWlDJb_5fGXLLuW_uBhhy6BA")
dp = Dispatcher(bot)
chat_id = '793833577'
@dp.message_handler(commands=["send"])
async def pars(msg:types.Message):
await bot.send_message(chat_id, msg.text[6:])
if __name__ == '__main__':
executor.start_polling(dp)
Answer the question
In order to leave comments, you need to log in
If you are trying to send messages to a group, you must add "-' in front of your chat id.
For example:
TELEGRAM_REG_CHAT_ID="1949275XX"
fix on
TELEGRAM_REG_CHAT_ID="-1949275XX"
Source
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question