diff options
| author | 2020-02-06 21:50:10 +0100 | |
|---|---|---|
| committer | 2020-02-06 21:50:10 +0100 | |
| commit | 90dd064f2a8cfe66e5cefbe7b679dac38f6f7845 (patch) | |
| tree | 4a8f2df1a21659ac3c13d06e35cbc1b6b93f882e | |
| parent | Update tests to reflect status changes (diff) | |
Instead of sending a message everytime a role can't be converted, append it to a list, and then send them it at once (less spammy)
| -rw-r--r-- | bot/cogs/information.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bot/cogs/information.py b/bot/cogs/information.py index 412447835..bc67ab5c2 100644 --- a/bot/cogs/information.py +++ b/bot/cogs/information.py @@ -58,6 +58,7 @@ class Information(Cog): To specify multiple roles just add to the arguments, delimit roles with spaces in them using quotation marks. """ parsed_roles = [] + failed_roles = [] for role_name in roles: if isinstance(role_name, Role): @@ -68,11 +69,17 @@ class Information(Cog): role = utils.find(lambda r: r.name.lower() == role_name.lower(), ctx.guild.roles) if not role: - await ctx.send(f":x: Could not convert `{role_name}` to a role") + failed_roles.append(role_name) continue parsed_roles.append(role) + if failed_roles: + await ctx.send( + ":x: I could not convert the following role names to a role: \n- " + "\n- ".join(failed_roles) + ) + for role in parsed_roles: h, s, v = colorsys.rgb_to_hsv(*role.colour.to_rgb()) |