diff options
| author | Agnes Wendt <agnes@wendt.nu> | 2021-03-05 16:43:51 +0100 |
|---|---|---|
| committer | Agnes Wendt <agnes@wendt.nu> | 2021-03-05 16:43:51 +0100 |
| commit | 78fb63fda2f589de118dbe9e073d1c861e81e894 (patch) | |
| tree | 4b5c86244e7523427786748ec15ee5c1a2d200dd /tele.py | |
| parent | 87e96c397ca0ffc9d393d2ecbd4f20d86831614b (diff) | |
| download | tg-78fb63fda2f589de118dbe9e073d1c861e81e894.tar.gz | |
Switch to curses
Diffstat (limited to 'tele.py')
| -rw-r--r-- | tele.py | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +import aioconsole +import logging +import telethon +import curses + +import credentials + +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 +) + + +@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()) |
