From 508640cfbad7380d142db614f32157140ff1e315 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sun, 20 Aug 2023 19:09:19 +0200 Subject: [PATCH] Add option to disable discussions --- settings.json.example | 1 + src/bot.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/settings.json.example b/settings.json.example index ee71266..0392a02 100644 --- a/settings.json.example +++ b/settings.json.example @@ -12,6 +12,7 @@ "pg_db": "rcgcdb", "pg_pass": "secret_password", "pg_port": "5432", + "discussions_enabled": false, "irc_servers": { "your custom name for the farm": { "domains": ["wikipedia.org", "otherwikipedia.org"], diff --git a/src/bot.py b/src/bot.py index dab521a..83745fb 100644 --- a/src/bot.py +++ b/src/bot.py @@ -403,6 +403,8 @@ async def message_sender(): async def discussion_handler(): await asyncio.sleep(3.0) # Make some time before IRC code is executed, happens only once and saves if inside + if not settings.get("discussions_enabled", False): + raise asyncio.CancelledError try: while True: async with db.pool().acquire() as connection: