sendMessage
无法向群组成员发送消息
如何通过群聊向群成员发送消息(不向群聊发送消息)?
答案 0 :(得分:0)
也许这些对你有帮助:
您可以使用 @BotFather
找到这个机器人的用户名 ID @userinfobot
使用此代码 sendMessage
将成员分组:
import requests
def telegram_bot_sendtext(bot_message):
your_bot_token = 'bot_token'
your_user_name_ID = ['user_id_1', 'user_id_2', ...]
response = ''
for user_id in your_user_name_ID:
send_text= "https://api.telegram.org/bot" + your_bot_token +"/sendMessage?chat_id=" + user_id + "&parse_mode=MarkdownV2&&text=" + bot_message
response = response + str(requests.get(send_text))
return response
telegram_bot_sendtext("hello how do you do")