-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
61 lines (43 loc) · 1.85 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import yaml
from typing import Optional
from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass
class Config:
# Token used by the homeserver to communicate with the appservice
hs_token: str
# Token that the appservice uses to communicate with the homeserver
as_token: str
# The homeserver (right part of MXIDs)
homeserver: str
# Homeserver URL, where you can actually reach the Matrix REST API
homeserver_url: str
# Address for REST API
listen_address: str
# Port for REST API
listen_port: str
# URL for the Matrix homeserver to connect to the appservice
url: str
# format string for Matrix display names
displayname_format: Optional[str] = "{name} - Zephyr"
# Naming conventions / prefixes to claim
zephyr_user_prefix: Optional[str] = "_zephyr_"
zephyr_space_prefix: Optional[str] = "Z/"
zephyr_room_prefix: Optional[str] = "z/"
class_instance_separator: Optional[str] = "/"
# Tell the homeserver that this appservice bridges the "zephyr" protocol
enable_thirdparty_reporting: Optional[bool] = False
# Bot localpart/username
username: Optional[str] = "zephyrbot"
# Blocked opcodes for Zephyr
# (this was going to be blocked hosts but it seems very hard to implement)
blocked_opcodes: Optional[tuple[str]] = ("matrix",)
# Media shortened prefix
media_base_url: Optional[str] = None
# Block MXIDs from being bridged to Zephyr
# To prevent double-bridging messages from Mattermost bridge
blocked_mxid_prefixes: Optional[tuple[str]] = ("mattermost", "_mattermost_")
# Block certain Zephyr usernames from being bridged to Matrix
blocked_zephyr_usernames: Optional[tuple[str]] = ("mattermost", "matrix")
config: Config = Config.from_dict(yaml.load(open("config.yaml", "r"), yaml.Loader))