optional config id

This commit is contained in:
HgO 2022-08-27 13:46:58 +02:00
parent 79112c7556
commit 57a704cd94
3 changed files with 4 additions and 5 deletions

View file

@ -17,7 +17,9 @@ matrix:
url: https://matrix.example.com
# The device ID that is **non pre-existing** device
# If this device ID already exists, messages will be dropped silently in encrypted rooms
device_id: ABCDEFGHIJ
# If not set the server will provide a device ID after log in. Note that this ID
# will change each time the bot reconnects.
# device_id: ABCDEFGHIJ
# What to name the logged in device
device_name: matrix-alertbot
# List of rooms where the bot can interact

View file

@ -103,7 +103,7 @@ class Config:
if not self.user_token and not self.user_password:
raise RequiredConfigKeyError("Must supply either user token or password")
self.device_id: str = self._get_cfg(["matrix", "device_id"], required=True)
self.device_id: str = self._get_cfg(["matrix", "device_id"], required=False)
self.device_name: str = self._get_cfg(
["matrix", "device_name"], default="matrix-alertbot"
)

View file

@ -12,9 +12,6 @@ matrix:
#user_token: ""
# The URL of the homeserver to connect to
url: https://matrix.example.com
# The device ID that is **non pre-existing** device
# If this device ID already exists, messages will be dropped silently in encrypted rooms
device_id: ABCDEFGHIJ
allowed_rooms:
- "!abcdefgh:matrix.example.com"