59 Commits

Author SHA1 Message Date
Harmon
6f9793fe5e Fixes and improvements for v1.3 documentation
* Add missing versionadded strings for v1.3
* Add missing versionchanged string for Message.edit
* Consistently use versionadded for attributes
* Consistently use versionchanged for parameters
* Use versionchanged for Bot.is_owner
* Fix references in v1.3 changelog
* Improve grammar in v1.3 changelog
2020-01-22 23:55:05 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz
15f0b000e1 Move PartialEmoji over to a new namespace to avoid circular imports 2019-11-20 00:50:19 -05:00
Rapptz
cb21159589 Document that PartialEmoji.name can be None 2019-11-18 20:00:06 -05:00
Devon R
bf9b9c5879 Adjust BASE urls to have no trailing slash (consistency) 2019-11-15 04:25:38 -05:00
Devon R
f5ebf42e1f Return invites as https, various URL normalization 2019-11-15 04:25:38 -05:00
NCPlayz
f273199d57 Refactor name kwarg for Emoji.edit() 2019-10-20 05:19:03 -04:00
Io Mintz
3cef1e09f8 Add Emoji.is_usable() 2019-09-19 21:24:16 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
8e80eee0d1 Add Emoji.available field 2019-06-04 18:30:46 -04:00
Rapptz
2cd6d771ec Make __repr__ slightly more detailed and add a few missing ones.
This includes raw events (which didn't have any) and a few other
types that were missing them. Upon review some more useful fields were
added to the repr output which would be more useful during debugging.
2019-05-26 02:32:47 -04:00
Allan Galarza
5473cec6ac Added note to Emoji.user 2019-05-13 22:12:33 -04:00
Benjamin Mintz
a62641bd65 Add back __repr__ that were deleted in the Asset redesign
The Asset PR (be227ebcf0c8bad6b56798339b5414b8da414dc0) changed some namedtuple-deriving
classes to object-deriving classes, which meant that the free __repr__ provided by namedtuple
was removed
2019-05-13 20:29:08 -04:00
Rapptz
9248ff306c Use explicit __eq__ call to be consistent with other methods. 2019-04-06 20:18:10 -04:00
NCPlayz
1d701f32b6 Add fetch custom emoji, all custom emojis; Add user property to Emoji 2019-04-06 19:19:47 -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
Rapptz
72b6b67cf4 Add back PartialEmoji.__hash__ that was deleted due to __eq__. 2019-03-20 22:54:53 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Rapptz
bbc4460c38 Fix Emoji.__hash__ being None.
When a type defines __eq__, Python removes its __hash__ function.

Fixes #1933
2019-02-26 08:44:25 -05:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Ben Mintz
ce3ede1551 Implement PartialEmoji == Emoji (fixes #1627) 2019-01-28 22:22:48 -05:00
MusicOnline
fed01c5e15 Remove outdated note about bot accounts.
They can now delete all emoji
2018-10-11 02:36:46 -04:00
Rapptz
95d8bb2e85 Change internal representation of roles in Member and Emoji.
Introduce a new internal type, SnowflakeList, which has better memory
footprint over a regular list or set of roles. It is suspected that
there will be a 9x reduction of memory for every Emoji instance and a
48 byte saving per Member instance. However, these savings will
probably only be evident on larger bots.

As a consequence of this change, Member.roles is now computed lazily.

Currently I am not sure if I want to do the initial sorting on the
SnowflakeList for Member, as this comes with a O(n log n) cost when
creating a Member for little purpose since SnowflakeList.has is not
overly relied on. If CPU time becomes an issue this might change.
2018-09-24 22:19:42 -04:00
Rapptz
5c24e69cf2 Fix up the Sphinx strings causing warnings. 2018-09-15 09:54:00 -04:00
Tarek1337
21309c2d72 Removed inaccurate note on emoji.py
In the docs, it says ``Note that bot accounts can only edit custom emojis they own.``

But after testing a bit. My bot was able to edit emojis in any guild that had the permissions `manage_roles`. Even if the bot didn't own the guild. Or was the original emoji uploader.

And I don't see any mentions of this in the API server or in the documentation. So I'm unsure how this ended up in here. It's possible I am misunderstanding the whole note. My bad if that's the case.
2018-09-14 22:55:28 -04:00
Carl Groth
3ccbda928e Fix PartialEmoji._as_reaction() for emojis the bot can't see
If the bot has access to the emoji, you can pass anything for its name
and it will work fine. The name is only required to be correct when
adding a reaction where you do not have access to the emoji,
all other cases ignore the name.
2018-08-30 18:33:51 -04:00
Hornwitser
d58fc0ccee [lint] Remove unused imports
Left over from various refactoring and rewrites.
2018-08-22 21:43:50 -04:00
PikalaxALT
0e6082c57d Implement roles kwarg for guild.create_custom_emoji and emoji.edit 2018-08-22 21:06:09 -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
Rapptz
8de382fcd3 Change logic in PartialEmoji.__str__ a little. 2018-01-06 17:35:03 -05: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
Rapptz
97fc4bf651 Update Emoji.url to point to the GIF version of the animated emoji. 2017-12-21 18:55:13 -05:00
Rapptz
a6bf792dec Animated emoji support. 2017-12-21 18:51:47 -05:00
Pandentia
b22f7c76c5 Further clarify how bots can interact with emoji endpoints
Clarifies that bot accounts can only interact with emoji they have
created.
2017-10-03 00:22:06 +02:00
Pandentia
51a696e674 Remove reference to "whitelisted" bots for emoji endpoints
Due to a recent change in the Discord API, bots can now create
guild-specific emoji, so I've removed the parts of the documentation
referencing this restriction.
2017-10-03 00:10:01 +02:00
Rapptz
e5ebea75a9 Lazily fetch Emoji.roles and Emoji.guild to prevent memory leaks.
The global emoji cache still managed to somehow cause memory leaks. By
storing IDs directly and lazily evaluating them when needed this
essentially removes all strong references to Guild objects which would
cause an explosion in memory usage.
2017-08-21 06:16:50 -04:00
Ashton Tito
e0f733a5c1 use cdn url for custom emojis 2017-08-16 07:10:48 -04:00
Rapptz
8caa088d25 Allow PartialReactionEmoji in add_reaction and remove_reaction. 2017-07-02 01:43:45 -04:00
Rapptz
d239cc2666 Implement "partial" message events.
These are events that get triggered regardless of the state of the
message cache. Useful for getting data from before the bot was booted.
2017-06-09 18:36:59 -04:00
Rapptz
f4e01b3a92 Make supported operations stand out more than attributes. 2017-05-20 02:08:34 -04:00
Rapptz
f73eb087c9 Use describe instead of tables for supported operations. 2017-05-13 18:48:14 -04:00
Rapptz
b44bba6ee6 First pass at documentation reform. 2017-05-12 20:14:34 -04:00
Rapptz
dff6bcc745 Add support for audit log reasons.
Most routes now have a 'reason' keyword argument.
2017-05-07 03:08:06 -04:00
Rapptz
7f58853e3a Keep track of Emoji instances myself.
WeakValueDictionary cleans up too late and brings too little benefit.
Also clean up the state when the first READY is encountered for
AutoShardedClient and when any READY is encountered in regular Client.
2017-03-29 04:36:06 -04:00
Rapptz
b88658f42f Allow Emoji to be used in a weakref. 2017-03-24 21:50:19 -04:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
98b981848d Move message creation to a factory method inside ConnectionState. 2017-01-03 09:52:10 -05:00
Rapptz
dceba9d962 Add useful repr to all data classes. 2017-01-03 09:52:06 -05:00
Rapptz
79a49f9145 Absolute import some circular dependencies to appease Python 3.4. 2017-01-03 09:52:02 -05:00