ldb / lua-telegram-bot Goto Github PK
View Code? Open in Web Editor NEWLua Library for the Telegram Bot API
License: GNU General Public License v2.0
Lua Library for the Telegram Bot API
License: GNU General Public License v2.0
Apparently this happens every once in awhile, and about 3 times in a row, with the same timestamp.
07/30/16 14:27:21 Error while decoding JSON [HTML]:
html passed to JSON:decode(): <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.0</center>
</body>
</html>
07/30/16 14:27:21 Error while decoding JSON:
can't parse JSON at char 1 of: <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.0</center>
</body>
</html>
tostring(parse_mode) makes "Bad Request: unsupported parse_mode".
parse_mode should have a default value(blank string).
LUA v5.1
I had an issue where i send a photo, some times i would just get a grey image box or it would fail with a response of {"ok":false,"error_code":400,"description":"Bad Request: IMAGE_PROCESS_FAILED"}
the fix was changing from
local photo_file = io.open(photo, "r")
to
local photo_file = io.open(photo, "rb")
Hey, I wanted to ask this in the group you guys made, but I'm limited and it is a public group so I can't talk...
Here's my issue:
I like this wrapper/framework (let's use wrapper the next time) and I already built a bot with it, it's small, simple, made in lua, but there's something I miss, examples! I tried using inlineKeyboards
but I couldn't find anything in the README.md
and the only example there is, doesn't use the new functions.
Could you guys please provide examples?
That would be nice!
,
Eli | (@)enotly
Fixed !
When I try to start this I get the error like below:
$ lua5.2 bot-example.lua
lua5.2: ./lua-bot-api.lua:25: module 'ssl.https' not found:
no field package.preload['ssl.https']
no file '/usr/local/share/lua/5.2/ssl/https.lua'
no file '/usr/local/share/lua/5.2/ssl/https/init.lua'
no file '/usr/local/lib/lua/5.2/ssl/https.lua'
no file '/usr/local/lib/lua/5.2/ssl/https/init.lua'
no file '/usr/share/lua/5.2/ssl/https.lua'
no file '/usr/share/lua/5.2/ssl/https/init.lua'
no file './ssl/https.lua'
no file '/usr/local/lib/lua/5.2/ssl/https.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/ssl/https.so'
no file '/usr/lib/lua/5.2/ssl/https.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './ssl/https.so'
no file '/usr/local/lib/lua/5.2/ssl.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/ssl.so'
no file '/usr/lib/lua/5.2/ssl.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './ssl.so'
stack traceback:
[C]: in function 'require'
./lua-bot-api.lua:25: in main chunk
[C]: in function 'require'
bot-example.lua:27: in main chunk
[C]: in ?
Today api.telegram.org gives "502 bad gateway error" or "504 gateway timeout" error sometimes. Somehow response.status is 1 so the error page is sent to JSON decoding and everything comes down burning. I'm not sure if it's a luasec problem or it's used wrongly in this library but I've managed to solve it buy changing this line
success = success or false
to this line
success = tonumber(code) < 400
and all the
response.success == 1
to
response.success
PS: I didn't create a pull request for this because I don't know if this is luasec's fault or not.
Edit: Fixed the solution
lua: ./lua-bot-api.lua:28: module 'JSON' not found:
no field package.preload['JSON']
no file '/usr/local/share/lua/5.2/JSON.lua'
no file '/usr/local/share/lua/5.2/JSON/init.lua'
no file '/usr/local/lib/lua/5.2/JSON.lua'
no file '/usr/local/lib/lua/5.2/JSON/init.lua'
no file '/usr/share/lua/5.2/JSON.lua'
no file '/usr/share/lua/5.2/JSON/init.lua'
no file './JSON.lua'
no file '/usr/local/lib/lua/5.2/JSON.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/JSON.so'
no file '/usr/lib/lua/5.2/JSON.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './JSON.so'
stack traceback:
[C]: in function 'require'
./lua-bot-api.lua:28: in main chunk
[C]: in function 'require'
lua-bot-api-test.lua:27: in main chunk
[C]: in ?
Hi there,
I've got an error with example code and can't find the reason. Can you take a look please
lua: ...usr/local/share/lua/5.1/multipart/multipart-post.lua:57: unexpected type number
stack traceback:
[C]: in function 'error'
...usr/local/share/lua/5.1/multipart/multipart-post.lua:57: in function 'encode'
./lua-bot-api.lua:94: in function 'makeRequest'
./lua-bot-api.lua:207: in function 'getUpdates'
./lua-bot-api.lua:1097: in function 'run'
bot.lua:16: in main chunk
[C]: ?
I have copied your example, add my token and place two files (JSON.lua and lua-bot-api.lua) in the same folder.
Just a suggestion - you could create functions which make use of tables to make the creation of inline keyboards simpler, like what I have started doing with github.com/matthewhesketh/mattata
Hello,
Is there a way to check when the bot conection with telegram servers were lost?
Problem: When the host change its public IP, de lua-telegram-bot keep running but doesn't response any request. It is necesary kill it and re-run it to establish the conection. (I'm using run() facility)
Thx.
FYI: This errormessage appears when you convert group into supergroup.
How i can use it in windows ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.