Open ansgarm opened 9 years ago
Maybe use an intermediate queue to do the send the message from "postpone" script callback? Otherwise, there is a python-bindings fork in the work, that would add python script support...
@ansgarm The problem (in my case at least) was because lua is single-threaded, meaning you need to implement some kind of scheduling to both handle the incoming Telegram messages and the ZMQ ones, otherwise you can block yourself indefinitely
I actually solved it by having two Telegram instances, one handling the incoming TL's and one the external requests.
@SyRenity I think your solution is the easiest one for a small bot. Did you do anything else to let the two instances run in parallel? (My first instance stops receiving messages after I spin up the second..)
Just used two smallest instances, one per each.
That said a better solution would be probably dockerizing the TG to allow multiple containers per single machine.
@SyRenity Ah I see. I found that you can configure a config directory (see config.sample file) and use the argument -p to specify one of the profiles. Works perfectly for me!
There exists pytg2 (a python connection) in which the modified backend sends you the message events as json. tg-for-pytg2. You open a socket, the CLI connects when it got a message and sends you the json.
Hey,
I'm using the zero message queue to deliver all incoming messages to a node.js app (everything is running on a raspberry pi). This one way works perfectly fine, but to receive responses from node I need to do a blocking call to receive messages from the queue. My tries led me to using threads via this lib (https://github.com/moteus/lua-llthreads2) which is integrated into / supported by the zmq lib I'm using (https://github.com/zeromq/lzmq).
The Problem Receiving from the message queue works great with the thread but inside the thread I'm not able to call the send_msg function (or it doesn't execute it if I try passing the function as an argument to the thread)
I've never used (nor heard of :smile:) Lua before, so I guess I'm missing something in the big picture. What I'm trying achieve is being able to handle the messages in a node app and sending messages via the node app.
Thanks for any help (also suggesting other ways of doing it, well I'd like to keep my node app :smile:)
Ansgar
P.S. Here's the code: