matrix-bot/tests/test.py

31 lines
712 B
Python
Raw Normal View History

"""
Not really tests, because I don't know how to testt without a whole matrix server.
"""
import asyncio
2021-10-03 20:07:14 +02:00
import logging
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)
async def main():
load_dotenv()
client = await Client(
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")
await client.run()
if __name__ == "__main__":
asyncio.run(main())