From d1662e1a8262cab25b816d7e0f0092191760ffc6 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 17 Jun 2017 18:03:54 -0500 Subject: [PATCH] Use default or welcome notifications overrides --- cogs/events.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index 46a85e5..6bdae3a 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -60,7 +60,12 @@ class StatsUpdate: try: join_leave_on = server_settings['join_leave'] if join_leave_on: - channel_id = server_settings.get('notifications_channel') or member.guild.id + # Get the notifications settings, get the welcome setting + notifications = self.bot.db.load('server_settings', key=guild.id, pluck='notifications') or {} + # Set our default to either the one set, or the default channel of the server + default_channel_id = notifications.get('default') or guild.id + # If it is has been overriden by picarto notifications setting, use this + channel_id = notifications.get('welcome') or default_channel_id else: return except (IndexError, TypeError, KeyError): @@ -79,7 +84,12 @@ class StatsUpdate: try: join_leave_on = server_settings['join_leave'] if join_leave_on: - channel_id = server_settings.get('notifications_channel') or member.guild.id + # Get the notifications settings, get the welcome setting + notifications = self.bot.db.load('server_settings', key=guild.id, pluck='notifications') or {} + # Set our default to either the one set, or the default channel of the server + default_channel_id = notifications.get('default') or guild.id + # If it is has been overriden by picarto notifications setting, use this + channel_id = notifications.get('welcome') or default_channel_id else: return except (IndexError, TypeError, KeyError):