简体   繁体   English

Python-telegram-bot将消息发送到电话号码

[英]Python-telegram-bot send message to phone numbers

I create a telegram bot with framework python-telegram-bot. 我使用框架python-telegram-bot创建了一个电报机器人。 I have a little phone numbers,Now I want send message to phone numbers. 我有一些电话号码,现在我想向电话号码发送消息。 The phone numbers have an account in Telegram,and this is my codes: 这些电话号码在Telegram中有一个帐户,这是我的代码:

from telegram.ext import Updater, MessageHandler, Filters
def start_method(bot, update):
    bot.send_message(chat_id='Phone number', "Hello")
def main():
    updater = Updater(token='TOKEN')
    updater.dispatcher.add_handler(MessageHandler(Filters.text, start_method))
    updater.start_polling()
    updater.idle()
if __name__ == '__main__':
    main()

But;this codes don't work and not give me an error!!! 但是;此代码无效,不会给我一个错误!!!

How can I do??? 我能怎么做???

您目前无法执行此操作,因为机器人不能成为第一个聊天的人,因此您必须给用户提供机器人链接,例如t.me/Sean_Bot ,并要求他们启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM