我需要发送消息,但没有任何轮询。我的机器人不必回复它只需要发送的任何消息
import telebot
bot = telebot.TeleBot("TOKEN")
@bot.message_handler(commands=['start'])
def send_message(message, text):
bot.send_message(message.from_user.id, text)
text = "Text that I want to be sent"
send_message(text)
bot.polling()
print("Message has been sent")
这里有两个问题:
bot.send_message(msg_id, "Hello!")
(msg_id是人的id)如果你知道这个人的id,它将帮助你做到这一点如果没有,则可以使用
msg.chat.id
轻松获取,其中msg
是用户发送的消息相关问题 更多 >
编程相关推荐