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

Saj*_*jad 0 python python-2.7 python-telegram-bot

我使用 python-telegram-bot 框架创建了一个电报机器人。我有一些电话号码,现在我想向电话号码发送消息。这些电话号码在 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()
Run Code Online (Sandbox Code Playgroud)

但是;这个代码不起作用并且不会给我一个错误!

我能怎么做???

Sea*_*ean 5

您现在不能这样做,因为机器人不能第一个聊天,您必须向用户提供机器人链接,例如t.me/Sean_Bot,并要求他们开始。