diff options
author | romangraef <romangraef@gmail.com> | 2019-09-08 21:41:01 +0200 |
---|---|---|
committer | romangraef <romangraef@gmail.com> | 2019-09-08 21:41:01 +0200 |
commit | fbd1f326d8a07ae7a3eb9871a254b85b2e4a79cf (patch) | |
tree | 7332a03df755325f6b8988edd0b6414790f32f34 | |
parent | e465725dc6be4b66efb66bf54c8758c58de893e5 (diff) | |
download | drutils-master.tar.gz drutils-master.tar.bz2 drutils-master.zip |
-rw-r--r-- | drutils/converters.py | 2 | ||||
-rw-r--r-- | examples/main.py | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/drutils/converters.py b/drutils/converters.py index 640a7a6..4354af1 100644 --- a/drutils/converters.py +++ b/drutils/converters.py @@ -21,7 +21,7 @@ class AugmentedConverter(Converter): if isinstance(converter, Converter): converter = converter.convert result = await converter(ctx, argument) - if await maybe_coroutine(self.filter_function(result)): + if await maybe_coroutine(self.filter_function, result): return result raise UserInputError() diff --git a/examples/main.py b/examples/main.py new file mode 100644 index 0000000..617b4aa --- /dev/null +++ b/examples/main.py @@ -0,0 +1,16 @@ +from os import environ + +from discord.ext.commands import Bot, Greedy, MemberConverter + +from drutils import non_nullable + +bot = Bot(command_prefix="!") + + +@bot.command() +async def converter_test(ctx, members: Greedy[non_nullable(MemberConverter)]): + await ctx.send('\n'.join(member.name for member in members)) + + +if __name__ == '__main__': + bot.run(environ['TOKEN']) |