106 Commits

Author SHA1 Message Date
jack1142
fbb7add01a Specify the unit for max_age arg in GuildChannel.create_invite() 2020-05-07 02:30:24 -04:00
Rapptz
8ff285fcbc Documentation fixups for allowed mentions 2020-04-04 13:32:47 -04:00
Rapptz
d853a57e86 Rename allowed mention parameters to allowed_mentions 2020-04-04 13:22:51 -04:00
Rapptz
481b335f2d Fix various implementation bugs with allowed mentions 2020-04-04 12:45:17 -04:00
Rapptz
041785937e Add support for configuring allowed mentions per message or bot wide. 2020-04-04 07:40:51 -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
Rapptz
e91675291e Fix bug preventing movement of channels when there are gaps in position
The original code was too aggressive in ensuring that the channel
positions are correct and within bounds. Unfortunately, for Discord
this number is merely a guess and there can be gaps that cause the
position number to be greater than the number of channels currently
in that sorting bucket.

One such example of this is when a channel is deleted and created. When
this happens, the positions are not updated (presumably because Discord
considers this to be too expensive). Sadly this means that if a user
were to create a channel, delete a channel, and then create another one
then there will be gaps in the position sequence.

More concretely, consider the following example:

Channels with position [0, 1, 2, 3, 4]. A new channel is created so it
inherits the maximum position giving us [0, 1, 2, 3, 4, 5]. We delete
a channel that's smaller than the maximum so our list now looks like
[0, 1, 2, 4, 5]. Next time we create a channel we will further
increment the gap, giving us [0, 1, 2, 4, 5, 6]. If a user would want
to move the channel with position 4 to be after position 6 (so in this
case that value would 7) then the library would erroneously raise an
error because it assumed too much about the data integrity.

Luckily, the library upon actually doing the request fixes the channel
positions so everything goes back to normal like it was intended. That
is to say, [0, 1, 2, 3, 4, 5].
2020-01-12 03:27:48 -05:00
CapnS
072cef3bb6 Allow editing of overwrites in Channel.edit() 2019-12-04 18:40:38 -05:00
Devon R
f5ebf42e1f Return invites as https, various URL normalization 2019-11-15 04:25:38 -05:00
apple502j
7d7eabb974 Make permissions_synced actually return False
The code before this returned None when there is no category.
2019-08-27 17:43:33 -04:00
Rapptz
3dc9f40be7 Add versionadded string to GuildChannel.permissions_synced 2019-08-27 04:06:27 -04:00
Capn
125a5676b8 Add permissions_synced to abc.GuildChannel
This allows users to check whether or not the permissions for a Guild Channel are synced with the permissions for its category. Discord automatically syncs the permissions when the overwrites are equal so just checking if the two overwrites are equal will determine if they are synced.
2019-08-27 03:49:33 -04:00
Rapptz
87c2508199 Explicitly mention discord.Object in abc.Snowflake documentation. 2019-08-11 20:12:32 -04:00
Rapptz
cddcc6d6b6 abc.Messageable do not have to implement abc.Snowflake
Fix #2290
2019-07-27 22:38:30 -04:00
Rapptz
562580a07f Use lower level Guild.owner_id for permission resolution. 2019-07-10 14:30:53 -04:00
Xua
69364a25eb fix documentation for GuildChannel.set_permissions 2019-06-29 19:15:20 -04:00
Rapptz
7543328fe7 Update Sphinx to 2.1.2 2019-06-28 01:43:04 -04:00
Rapptz
7e2da1c93b Publicly expose a type property for all channels.
Fix #2185
2019-06-09 00:23:22 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
0d72ac3bb6 Ensure message links resolve in the Messageable.pins note. 2019-05-27 04:05:51 -04:00
Rapptz
96dc6f0c11 Add note that Messageable.pins does not contain Message.reactions
Fix for #2189
2019-05-27 04:04:06 -04:00
Ehren Julien-Neitzert
fc5a2936dd Fix pluralization errors in various files
* Replaced instances of 'return an' with 'returns an'
* fixed pluralization errors
2019-05-23 23:31:17 -04:00
DevilXD
0dcbdda974 Fixed a typo in GuildChannel.overwrites docstring 2019-04-29 23:34:18 -04:00
Rapptz
390bce6033 Explicit namespacing in the PermissionOverwrite example.
Apparently some people get confused by this.
2019-04-19 18:29:13 -04:00
Rapptz
f5c38c3559 Add abc.GuildChannel.clone to clone a channel with another name.
Fixes #2093
2019-04-18 22:31:54 -04:00
Vexs
0f48b78987 Add delay kwarg to message.delete()
Refactor delete_after kwargs to use new delay kwarg
2019-04-18 07:56:02 -04:00
Rapptz
9b089c9a7b Fix abc.GuildChannel.overwrites returning None keys.
This has potential for data loss as a consequence of how the function
works.
2019-04-14 07:19:22 -04:00
khazhyk
366dc4855b simplify HistoryIterator message ordering
rename reverse -> oldest_first, which is more obvious what it does.
Then, honor it entirely - if you specify no `after` endpoint, we default
to the beginning of message history, similar to how `before` defaults to
the end of message history.

This is a breaking change, and will change the behavior of any iterator
that previously would have been returning messages in a weird order for
limits over 100

`for msg in history(reversed=True, limit=300)` would return the newest
300 messages, in a messed up order (100..0, 200..100, 300..200).
`for msg in history(oldest_first=True, limit=300)` will now return the
oldest 300 messages in order. And so on.

`for msg in history(after=msg)` is unchanged, this previously would
return the oldest 100 messages after `msg`, oldest->newest order, and
still will.
2019-04-07 22:46:40 -07:00
Rapptz
79183846dc Make abc.GuildChannel.overwrites return a dictionary
Fix #2016
2019-04-06 19:33:31 -04:00
Dice
8123d4a5f7 Add type checking to multi-file send
Convert list comprehension to genexpr
2019-03-20 09:22:08 -04:00
Dice
6f3e32cfbb Fix sending multiple files
Fixes #2002
2019-03-20 09:21:16 -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
5e65ec978c Take back ownership of files from aiohttp for retrying requests.
Fix #1809
2019-03-18 07:54:36 -04:00
Rapptz
5061915b2a Add support for store channels. 2019-03-17 14:32:51 -04:00
Rapptz
053e2f5b9a Fix documentation linking issue in Messageables and Context 2019-03-16 09:55:29 -04:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -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
4ae8e81660 [lint] Remove redundant exception variables
Use bare raise statement when reraising the exception that occured, and
remove unused exception variables.  Also remove a pointless exception
handler in discord.opus.
2018-11-24 22:17:57 -05:00
Hornwitser
a71b3b5fa0 [lint] Limit unneccessarily broad except clauses
Add exception qualifier(s) to bare except clauses swallowing exceptions.
2018-11-24 22:17:57 -05: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
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
0352c80a17 Add support for Discord's slow mode.
Adds the following:

* `slowmode_delay` for `TextChannel.edit`
* `slowmode_delay` attribute for `TextChannel`
2018-09-14 22:55:29 -04:00
BeatButton
a4d1599ce9 Change docstrings to raw-strings 2018-09-14 22:55:27 -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
119c5a0618 [lint] Remove unused variables
Left over from various refactoring and rewrites.
2018-08-22 21:43:51 -04:00
Rapptz
c67d95327e Remove dead package references. 2018-06-10 18:16:40 -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
Steve C
0e945915b7 Fixes various documentation errors/inconsistencies
Mostly dealing with permissions, also fixes Raw Events inclusion.
2018-05-18 20:25:54 -04:00