![](/img/trans.png)
[英]Telegram Bot deleteMessage function returns 400 Bad Request Error
[英]Telegram Bot -UnhandledPromiseRejectionWarning: Error: 400: Bad Request: chat not found
我正在嘗試使用我的電報機器人與一位用戶聊天。 到目前為止,下面是我的代碼
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)})
來自杜門
(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 — )
所以在我的參數中,我使用了那個特定聊天的用戶名(不是群聊,只有 1 個人),但它返回聊天未找到。
任何建議表示贊賞
您必須為 getChat 傳遞聊天和聊天 ID,而不僅僅是傳遞字符串。
bot.telegram.getChat(ctx.message.chat.id, ctx.message.chat, async (ctx) =>
{'incoming message ', console.log(ctx.message.tesx)})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.