94 Commits

Author SHA1 Message Date
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
Rapptz
0dafdedc65 abc.GuildChannel.set_permissions can raise NotFound.
Fix #1254
2018-05-18 20:17:49 -04:00
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Rapptz
f86ac47b28 Don't use Bulk Channel Edit endpoint if not actually moving channels.
Should make the category-only edit cases more straightforward since
it does not rely on other guilds in the cache, outside of the category
itself.
2017-09-24 04:55:10 -04:00
Rapptz
458cb83b47 Properly handle cases where a category is removed. 2017-09-21 22:15:47 -04:00
Steve C
233c2d80ef Fix grammar in abc docs, add new implementation 2017-09-13 13:54:09 -04:00
Rapptz
53b4890435 Add category support.
This adds:

* CategoryChannel, which represents a category
* Guild.by_category() which traverses the channels grouping by category
* Guild.categories to get a list of categories
* abc.GuildChannel.category to get the category a channel belongs to
* sync_permissions keyword argument to abc.GuildChannel.edit to sync
  permissions with a pre-existing or new category
* category keyword argument to abc.GuildChannel.edit to move a channel
  to a category
2017-09-13 09:44:36 -04:00
Rapptz
63231ef033 Remove reason keyword argument from message deletion.
Apparently this is unsupported.

Affected functions include:

* abc.Messageable.send
* Message.delete
* TextChannel.delete_messages
* TextChannel.purge
2017-08-15 22:38:43 -04:00
SinisterRectus
8acf3d01ce Remove GuildChannel.is_default 2017-08-08 17:31:09 -04:00
Gorialis
1582116b72 Add documentation examples for AsyncIterator and change_presence. 2017-08-08 17:31:08 -04:00
Rapptz
c2544b9101 Handle everyone role having top priority in permission resolution.
In Discord, if the @everyone role has an explicit allow but a later
role has an explicit deny, the permission is denied rather than allowed
despite the fact that on Discord, allows have a higher priority than
denies.

This is because the @everyone role is supposed to be the first role to
be applied, while the rest could be applied in an aggregate fashion.

Fixes #630.
2017-07-07 17:53:38 -04:00
Rapptz
e0f02f1775 Rename AsyncIterator.get to next to prevent shadowing. 2017-07-04 10:45:38 -04:00
BeatButton
1be119cd45 Allow sending files list smaller than 2 elements in Messageable.send
The previous restriction was unwarranted.
2017-06-07 20:07:43 -04:00