39 Commits

Author SHA1 Message Date
Rapptz
45af9fa40b [commands] Allow passing of typing.Union into Greedy. Fix #1951 2019-03-03 06:24:35 -05:00
Rapptz
69f5a70eeb [commands] Allow Converter instances in Greedy. Fix #1939. 2019-02-27 21:38:55 -05:00
Benjamin Mintz
bb9f153d29 commands.clean_content: escape || spoilers || 2019-02-06 01:52:12 -05:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Dice
bda690c32f [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.
2018-12-14 18:59:47 -05:00
Hornwitser
efb4ff850e [lint] Fix import order
Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
2018-11-24 22:17:58 -05:00
Hornwitser
fa46b07db1 [lint] Rename exception variables to exc
Use the more explicit (and common) exc instead of e as the variable
holding the exception in except handlers.
2018-11-24 22:17:57 -05:00
Rapptz
45af0c83de [commands] Fix NameError in clean_content converter 2018-09-25 19:48:20 -04:00
Rapptz
3d03dbc451 Change internal role storage in Guild to a dict instead of a list.
This adds the following APIs:

* Guild.get_role

This removes the following APIs:

* Guild.role_hierarchy

To compensate for the removed APIs, Guild.roles is now a sorted list
based on hierarchy. The first element will always be the @everyone
role.

This speeds up access at the cost of some memory, theoretically.
2018-09-24 21:08:48 -04:00
Rapptz
814b03f5a8 [commands] Add commands.Greedy converter and documentation.
This allows for greedy "consume until you can't" behaviour similar to
typing.Optional but for lists.
2018-09-24 03:56:32 -04:00
Hornwitser
c8b49d37be [lint] Fix incorrect and inconsistent whitespace
Adjust whitespace to be consistent with the rest of the library.
2018-08-22 21:43:53 -04:00
Hornwitser
d58fc0ccee [lint] Remove unused imports
Left over from various refactoring and rewrites.
2018-08-22 21:43:50 -04:00
Rapptz
f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
Gorialis
04d9dd9c0d Change PartialReactionEmoji to PartialEmoji, add a PartialEmojiConverter 2018-01-06 17:32:25 -05:00
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Joshua Butt
f5a443fa8f Add support for animated emoji to commands ext EmojiConverter 2017-12-22 14:59:21 +10:00
Rapptz
e614f6b4cd [commands] Add CategoryChannelConverter 2017-09-13 17:19:30 -04:00
Rapptz
eb673ec2af [commands] Ensure no mentions escape clean_content
Some clever nicknames or role names would lead themselves to
resolving to pings.
2017-08-10 03:17:24 -04:00
Rapptz
cb709cc9da [commands] Fix clean_content converter not properly escaping mentions.
In some cases, the Discord provided role_mentions and mentions array
would be empty, such as wrapping a mention with a backtick or
other frivolous characters. Since we want to completely nullify
mentions, we should not rely on the Discord provided arrays and instead
use and resolve the IDs from the content itself.
2017-08-10 02:46:00 -04:00
Rapptz
b2cf11fe9d [commands] Add escape_markdown parameter for clean_content. 2017-05-28 23:18:54 -04:00
Rapptz
093d888173 [commands] Fix EmojiConverter not working with underscore names. 2017-05-26 18:58:56 -04:00
Rapptz
b44bba6ee6 First pass at documentation reform. 2017-05-12 20:14:34 -04:00
Rapptz
d7478425ca [commands] Converter.convert is always a coroutine.
Along with this change comes with the removal of Converter.prepare and
adding two arguments to Converter.convert, the context and the argument.

I suppose an added benefit is that you don't have to do attribute
access since it's a local variable.
2017-05-10 21:30:41 -04:00
Rapptz
3e15f46dcf [commands] Bot.get_all_emojis no longer exists. 2017-04-12 05:00:50 -04:00
Rapptz
7da0884bfb [commands] Export missing built-in converters. 2017-04-12 04:46:53 -04:00
Rapptz
e1c32626ba [commands] Fix User converter not working with IDs. 2017-03-27 20:08:26 -04:00
Rapptz
6166cbc2e7 [commands] Add commands.clean_content converter. 2017-02-13 22:15:39 -05:00
Rapptz
e10cae5dbc [commands] Allow converters to be instantiated.
This allows for you to create converters that can have varying
behaviour using the converter's __init__ instead of having to do a
meta-class based approach to get around the fact that __init__ is part
of the interface.

To make up for the lack of __init__, a new method Converter.prepare was
added to do the work that __init__ used to do.
2017-02-13 21:05:25 -05:00
Rapptz
aac769eb56 [commands] Fix converters returning the wrong types when an ID is passed 2017-01-31 04:57:13 -05:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
11b54d67c9 [commands] Change UserConverter to actually work with User, not Member. 2017-01-14 22:15:02 -05:00
Rapptz
406984af2e [commands] First pass in making commands ext work again. 2017-01-03 09:52:03 -05:00
Rapptz
d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -05:00
Rapptz
45c729b167 Switch IDs to use int instead of str 2017-01-03 09:51:49 -05:00
Rapptz
152b3a1125 [commands] Default converters now take in IDs to match against. 2016-09-09 06:53:22 -04:00
Rapptz
a55e1241a7 [commands] Add missing inspect import in converter.py 2016-08-04 21:39:44 -04:00
Khazhismel
c72c23278d [commands] Add custom emoji converter. 2016-07-31 22:39:45 -07:00
Rapptz
1500001b04 [commands] Fix error in converters in a private message context.
I was referencing a member function that did not actually exist. So I
ported it over to a free function that could be used.
2016-07-02 23:39:29 -04:00
Rapptz
e64eb08c92 [commands] Port special cased discord converters to commands.Converter 2016-06-22 20:05:37 -04:00