【问题标题】:In Telethon: How can I verify If ChatAction was only from my group/channel, when I am not sure If my group/channel is private or public?在 Telethon 中:当我不确定我的群组/频道是私人还是公共时,如何验证 ChatAction 是否仅来自我的群组/频道?
【发布时间】:2022-01-19 01:12:08
【问题描述】:

现在,我假设 e.chat 采用我的群组/频道的特定 URL,无论它是公共的还是私有的,并用作过滤器,如果像用户这样的任何事件加入或离开我的群组/频道,它将打印在控制台中。

@bot.on(events.ChatAction(func=lambda e: not e.is_private and e.chat == "https://t.me/123"))
async def imp_fun(event):
    print(event.user_joined)

    print(event.user_left)

【问题讨论】:

    标签: python python-3.x telegram telegram-bot telethon


    【解决方案1】:

    您可以使用chats= 过滤器:

    @bot.on(events.ChatAction(chats=[-100123456, 'username', ...]))
    async def imp_fun(event):
        ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-25
      • 2022-11-01
      • 2021-04-06
      • 2015-11-27
      相关资源
      最近更新 更多