小编Dmi*_*try的帖子

如何从Facebook Messenger平台发送位置?

有一种方法可以从移动客户端将我的位置发送到facebook-messenger,但是如何从机器人发送一些位置?(信使平台api)

当我尝试从bot发送类似的结构时,我收到一个错误: (#100) Unsupported attachment type

有没有办法从机器人发送我的位置?

收到的bot消息示例:

{
   "object": "page",
   "entry": [{
       "id": "1719442148306048",
       "time": 1466780344978,
       "messaging": [{
           "sender": {"id": "123456789"},
           "recipient": {"id": "987654321"},
           "timestamp": 1466780344847,
           "message": {
               "mid": "mid.12345698875:c80066d69b6cee1779",
               "seq": 65,
               "attachments": [{
                   "title": "Dmitry's Location",
                   "url": "Link to bing.com through facebook redirect"
                   "type": "location",
                   "payload": {"coordinates": {"lat": 55, "long": 37}}
               }]
           }
       }]
   }]
}
Run Code Online (Sandbox Code Playgroud)

我尝试发送带附件的邮件,如下所示:

               "attachment": {
                   "type": "location",
                   "payload": {"coordinates": {"lat": 55, "long": 37}}
               }
Run Code Online (Sandbox Code Playgroud)

messenger facebook-messenger facebook-chatbot

11
推荐指数
1
解决办法
8791
查看次数

如何使用附件快速回复

在快速回复的官方文档中说:

快速回复适用于所有消息类型,包括文本消息,图像和模板附件.

但是当我尝试发送它时template_type: button,我得到了错误:

{
    "error": {
        "message": "(#100) Only one of text or attachment can be specified",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "H8w+ZfRbBub"
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试发送:

{
    "recipient": {"id": "234567890"},
    "message": {
        "text": "TEXT_MESSAGE",
        "quick_replies": [
            {
                "content_type": "text",
                "title": "SOME_TITLE_1",
                "payload": "PAY_LOAD_1"
            },
            {
            "content_type": "text",
            "title": "SOME_TITLE_2",
            "payload": "PAY_LOAD_2"
            }
        ],
        "attachment": {
            "type": "template",
            "payload": {
                "template_type": "button",
                "text": "TEXT_MESSAGE",
                "buttons": [
                    {
                        "title": "READ_MORE_BUTTON",
                        "type": "postback",
                        "payload": "look:1:c"
                    }
                ]
            } …
Run Code Online (Sandbox Code Playgroud)

messenger facebook-messenger

8
推荐指数
2
解决办法
5347
查看次数

错数git提交

我有一个小的bash脚本:

echo "Total commits: "
git log --all --pretty=format:"%h %ad | %s%d [%an]" --date=short | wc -l
echo "Total no-merge commits: "
git log --all --pretty=format:"%h %ad | %s%d [%an]" --date=short --no-merges | wc -l
echo "Total merge commits: "
git log --all --pretty=format:"%h %ad | %s%d [%an]" --date=short --merges | wc -l
Run Code Online (Sandbox Code Playgroud)

我知道代码不是最优的.我的脚本的结果:

Total commits:  
1000
Total no-merge commits:  
817
Total merge commits: 
182
Run Code Online (Sandbox Code Playgroud)

问题:为什么不合并和合并提交的总和(182 + 817 = 999)低于总提交(1000)?

git bash git-merge

5
推荐指数
1
解决办法
151
查看次数