Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
96325e2e
Commit
96325e2e
authored
May 03, 2015
by
Vincent Castellano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send_msg implemented
parent
c7a66e64
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
370 additions
and
646 deletions
+370
-646
loop.c
loop.c
+5
-0
pytest.py
pytest.py
+3
-2
python-tg.c
python-tg.c
+362
-632
test.lua
test.lua
+0
-12
No files found.
loop.c
View file @
96325e2e
...
...
@@ -57,6 +57,7 @@
#include "telegram.h"
#include "loop.h"
#include "lua-tg.h"
#include "python-tg.h"
#include <tgl/tgl.h>
#include <tgl/tgl-binlog.h>
#include <tgl/tgl-net.h>
...
...
@@ -214,6 +215,10 @@ void net_loop (void) {
lua_do_all
();
#endif
#ifdef USE_PYTHON
py_do_all
();
#endif
if
(
safe_quit
&&
!
TLS
->
active_queries
)
{
printf
(
"All done. Exit
\n
"
);
do_halt
(
0
);
...
...
pytest.py
View file @
96325e2e
...
...
@@ -16,9 +16,10 @@ def on_our_id(id):
return
"Set ID: "
+
str
(
our_id
)
def
on_msg_receive
(
msg
):
pp
.
pprint
(
msg
)
if
msg
[
"out"
]:
return
;
tgl
.
send_msg
(
msg
[
"from"
][
"type"
],
msg
[
"from"
][
"id"
],
"PONG!"
)
return
"Got msg from "
+
msg
[
"from"
][
"peer"
][
"first_name"
]
def
on_secret_chat_update
(
peer
,
types
):
return
"on_secret_chat_update"
...
...
python-tg.c
View file @
96325e2e
This diff is collapsed.
Click to expand it.
test.lua
View file @
96325e2e
...
...
@@ -57,17 +57,6 @@ function get_title (P, Q)
end
end
local
lgi
=
require
(
'lgi'
)
local
notify
=
lgi
.
require
(
'Notify'
)
notify
.
init
(
"Telegram updates"
)
local
icon
=
os.getenv
(
"HOME"
)
..
"/.telegram-cli/telegram-pics/telegram_64.png"
function
do_notify
(
user
,
msg
)
local
n
=
notify
.
Notification
.
new
(
user
,
msg
,
icon
)
n
:
show
()
end
-- }}}
function
on_msg_receive
(
msg
)
if
started
==
0
then
...
...
@@ -76,7 +65,6 @@ function on_msg_receive (msg)
if
msg
.
out
then
return
end
do_notify
(
get_title
(
msg
.
from
,
msg
.
to
),
msg
.
text
)
if
(
msg
.
text
==
'ping'
)
then
if
(
msg
.
to
.
id
==
our_id
)
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment