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')) config.read(os.getenv('CHEDDAR_KNIGHT_CONFIG', 'settings.cfg'))
staging = config.getboolean('General', 'staging', fallback=False)
storage_path = config.get('General', 'storage_path') storage_path = config.get('General', 'storage_path')
token = config.get('Discord', 'token') 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') twitter_channel_id = config.getint('Discord', 'twitter_channel_id')
youtube_channel_id = config.getint('Discord', 'youtube_channel_id') youtube_channel_id = config.getint('Discord', 'youtube_channel_id')
@ -64,6 +66,9 @@ class Bot(discord.Client):
await action(data) await action(data)
async def on_message(self, message): async def on_message(self, message):
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: for pattern in self.commands:
m = pattern.match(message.content) m = pattern.match(message.content)
if not m: if not m:

Loading…
Cancel
Save