Viktor????‍♂️2022-02-24 12:37:23
Viktor????‍♂️, 2022-02-24 12:37:23

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'

async def pars(msg:types.Message):
    await bot.send_message(chat_id, msg.text[6:])

if __name__ == '__main__':

The problem is that if you write the chat_id of the user, then everything will work, but if you write the chat_id of the group, then an error will
occur no matter what I did, still the error "chat not found"
Please help :/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Igor Markin, 2022-02-24

If you are trying to send messages to a group, you must add "-' in front of your chat id.
For example:
fix on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question