【问题标题】:Accept a request to subscribe to a private telegram channel via aiogram接受通过 aiogram 订阅私人电报频道的请求
【发布时间】:2022-01-25 19:14:36
【问题描述】:

有一个任务是使用机器人在电报频道中确认订阅请求。 如果有人知道如何通过 aiogram 或 Telethon 做到这一点

【问题讨论】:

    标签: python telethon aiogram


    【解决方案1】:

    有绑定方法approve()decline()可以和chat_join_request_handler()一起使用

    @dp.chat_join_request_handler()
    async def join(update: types.ChatJoinRequest):
        await update.approve()
    

    【讨论】:

      【解决方案2】:

      这样解决问题:

          @dp.chat_join_request_handler()
          async def echo(message: types.Message):
               await bot.approve_chat_join_request(
                            message.chat.id,                                   
                            message.from_user.id)
      

      【讨论】:

        猜你喜欢
        • 2021-03-09
        • 2014-07-15
        • 2017-11-14
        • 1970-01-01
        • 2020-11-22
        • 2020-11-26
        • 2018-02-26
        • 2017-05-12
        • 1970-01-01
        相关资源
        最近更新 更多