{"action":"created","issue":{"url":"https://api.github.com/repos/yagop/telegram-bot/issues/78","labels_url":"https://api.github.com/repos/yagop/telegram-bot/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/yagop/telegram-bot/issues/78/comments","events_url":"https://api.github.com/repos/yagop/telegram-bot/issues/78/events","html_url":"https://github.com/yagop/telegram-bot/issues/78","id":60087124,"number":78,"title":"how to use send_photo() to send sticker (webp file)","user":{"login":"ariefbayu","id":55084,"avatar_url":"https://avatars.githubusercontent.com/u/55084?v=3","gravatar_id":"","url":"https://api.github.com/users/ariefbayu","html_url":"https://github.com/ariefbayu","followers_url":"https://api.github.com/users/ariefbayu/followers","following_url":"https://api.github.com/users/ariefbayu/following{/other_user}","gists_url":"https://api.github.com/users/ariefbayu/gists{/gist_id}","starred_url":"https://api.github.com/users/ariefbayu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariefbayu/subscriptions","organizations_url":"https://api.github.com/users/ariefbayu/orgs","repos_url":"https://api.github.com/users/ariefbayu/repos","events_url":"https://api.github.com/users/ariefbayu/events{/privacy}","received_events_url":"https://api.github.com/users/ariefbayu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-06T10:54:33Z","updated_at":"2015-03-14T19:54:16Z","closed_at":"2015-03-14T14:16:53Z","body":"The following codes is purposed to send custom sticker. However, I'm not sure why send_photo() doesn't deliver the image :(.\r\n\r\n    function run(msg, matches)\r\n\r\n\tprint (\"processing sticker \" .. matches[1])\r\n\r\n\tlocal response = \"\"\r\n\tlocal rootpath = \"/home/ariefbayu/telegram-bot/stickers/reps/\"\r\n\r\n\tlocal sticker_pairs = {\r\n\t\t[\"smile\"]=\"ladysmile\",\r\n\t\t[\"awesome\"]=\"ras-awesome\",\r\n\t\t[\"sad\"]=\"belu-sad\"\r\n\t}\r\n\r\n\tprint (\" matched: \" .. sticker_pairs[ matches[1] ])\r\n\r\n\t  for k, v in pairs(sticker_pairs) do\r\n\t    print(\"checking sticker\", k)\r\n\r\n\t    if k == matches[1] then\r\n\r\n\t\t\tif messageToAllowed(msg.to.id) == false then\r\n\r\n\t\t\t\treturn \"\"\r\n\r\n\t\t\tend\r\n\r\n\r\n\t\t\tlocal receiver = get_receiver(msg)\r\n\t\t\tlocal file_path = rootpath .. sticker_pairs[ matches[1] ] .. \".webp\"\r\n\t\t\tprint(file_path)\r\n\t\t\tif file_exists(file_path) == true then\r\n\r\n\r\n\t\t\t\tresponse = matches[1]\r\n\r\n\t\t\t\tlocal cb_extra = {\r\n\t\t\t\t\tfile_path = file_path,\r\n\t\t\t\t\tcb_function = cb_function,\r\n\t\t\t\t\tcb_extra = cb_extra\r\n\t\t\t\t}\r\n\t\t\t\t-- Call to remove with optional callback\r\n\t\t\t\t-- send_photo(receiver, file_path, rmtmp_cb, cb_extra)\r\n\r\n\t\t\t\tsend_photo(receiver, file_path, ok_cb, cb_extra)\r\n\t\t\telse\r\n\t\t\t\tresponse = \"sticker is missing...\"\r\n\t\t\tend\r\n\t\t\tbreak\r\n\r\n\t    end\r\n\t    \r\n\t  end\r\n\r\n\r\n        return response\r\n    end\r\n\r\n    function messageToAllowed(id)\r\n\tlocal response = true\r\n\r\n\treturn response\r\n    end\r\n\r\n    return {\r\n        description = \"load custom stickers\", \r\n        usage = \"/sticker [sticker-name]\",\r\n        patterns = {\r\n    \t\t    \"^/sticker (.*)$\"\r\n    \t    }, \r\n        run = run \r\n    }"},"comment":{"url":"https://api.github.com/repos/yagop/telegram-bot/issues/comments/80692779","html_url":"https://github.com/yagop/telegram-bot/issues/78#issuecomment-80692779","issue_url":"https://api.github.com/repos/yagop/telegram-bot/issues/78","id":80692779,"user":{"login":"ariefbayu","id":55084,"avatar_url":"https://avatars.githubusercontent.com/u/55084?v=3","gravatar_id":"","url":"https://api.github.com/users/ariefbayu","html_url":"https://github.com/ariefbayu","followers_url":"https://api.github.com/users/ariefbayu/followers","following_url":"https://api.github.com/users/ariefbayu/following{/other_user}","gists_url":"https://api.github.com/users/ariefbayu/gists{/gist_id}","starred_url":"https://api.github.com/users/ariefbayu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariefbayu/subscriptions","organizations_url":"https://api.github.com/users/ariefbayu/orgs","repos_url":"https://api.github.com/users/ariefbayu/repos","events_url":"https://api.github.com/users/ariefbayu/events{/privacy}","received_events_url":"https://api.github.com/users/ariefbayu/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T19:54:16Z","updated_at":"2015-03-14T19:54:16Z","body":"thanks, send_document is the solution!\r\nmy code works, while, admittedly, need a lot of fix. LUA wasn't my thing :D"}}