How can I send a message to someone with my telegram bot using their Username

后端 未结 7 998
执笔经年
执笔经年 2020-12-15 17:30

I am using the telepot python library, I know that you can send a message when you have someone\'s UserID(Which is a number). I wanna know if it is possible to send a messag

7条回答
  •  粉色の甜心
    2020-12-15 18:20

    It's really simple with TaaS

    1. Sign up, create an API key for phone number or bot token
    2. Make a POST request to https://api.t-a-a-s.ru/client with JSON body:
    {
      "api_key": "YOUR_API_KEY",
      "@type": "searchPublicChat",
      "username": "@username"
    }
    

    You will receive chat_id of a user in response.

提交回复
热议问题