mirror of
https://github.com/PiMaker/Teletun.git
synced 2025-03-09 15:40:14 +00:00
Fixed obvious bug
This commit is contained in:
parent
d462313ca4
commit
93548f8a18
1 changed files with 9 additions and 1 deletions
10
teletun.py
10
teletun.py
|
@ -10,6 +10,9 @@ from pytg.exceptions import ConnectionError
|
||||||
import base64
|
import base64
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
|
import psutil
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
# Connect to telegram
|
# Connect to telegram
|
||||||
|
@ -89,7 +92,7 @@ def main_loop():
|
||||||
msg = (yield)
|
msg = (yield)
|
||||||
# Check if it is an actual "message" message and if the sender is our peer
|
# Check if it is an actual "message" message and if the sender is our peer
|
||||||
if msg is not None and msg['event'] == unicode('message')\
|
if msg is not None and msg['event'] == unicode('message')\
|
||||||
and not msg['own'] and msg['from']['print_name'] == username:
|
and not msg['own'] and msg['sender']['name'] == username:
|
||||||
try:
|
try:
|
||||||
# Decode data and write it to the tunnel
|
# Decode data and write it to the tunnel
|
||||||
data = base64.b64decode(msg.text)
|
data = base64.b64decode(msg.text)
|
||||||
|
@ -131,3 +134,8 @@ tun.down()
|
||||||
receiver.stop()
|
receiver.stop()
|
||||||
|
|
||||||
print 'Bye bye!'
|
print 'Bye bye!'
|
||||||
|
|
||||||
|
# Literally Overkill
|
||||||
|
|
||||||
|
current_process = psutil.Process()
|
||||||
|
os.kill(current_process.pid, signal.SIGKILL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue