Giter Club home page Giter Club logo

lua-telegram-bot's Issues

Wrong status code crashes app

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

Where are the examples?

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

bot.Sendphoto

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

Implementation of ReplyMarkup functions

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

bot lost conection

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.

what is error

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 ?

Error while decoding JSON [HTML]:

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>

new unknownType!

FYI: This errormessage appears when you convert group into supergroup.

doesn't work on any lua version

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 ?

multipart-post error

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.