matrix-bot/tests/test.py

30 lines
712 B
Python

"""
Not really tests, because I don't know how to testt without a whole matrix server.
"""
import asyncio
import logging
import os
from dotenv import load_dotenv
from matrix_bot.client import Client
from getpass import getpass
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.DEBUG)
async def main():
load_dotenv()
client = await Client(
os.environ["MUSER"],
os.environ["HOMESERVER"],
os.environ["PASSWD"],
os.environ["ROOMS"].split(",")
)
room_name = os.environ["ROOMS"].split(",")[0]
await client.send_message(room_name, "Beware of Greeks bearing gifts")
await client.run()
if __name__ == "__main__":
asyncio.run(main())