Commit 871fc440 authored by Vincent Castellano's avatar Vincent Castellano

Add Callback support for async calls.

parent c263a93a
This diff is collapsed.
...@@ -16,6 +16,10 @@ def on_our_id(id): ...@@ -16,6 +16,10 @@ def on_our_id(id):
our_id = id our_id = id
return "Set ID: " + str(our_id) return "Set ID: " + str(our_id)
def msg_cb(success, msg):
pp.pprint(success)
pp.pprint(msg)
def on_msg_receive(msg): def on_msg_receive(msg):
if msg["out"] and not binlog_done: if msg["out"] and not binlog_done:
return; return;
...@@ -33,7 +37,7 @@ def on_msg_receive(msg): ...@@ -33,7 +37,7 @@ def on_msg_receive(msg):
if text.startswith("!ping"): if text.startswith("!ping"):
print("SENDING PONG") print("SENDING PONG")
tgl.send_msg(ptype, pid, "PONG!") tgl.send_msg(ptype, pid, "PONG!", msg_cb)
def on_secret_chat_update(peer, types): def on_secret_chat_update(peer, types):
return "on_secret_chat_update" return "on_secret_chat_update"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment