summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-08-15 14:31:51 +0200
committermakefu <github@syntax-fehler.de>2020-08-15 14:31:51 +0200
commit6f6647cf2e9079137099b9ca2683919a87f03331 (patch)
treed432240354e2d8dc490f199a7892811603472e33
parent6413ce746978cac7ed666f455a57680b299dc7f2 (diff)
document, CITADEL -> MATRIX
-rw-r--r--README.md18
-rw-r--r--kalauerbot/bot.py7
2 files changed, 21 insertions, 4 deletions
diff --git a/README.md b/README.md
index 54b5c22..3a34442 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,21 @@ Kalauerbot
==========
Manage the list of kalauer königs
+
+
+Usage
+====
+
+```
+# Mandatory environment variables
+MATRIX_TOKEN="abcd"
+MATRIX_ID="@user:matrix.org"
+
+# Optional environment variables
+MATRIX_SERVER="matrix.org"
+KALAUER_DBPATH="/var/lib/kalauer.json"
+KALAUER_WHITELIST="!channel1,!channel2"
+
+# now run:
+kalauerbot
+```
diff --git a/kalauerbot/bot.py b/kalauerbot/bot.py
index 2f75e5a..9556ce5 100644
--- a/kalauerbot/bot.py
+++ b/kalauerbot/bot.py
@@ -44,7 +44,6 @@ class Kalauerbot(MatrixBot):
log.debug(f"skipping {name} because user is inactive")
continue
def process_event(self, room, event):
- # {'content': {'body': 'hello bot', 'msgtype': 'm.text'}, 'event_id': '$1597412611141040kQPEC:thales.citadel.team', 'origin_server_ts': 1597412611511, 'sender': '@frichter:thales.citadel.team', 'type': 'm.room.message', 'unsigned': {'age': 98}, 'room_id': '!eXmPERUmuMagsLVxar:thales.citadel.team'}
if self.user_id == event['sender']: return # don't answer own message
if event['type'] != 'm.room.message': return
msg = event['content']['body']
@@ -178,10 +177,10 @@ def main():
if allowlist:
allowlist = allowlist.split(',')
bot = Kalauerbot(
- host = "ext01.citadel.team",
+ host = os.environ.get("MATRIX_SERVER","ext01.citadel.team")
display_name = "Kalauerbot",
- token = os.environ['CITADEL_TOKEN'],
- user_id = os.environ["CITADEL_ID"],
+ token = os.environ['MATRIX_TOKEN'],
+ user_id = os.environ["MATRIX_ID"],
dbpath = os.environ.get("KALAUER_DBPATH",None) or "kalauerdb.json",
allowlist = allowlist
)