创建方法

  • 直接创建就能生成订阅号。

image.png

添加机器人到channel管理员

  • Try:

    • Go to your channel Settings > Administrators > add your bot as Administrator
    • now use the below code to send a photo directly to your channel
  • 添加信息语句

    1. bot.send_message(@leguspeak,'xxyyy')
  • 添加图片语句

    1. bot.sendPhoto(chat_id="_your channel name here... example: @Linuxgram", photo="https://telegram.org/img/t_logo.png", caption="Sample photo")
  • 完整代码 ```python

    coding:utf8

    import telebot bot = telebot.TeleBot(‘{你的appsecret}’) @bot.message_handler(commands=[‘start’]) def send_welcome(message): bot.send_message(message.chat.id, ‘大家好,我是机器人’+str(message.chat.id))

@bot.message_handler() def echo(message): bot.reply_to(message, message.text)

@bot.message_handler(commands=[‘help’]) def send_welcome(message): bot.send_message(reply_to_message_id=message.message_id, chat_id=message.chat.id, text=’有什么可以帮您’)

if name == ‘main‘: bot.send_message(@leguspeak,’xxyyy’) bot.polling() ```

参考资料