I am trying to get chat from one user using my telegram bot. Below is my code so far
const { Telegraf } = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN);
bot.telegram.getChat('username', async (ctx) =>{'incoming message ', console.log(ctx.message.tesx)})
from Doument
(method) Telegram.getChat(chatId: string | number): Promise<ChatFromGetChat>
Get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
@param chatId — Unique identifier for the target chat or username of the target supergroup or channel (in the format
@channelusername — )
so in my parameter i use the username of that particular chat (not group chat, only 1 person) but it return chat not found.
Any advice is appreciated