[英]Python Telegram Chat Bot
I got a problem in writing code for my telegram customer service chat.我在为我的电报客户服务聊天编写代码时遇到了问题。 Apparently, let me confess my little knowledge in the field.显然,让我承认我在该领域的知识很少。 Can I get open source code for telegram chatbot which automatically forwards the messages sent to it to a specific id (my-id)?我可以获得电报聊天机器人的开源代码,它会自动将发送给它的消息转发到特定的 id (my-id) 吗? Thank you...I'm badly in need of this.谢谢...我非常需要这个。
Install pytelegrambotapi ( pip install pytelegrambotapi
) and then you'll be able to use somthing like that:安装 pytelegrambotapi ( pip install pytelegrambotapi
) 然后你就可以使用这样的东西了:
import telebot
token = "hd9ouhs98h928w982982"
your_id = "321321321321"
bot = telebot.TeleBot(token)
@bot.message_handler(content_types=["text"])
def repeat_all_messages(message):
bot.send_message(your_id, message.text)
if __name__ == '__main__':
bot.infinity_polling()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.