diff options
author | vin <git@vineetk.net> | 2024-01-14 23:16:43 -0500 |
---|---|---|
committer | vin <git@vineetk.net> | 2024-01-14 23:16:43 -0500 |
commit | f73e354f6a960c6a5bb36365a61a8a8790ec7f7d (patch) | |
tree | 1ef2f45a4cc3218be72fb99d4105b4f3d1c011bc /main.py | |
parent | 1cc61d85c3d9ef0eb39f4f05913e6bc60e909f62 (diff) |
use config.json instead of hardcoding and envvars
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -2,17 +2,19 @@ import asyncio, json, os import hikari import mautrix.client +config = json.load(open("config.json", "r")) + dclient = hikari.GatewayBot( - token=os.getenv("DISCORD_TOKEN"), + token=config["discord_token"], intents=(hikari.Intents.MESSAGE_CONTENT|hikari.Intents.GUILD_MESSAGES) ) mclient = mautrix.client.ClientAPI( - os.getenv("MATRIX_USERID"), - base_url=os.getenv("MATRIX_HOMESERVER"), - token=os.getenv("MATRIX_TOKEN") + config["matrix_userid"], + base_url=config["matrix_homeserver"], + token=config["matrix_token"] ) -rooms = {1196201613132574733: "!eChKdzVweNTyHctaKQ:wired.rehab"} +rooms = config["rooms"] async def matrix_init(): for room in rooms.values(): @@ -32,7 +34,7 @@ async def on_message(event: hikari.GuildMessageCreateEvent) -> None: if not event.content: return - chanid = event.channel_id + chanid = str(event.channel_id) if chanid in rooms.keys(): print(f"<{event.message.author.global_name}> {event.content}") |