41 Commits

Author SHA1 Message Date
Rapptz
9da2f349e7 Use Any instead of str for Embed typings for accuracy 2021-04-08 20:12:08 -04:00
Sebastian Law
4c72137e43
[docs] add note for possible Embed.type strings 2021-04-07 07:17:57 -04:00
Rapptz
f49d565d51 Rename discord.types file based on relevant core module file 2021-04-07 05:50:54 -04:00
Rapptz
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
Nadir Chowdhury
89456022cf
Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
Rapptz
ed1341012b Add Embed.__bool__
Fixes #6661
2021-04-07 00:01:57 -04:00
Rapptz
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
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
pikaninja
5a93e80e87
Implicitly cast Embed construction parameters to str 2021-03-24 23:13:57 -04:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Dan Hess
e04bd1b3a1
Fix error when trying to clear empty image/thumbnail in embeds 2020-08-07 01:07:54 -04:00
Sebastian Law
b4b953bfc6
Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
jack1142
a601cf43ab Allow clearing the author information in embeds. 2020-05-23 21:47:25 -04:00
Rapptz
66c6be50d8 Prepare for the discord.com domain rename 2020-05-23 21:44:30 -04:00
Riley Shaw
75d3c4f6cf allow passing EmptyEmbed to set_image and set_thumbnail 2020-05-02 19:57:48 -04:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Dante Dam
84e9168447 Grammar fixes for notes on EmbedProxy 2019-05-23 23:21:40 -04:00
Kyber
f2c7b2e6d8 Add an insert_field_at method for the embed class 2019-05-23 23:21:39 -04:00
Rapptz
792b31833a Mention what can be done during initialisation in embeds. 2019-05-07 00:24:25 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Rapptz
4bd4c23694 Fix NameError in Embed.to_dict 2019-03-17 11:51:54 -04:00
Michael H
03616b91db Fix embed to_dict timestamp handling for python 3.5
resolves #1992
2019-03-17 09:17:14 -04:00
Rapptz
70c5f1723f Fix Embed.to_dict to work with TZ aware datetime objects. 2019-03-15 05:56:01 -04:00
Rapptz
7fbdc6e83f Add Embed.copy to do a copy on an embed object. 2019-03-13 06:08:21 -04:00
Rapptz
35a330c5d3 Add Embed.__len__ to query total character size of an embed. 2019-03-13 06:07:57 -04:00
Rapptz
73aca4d4d3 Expose Embed.from_data as Embed.from_dict
This is a breaking change.
2019-03-13 06:02:56 -04:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05: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
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Steve C
221df0ab02 Update embed property doc grammar 2017-08-29 15:48:10 -04:00
Rapptz
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
Rapptz
15edfc2b26 Make checking for truth-ness of EmbedProxy easier. 2017-06-16 22:17:24 -04:00
Rapptz
1239e88d05 Handle aware datetimes in embeds. 2017-03-13 17:47:46 -04:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Ian Salmons
9224d9b9d3 Add missing fields to Embed.from_data() 2017-01-08 20:42:40 +00:00
Rapptz
98b981848d Move message creation to a factory method inside ConnectionState. 2017-01-03 09:52:10 -05:00
Rapptz
79a49f9145 Absolute import some circular dependencies to appease Python 3.4. 2017-01-03 09:52:02 -05:00
Rapptz
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
Rapptz
af46718460 Add support for rich embeds. 2016-11-13 05:07:58 -05:00