Differentiate staging environment

master
Nikola Forró 4 years ago
parent d834187bb5
commit 1feba3bd33

@ -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

Loading…
Cancel
Save