首页 > 解决方案 > 电报机器人-getChat-invite_link

问题描述

我在 python 中有一个非常简单的机器人来运行这段代码:

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"}}

为什么?

标签: pythontelegram-bot

解决方案


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

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


推荐阅读