summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cursed.py5
-rw-r--r--main.py12
-rw-r--r--tele.py5
3 files changed, 9 insertions, 13 deletions
diff --git a/cursed.py b/cursed.py
index d275141..63c3d8f 100644
--- a/cursed.py
+++ b/cursed.py
@@ -7,14 +7,12 @@ class Console():
self.stdscr = curses.initscr()
def __enter__(self):
- print("ENTER")
curses.noecho()
curses.cbreak()
self.stdscr.keypad(True)
- print("Enter färdig")
+ return self
def __exit__(self, *_):
- print("EXIT")
curses.nocbreak()
self.stdscr.keypad(False)
curses.echo()
@@ -22,7 +20,6 @@ class Console():
async def start(c, on_str, on_tab):
- print("start")
string = ""
while True:
char = await asyncio.to_thread(c.stdscr.getkey)
diff --git a/main.py b/main.py
index d89f93e..27c132e 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,9 @@
import cursed
import asyncio
+import tele
async def on_str(s):
- print(s)
+ await tele.client.send_message("+46703279113", s)
async def on_tab():
@@ -10,11 +11,10 @@ async def on_tab():
def main():
- print("hejhej")
- with cursed.Console() as c:
- print("hej")
- print(c)
- asyncio.new_event_loop().run_until_complete(cursed.start(c, on_str, on_tab))
+ with tele.client:
+ tele.client.start()
+ with cursed.Console() as c:
+ tele.client.loop.run_until_complete(cursed.start(c, on_str, on_tab))
if __name__=="__main__":
diff --git a/tele.py b/tele.py
index 515439f..b56a692 100644
--- a/tele.py
+++ b/tele.py
@@ -1,8 +1,6 @@
import aioconsole
import logging
import telethon
-import curses
-
import credentials
logging.basicConfig(
@@ -30,7 +28,8 @@ async def send_lines(recipient):
async def main():
await send_lines(recipient=input("Phone number to chat with: "))
-
+'''
with client:
client.start()
client.loop.run_until_complete(main())
+'''