From 1feba3bd33d1b12cd99f10bf648816c5262999b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 8 Sep 2020 21:35:44 +0200 Subject: [PATCH] Differentiate staging environment --- bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a56d251..7cdb680 100644 --- a/bot.py +++ b/bot.py @@ -38,9 +38,11 @@ config = configparser.ConfigParser() config.read(os.getenv('CHEDDAR_KNIGHT_CONFIG', 'settings.cfg')) +staging = config.getboolean('General', 'staging', fallback=False) storage_path = config.get('General', 'storage_path') token = config.get('Discord', 'token') +staging_server_id = config.getint('Discord', 'staging_server_id', fallback=None) twitter_channel_id = config.getint('Discord', 'twitter_channel_id') youtube_channel_id = config.getint('Discord', 'youtube_channel_id') @@ -64,7 +66,10 @@ class Bot(discord.Client): await action(data) async def on_message(self, message): - for pattern in self.commands: + staging_server = message.channel.guild.id == staging_server_id + if staging and not staging_server or not staging and staging_server: + return + for pattern in self.commands: m = pattern.match(message.content) if not m: continue