How To Convert A String To A User Discord.py
I'm trying to convert a string to a user so I can dm them. Here's my current code: @bot.command(pass_context=True) async def partnerwarn(ctx): file_names = glob.glob('p*') for
Solution 1:
When the command
decorator sees an annotation on one of the arguments to the decorated coroutine, it knows to either use the correct converter or directly apply the annotation as a callable before the argument is passed to the underlying coroutine.
You can create your own MemberConverter
objects and use them to convert strings to Member
s by using their convert
coroutines:
from discord.ext.commandsimportMemberConverter
...
converter = MemberConverter()
member = await converter.convert(ctx, file[1:])
Post a Comment for "How To Convert A String To A User Discord.py"