diff options
| author | Agnes Wendt <agnes@wendt.nu> | 2021-03-07 21:06:56 +0100 |
|---|---|---|
| committer | Agnes Wendt <agnes@wendt.nu> | 2021-03-07 21:06:56 +0100 |
| commit | da0ed1051316a007e9c509eb0a6d56121c5231ea (patch) | |
| tree | ddd8bafd08dc4d8d79d01c5e04daf9c43adea6f0 | |
| parent | 9a742a6bcbc4df9af0ed576fc2b457f58fd5e590 (diff) | |
| download | tg-da0ed1051316a007e9c509eb0a6d56121c5231ea.tar.gz | |
Send messages again
| -rw-r--r-- | cursed.py | 5 | ||||
| -rw-r--r-- | main.py | 12 | ||||
| -rw-r--r-- | tele.py | 5 |
3 files changed, 9 insertions, 13 deletions
@@ -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) @@ -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__": @@ -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()) +''' |
