yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.31k stars 1.51k forks source link

Chat not found #980

Closed N3R00 closed 2 years ago

N3R00 commented 2 years ago

I'm trying to send messages to a channel I have, but it just gives me an error that the chat was not found

let chat = await bot.getChat(-1611586710) bot.sendMessage(chat, 'Hello World!');

IscoV commented 2 years ago

Is the bot in the channel with any privileges?

If not, put the bot in the channel and send a random message. Now try sending the message as you were doing before.

gladunvv commented 2 years ago

Method getChat return information about the chat The first parameter of the sendMessage method is the chat id In your case, the chat id is -1611586710 try

const chatId = -1611586710; 
bot.sendMessage(chatId, 'HelloWorld');