Python discord.ext.commands.Converter() Examples
The following are 2
code examples of discord.ext.commands.Converter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
discord.ext.commands
, or try the search function
.
Example #1
Source File: data.py From RPGBot with GNU General Public License v3.0 | 5 votes |
def union(*classes): class Union(commands.Converter): async def convert(self, ctx, argument): for cls in classes: try: if cls in converters: cls = converters[cls] return await cls.convert(self, ctx, argument) except Exception as e: pass else: raise e return Union
Example #2
Source File: converter.py From EmoteCollector with GNU Affero General Public License v3.0 | 4 votes |
def _do_conversion(self, ctx, converter, arg): if inspect.isclass(converter) and issubclass(converter, commands.Converter): return await converter().convert(ctx, arg) if isinstance(converter, commands.Converter): return await converter.convert(ctx, arg) if callable(converter): return converter(arg) raise TypeError