Commit Graph

46 Commits

Author SHA1 Message Date
565b41b0b2 Fix Embed.from_dict typing being too strict for a public function
The Embed TypedDict is not publicly accessible so would always lead
to type errors upon usage.
2021-08-24 03:15:06 -04:00
6ce1c537d4 Localize Embed.timestamp during assignment 2021-06-28 00:00:17 -04:00
dd727fb6f4 Add Embed.remove_footer 2021-06-07 03:33:11 -04:00
f42e922696 Fix bug in Embed.__len__ caused by footer without text 2021-05-27 00:45:35 -04:00
8f9819eb4c [docs] Fix various unresolved references 2021-04-15 22:41:41 -04:00
9da2f349e7 Use Any instead of str for Embed typings for accuracy 2021-04-08 20:12:08 -04:00
4c72137e43 [docs] add note for possible Embed.type strings 2021-04-07 07:17:57 -04:00
f49d565d51 Rename discord.types file based on relevant core module file 2021-04-07 05:50:54 -04:00
23fe6b46dd Typehint discord.Embed and introduce discord.types subpackage
The discord.types subpackage is currently only used to do type hinting
of API payloads, it's very much incomplete right now and it'll be a
rather long process.

discord.Embed was typehinted and formatted using black.
2021-04-07 05:39:58 -04:00
89456022cf Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
ed1341012b Add Embed.__bool__
Fixes #6661
2021-04-07 00:01:57 -04:00
ff7094ce96 Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout
the library.
2021-04-04 23:54:08 -04:00
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
5a93e80e87 Implicitly cast Embed construction parameters to str 2021-03-24 23:13:57 -04:00
69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
e04bd1b3a1 Fix error when trying to clear empty image/thumbnail in embeds 2020-08-07 01:07:54 -04:00
b4b953bfc6 Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
a601cf43ab Allow clearing the author information in embeds. 2020-05-23 21:47:25 -04:00
66c6be50d8 Prepare for the discord.com domain rename 2020-05-23 21:44:30 -04:00
75d3c4f6cf allow passing EmptyEmbed to set_image and set_thumbnail 2020-05-02 19:57:48 -04:00
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
84e9168447 Grammar fixes for notes on EmbedProxy 2019-05-23 23:21:40 -04:00
f2c7b2e6d8 Add an insert_field_at method for the embed class 2019-05-23 23:21:39 -04:00
792b31833a Mention what can be done during initialisation in embeds. 2019-05-07 00:24:25 -04:00
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
4bd4c23694 Fix NameError in Embed.to_dict 2019-03-17 11:51:54 -04:00
03616b91db Fix embed to_dict timestamp handling for python 3.5
resolves #1992
2019-03-17 09:17:14 -04:00
70c5f1723f Fix Embed.to_dict to work with TZ aware datetime objects. 2019-03-15 05:56:01 -04:00
7fbdc6e83f Add Embed.copy to do a copy on an embed object. 2019-03-13 06:08:21 -04:00
35a330c5d3 Add Embed.__len__ to query total character size of an embed. 2019-03-13 06:07:57 -04:00
73aca4d4d3 Expose Embed.from_data as Embed.from_dict
This is a breaking change.
2019-03-13 06:02:56 -04:00
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
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
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
221df0ab02 Update embed property doc grammar 2017-08-29 15:48:10 -04:00
1d3bb1f510 Simplify embed timestamp code due to it being fixed Discord side.
See https://github.com/hammerandchisel/discord-api-docs/issues/291
2017-07-09 15:52:50 -04:00
15edfc2b26 Make checking for truth-ness of EmbedProxy easier. 2017-06-16 22:17:24 -04:00
1239e88d05 Handle aware datetimes in embeds. 2017-03-13 17:47:46 -04:00
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
9224d9b9d3 Add missing fields to Embed.from_data() 2017-01-08 20:42:40 +00:00
98b981848d Move message creation to a factory method inside ConnectionState. 2017-01-03 09:52:10 -05:00
79a49f9145 Absolute import some circular dependencies to appease Python 3.4. 2017-01-03 09:52:02 -05:00
c4ee4c1db4 Make discord.Embed builder more strict and easier to use.
Allow for easier use when trying to "reuse" the same discord.Embed
object by providing new methods such as Embed.clear_fields,
Embed.set_field_at, and allowing you to set things to Embed.Empty to
clear out an attribute.

For ease of use, things are automatically casted to ``str`` to prevent
the user from having HTTP 400 errors if they forgot to do so. The new
embed builder also supports "fluent-style" interface to allow you to
chain methods in a single line if necessary.

Certain parameters were removed since they were ignored by Discord
anyway such as `width` and `height` in Embed.set_image and
Embed.set_thumbnail.
2016-11-22 19:30:21 -05:00
af46718460 Add support for rich embeds. 2016-11-13 05:07:58 -05:00