2017-06-12 130 views
0

我正在创建一个吸收会员的机器人。这样的机器人行为: 我发送一个独特的链接到我的机器人用户,然后用户发送自己独特的链接到other.by这种方式其他吸收到我的机器人。 我为机器人创建了一个Deep Link,现在我想知道谁在点击自己的深层链接。谁在电报中点击我的深层链接?

+0

什么深层链接? –

+0

https://core.telegram.org/bots#deep-linking – samira

+0

深度链接用于启动一个机器人,当一个人启动一个机器人时,你可以从他那里获得一些信息(无论用户是否启动了深度链接的机器人)。 –

回答

0

根据Telegram Documentation

当一个人加入与/start命令的机器人,如果任何额外的参数传递给机器人链接在此窗体中收到一条消息:

/start PAYLOAD

其中PAYLOAD代表在链接中传递的start参数的值。

因此,例如在telepot库:

def handle(msg): 
    content_type, chat_type, chat_id = telepot.glance(msg) 

    if content_type == 'text': 
     text = msg['text'] 
     print('Text:', text) 

     if text.startswith('/start'): 
      try: 
       command, payload = text.split(' ') 
       print('Payload:', payload) 
       print('chat_id:', chat_id) 
+0

谢谢你。它解决了我的问题。 – samira