From 78fb63fda2f589de118dbe9e073d1c861e81e894 Mon Sep 17 00:00:00 2001 From: Agnes Wendt Date: Fri, 5 Mar 2021 16:43:51 +0100 Subject: Switch to curses --- main.py | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 8ab18f2..51ab636 100644 --- a/main.py +++ b/main.py @@ -1,35 +1,9 @@ -import aioconsole -import logging -import telethon +import cursed -import credentials +def on_str(s): + print(s) -logging.basicConfig( - format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', - level=logging.WARNING -) -client = telethon.TelegramClient( - "first_test", - credentials.API_ID, - credentials.API_HASH -) +def on_tab(): + print("Nu tryckte nån på tab") - -@client.on(telethon.events.NewMessage) -async def new_message(event): - print(event.raw_text) - - -async def send_lines(recipient): - while True: - line = await aioconsole.ainput() - await client.send_message(recipient, line) - - -async def main(): - await send_lines(recipient=input("Phone number to chat with: ")) - - -with client: - client.start() - client.loop.run_until_complete(main()) +cursed.start(on_str, on_tab) -- cgit v1.2.1