From 75c4bee8a321414440204ef9072cf3089f95b476 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Fri, 27 Dec 2019 23:07:43 +0100 Subject: [PATCH] [Core] Tell user that the (local) whitelist/blacklist is empty when using a list command. (#3219) * Update core_commands.py * Create 3219.bugfix.rst --- changelog.d/3219.bugfix.rst | 1 + redbot/core/core_commands.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 changelog.d/3219.bugfix.rst diff --git a/changelog.d/3219.bugfix.rst b/changelog.d/3219.bugfix.rst new file mode 100644 index 000000000..d8f7c4ce5 --- /dev/null +++ b/changelog.d/3219.bugfix.rst @@ -0,0 +1 @@ +Tell user that the (local) whitelist/blacklist is empty when using commands that list whitelisted/blacklisted users/roles. diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index a46087059..2fe864c28 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1705,6 +1705,10 @@ class Core(commands.Cog, CoreLogic): """ curr_list = await ctx.bot._config.whitelist() + if not curr_list: + await ctx.send("Whitelist is empty.") + return + msg = _("Whitelisted Users:") for user in curr_list: msg += "\n\t- {}".format(user) @@ -1768,6 +1772,10 @@ class Core(commands.Cog, CoreLogic): """ curr_list = await ctx.bot._config.blacklist() + if not curr_list: + await ctx.send("Blacklist is empty.") + return + msg = _("Blacklisted Users:") for user in curr_list: msg += "\n\t- {}".format(user) @@ -1838,6 +1846,10 @@ class Core(commands.Cog, CoreLogic): """ curr_list = await ctx.bot._config.guild(ctx.guild).whitelist() + if not curr_list: + await ctx.send("Local whitelist is empty.") + return + msg = _("Whitelisted Users and roles:") for obj in curr_list: msg += "\n\t- {}".format(obj) @@ -1923,6 +1935,10 @@ class Core(commands.Cog, CoreLogic): """ curr_list = await ctx.bot._config.guild(ctx.guild).blacklist() + if not curr_list: + await ctx.send("Local blacklist is empty.") + return + msg = _("Blacklisted Users and Roles:") for obj in curr_list: msg += "\n\t- {}".format(obj)