Commit Graph
84 Commits
Author SHA1 Message Date
Josh c54c4cb215 [commands] Fix repr for Greedy 2021-04-10 22:34:24 -04:00
Nadir Chowdhury 353737239a [commands] Minimise code duplication in channel converters 2021-04-10 14:01:26 -04:00
James bcd3a00eaf [commands] Make commands.Greedy a typing.Generic 2021-04-10 07:27:32 -04:00
Michael H 682b73abb6 [commands] Address incorrect use of subclass (from type perspective)
This is a follow up from #6641
2021-04-05 21:39:17 -04:00
Michael H d0476e98df [commands] Add more type information to public API of converters 2021-04-05 21:31:28 -04:00
Michael H 83bd76504a Use covariant TypeVar for protocol 2021-04-05 20:29:15 -04:00
James 34ab772653 Use typing.Protocol instead of abc.ABCMeta 2021-04-04 18:05:49 -04:00
Rapptz 9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Rapptz 421c0cd455 [commands] Add missing versionadded on StoreChannelConverter 2021-04-03 22:54:21 -04:00
DoggieLicc 36318bd45c [commands] Add StoreChannelConverter 2021-04-03 22:50:17 -04:00
Nadir Chowdhury 1b2688518e Implement StageChannel and related methods 2021-04-03 22:43:41 -04:00
Edwin 31ee3fafc1 Add remove_markdown helper function 2021-03-28 18:38:34 -04:00
Nihaal Sangha a3f700c11f Fix references to snowflakes being max 21 long 2021-03-02 19:04:03 -05:00
Rapptz a0404807d5 [commands] Add support for rgb function in ColourConverter
This also adds support for 3 digit hex.

Fixes #6374
2021-02-07 07:18:56 -05:00
Alex Nørgaard 68eb844d48 [commands] Add discord.Guild converter and GuildNotFound error
* Add discord.Guild converter and GuildNotFound error

* note for lack of disambiguation in Guilds with duplicate names, and removed the possibility of returning None

* edited converter to use `utils.get` over `utils.find` and docs edited with Converter and Exception.
2021-02-07 05:32:33 -05:00
Nihaal Sangha 69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
Josh eeafc9363f [commands] Add PartialMessageConverter 2021-01-15 05:26:03 -05:00
Ben Skerritt 0995d07727 [commands] Added in missing channel links 2020-12-07 18:35:16 -05:00
Rapptz 0456458ad1 [commands] Fetch user if an ID is passed and cache lookup fails. 2020-11-23 06:22:44 -05:00
Rapptz 431ee8794b Fix error with templates not having access to member cache flags.
This also changes the attribute from having an underscore

Fix #5986
2020-11-21 22:42:59 -05:00
Jonathan Feenstra c54d6f03c5 [commands] Update MessageConverter link regex
Remove redundant parts of the MessageConverter regexes and support www
2020-11-21 21:30:54 -05:00
Rapptz 3daaadafdd [commands] Lazily fetch members in discord.Member converters
This makes commands taking members mostly work transparently without
much effort from the user.
2020-10-17 23:05:22 -04:00
Michael 93fa46713a Fix and add documentation 2020-09-23 03:19:35 -04:00
Simon Beal 6ebd2e13a1 [commands] Add subclasses of BadArgument for converters 2020-09-04 08:45:29 -04:00
parafoxia ad04fbeee4 [commands] Added ColorConverter alias 2020-08-31 02:29:38 -04:00
James 475762e8df Document raises for Converter.convert 2020-07-08 23:01:00 -04:00
Sebastian Law 7a07644de3 [commands] Raise TypeError when Optional is used with Greedy converter 2020-06-28 03:54:34 -04:00
Rapptz 66c6be50d8 Prepare for the discord.com domain rename 2020-05-23 21:44:30 -04:00
Rapptz 02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Hugo Woesthuis ee6f4e85d6 [commands] Allow @ prefixed usernames in DM contexts for UserConverter
Previously the argument '@user#0000' return None.
To fix this, as this is a common user error, an extra check was added
 to remove the first character from the argument if this is an '@'.
 Discord names may not contain an '@' anyways.
2020-01-20 07:14:27 -05:00
Rapptz 6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz 2e6882bd8c [commands] Fall back to using Message.mentions in converters
Useful if there's no cache.
2019-07-10 04:51:27 -04:00
NCPlayz 3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz 40cac30da1 [commands] Fix MessageConverter not inheriting from Converter
Closes #2126
2019-04-29 23:37:27 -04:00
Rapptz 919dbcafb3 Consistent use of __all__ to prevent merge conflicts. 2019-04-20 17:20:58 -04:00
Rapptz 296d4bf580 [commands] Add new MessageConverter to commands prose page. 2019-04-17 22:41:58 -04:00
retke 440db2a568 [commands] Add MessageConverter to fetch messages by URL or ID. 2019-04-17 20:47:21 -04:00
Rapptz 6574c97a8b [commands] Support callables in Greedy converter 2019-04-13 07:28:26 -04:00
Rapptz 9833ea82e2 Add helpers to escape markdown and mentions from text.
Fixes #1673
2019-04-06 20:14:05 -04:00
Rapptz e4de25eaab [commands] Raise BadArgument in ColourConverter when using from_hsv/rgb
Fixes #2043
2019-04-06 19:29:21 -04:00
CapnS 24d3a5a48d Only escape characters as necessary in clean_content
Fixes #1885
2019-04-06 19:19:58 -04:00
NCPlayz be227ebcf0 Redesign asset retrieval in the library.
Most assets now return a new class named `Asset`. This allows for the
assets to be consistently saved via a `save` method instead of special
casing for `Attachment`.

`AppInfo` is no longer a namedtuple it is a fully documented dataclass,
as well as having the state attached to it.

Fixes #1997
2019-04-06 19:12:50 -04:00
Joshua B d221ca5f7d [commands] ColourConverter raises if value is out of range
changes make the `ext.commands.ColourConverter` Converter fail when
user input is outside the acceptable value range 0x000000 - 0xFFFFFF
2019-03-19 09:23:10 -04:00
NCPlayz f507f508a2 Expose Metadata
Added access to:
* `/users/@me/guilds`
* `/guilds/{guild_id}`
* `/guilds/{guild_id}/members/{member_id}`

BREAKING CHANGE:
* `get_user_info` -> `fetch_user_info` to match naming scheme.

Remove useless note

Remove `reverse` and corresponding documentation

Update documentation to reflect #1988

Rename `get_` HTTP functions to `fetch_`

Breaking Changes:
* `get_message` -> `fetch_message`
* `get_invite` -> `fetch_invite`
* `get_user_profile` -> `fetch_user_profile`
* `get_webhook_info` -> `fetch_webhook`
* `get_ban` -> `fetch_ban`

Fix InviteConverter, update migrating.rst

Rename get_message to fetch_message
2019-03-19 09:00:18 -04:00
NCPlayz fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
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