[commands] Remove message being required from Role/Member converters.
This allows for easier "mock" context objects, for those who use converters as utility functions outside of commands, and it's more straightforward with the rest of the file.
This commit is contained in:
parent
f45aef7c2e
commit
bda690c32f
@ -98,10 +98,9 @@ class MemberConverter(IDConverter):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
async def convert(self, ctx, argument):
|
async def convert(self, ctx, argument):
|
||||||
message = ctx.message
|
|
||||||
bot = ctx.bot
|
bot = ctx.bot
|
||||||
match = self._get_id_match(argument) or re.match(r'<@!?([0-9]+)>$', argument)
|
match = self._get_id_match(argument) or re.match(r'<@!?([0-9]+)>$', argument)
|
||||||
guild = message.guild
|
guild = ctx.guild
|
||||||
result = None
|
result = None
|
||||||
if match is None:
|
if match is None:
|
||||||
# not a mention...
|
# not a mention...
|
||||||
@ -316,7 +315,7 @@ class RoleConverter(IDConverter):
|
|||||||
3. Lookup by name
|
3. Lookup by name
|
||||||
"""
|
"""
|
||||||
async def convert(self, ctx, argument):
|
async def convert(self, ctx, argument):
|
||||||
guild = ctx.message.guild
|
guild = ctx.guild
|
||||||
if not guild:
|
if not guild:
|
||||||
raise NoPrivateMessage()
|
raise NoPrivateMessage()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user