我如何向用户发送消息,知道他的用户名?

问题描述 投票:1回答:2

我正在使用python-telegram-bot向用户发送消息(在私人消息中)。在所写的documentation中,该机器人可以在知道用户channel_idusername的情况下向用户发送消息。

但是,通过chat_id消息正在发送,但是通过用户名却收到错误telegram.error.Bad Request: Chat not found`

bot.send_message(chat_id='@username', text)

我正在使用python-telegram-bot将消息发送给用户(在私人消息中)。在编写的文档中,该机器人可以知道用户的channel_id或用户名来向用户发送消息。但是,通过chat_id ...

python telegram telegram-bot python-telegram-bot
2个回答
1
投票

这是我的方法


0
投票

在此引用

© www.soinside.com 2019 - 2024. All rights reserved.