[V3 Mod/Filter] Fix #1202 (#1327)

* Fix #1326

Checks to see if `author` is a `valid_user` (of `Member` class) before checking to see if the bot `is_mod_or_superior` to the `author`.

* Fix #1202

Raises `TypeError` when `User` objects are passed into `is_mod_or_superior` or `is_admin_or_superior`, as only `Member` objects have a `guild` attribute.

* Fixes #1202

Checks to see if `author` is a `valid_user` (of `Member` class) before checking to see if the bot `is_mod_or_superior` to the `author`.
This commit is contained in:
Sebass13
2018-02-21 17:36:13 -06:00
committed by Will
parent d20724d7b2
commit b5c71bc59c
3 changed files with 16 additions and 9 deletions

View File

@@ -124,7 +124,7 @@ async def is_mod_or_superior(
user = None
if isinstance(obj, discord.Message):
user = obj.author
elif isinstance(obj, discord.Member) or isinstance(obj, discord.User):
elif isinstance(obj, discord.Member):
user = obj
elif isinstance(obj, discord.Role):
pass
@@ -214,7 +214,7 @@ async def is_admin_or_superior(
user = None
if isinstance(obj, discord.Message):
user = obj.author
elif isinstance(obj, discord.Member) or isinstance(obj, discord.User):
elif isinstance(obj, discord.Member):
user = obj
elif isinstance(obj, discord.Role):
pass