2021-10-03 03:00:42 +02:00
|
|
|
"""
|
|
|
|
Not really tests, because I don't know how to testt without a whole matrix server.
|
|
|
|
"""
|
|
|
|
|
2021-10-03 16:36:36 +02:00
|
|
|
import asyncio
|
2021-10-03 20:07:14 +02:00
|
|
|
import logging
|
2021-10-03 03:00:42 +02:00
|
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from matrix_bot.client import Client
|
|
|
|
from getpass import getpass
|
|
|
|
|
2021-10-03 20:07:14 +02:00
|
|
|
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.DEBUG)
|
|
|
|
|
2021-10-03 16:36:36 +02:00
|
|
|
async def main():
|
2021-10-03 03:00:42 +02:00
|
|
|
load_dotenv()
|
2021-10-03 16:36:36 +02:00
|
|
|
client = await Client(
|
2021-10-03 03:00:42 +02:00
|
|
|
os.environ["MUSER"],
|
|
|
|
os.environ["HOMESERVER"],
|
|
|
|
os.environ["PASSWD"],
|
|
|
|
os.environ["ROOMS"].split(",")
|
|
|
|
)
|
2021-10-04 11:40:06 +02:00
|
|
|
room_name = os.environ["ROOMS"].split(",")[0]
|
|
|
|
await client.send_message(room_name, "Beware of Greeks bearing gifts")
|
2021-10-03 16:36:36 +02:00
|
|
|
await client.run()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|
2021-10-03 03:00:42 +02:00
|
|
|
|