代码之家  ›  专栏  ›  技术社区  ›  Paolo177

Telegram Bot-getChat-invite\u链接

  •  0
  • Paolo177  · 技术社区  · 6 年前

    我在python中有一个非常简单的bot,它运行以下代码:

    def get_chat(chat_id=None):
        data = {
            'chat_id': str(chat_id)
        }
        resp = urllib2.urlopen(BASE_URL + 'getChat?'+urllib.urlencode(data)).read()
            return resp
    

    我的机器人是聊天室的管理员

    它应该会收到此处所述的对象聊天 https://core.telegram.org/bots/api#getchat 对象内有聊天链接,但我只能收到以下内容:

    {"ok":true,"result":{"id":#####,"title":"####","type":"supergroup"}}
    

    为什么?

    2 回复  |  直到 6 年前
        1
  •  0
  •   Ali Momen Sani    6 年前

    尝试使用 exportChatInviteLink 方法( documentation )

    还要注意的是 any previously generated link is revoked

        2
  •  0
  •   Sergey Dorozhkin    4 年前

    https://core.telegram.org/bots/api#chat

    invite\u链接:字符串,可选。聊天邀请链接,用于组、超级组和频道聊天。聊天中的每个管理员都会生成自己的邀请链接,因此bot必须首先使用exportChatInviteLink生成链接。仅在getChat中返回。