This adds the following information.
* `PartialInviteGuild` to replace `Object` patching
* `PartialInviteChannel` to replace `Object` patching
* Invite.approximate_member_count and Invite.approximate_presence_count
The new partial objects provide better documentation on what is
expected when you fetch random invites.
Fixes#1830
Use bare raise statement when reraising the exception that occured, and
remove unused exception variables. Also remove a pointless exception
handler in discord.opus.
This time with less bugs. It turned out that the crash was due to a
synchronisation issue between the pending reads and the actual shard
polling mechanism.
Essentially the pending reads would be cancelled via a simple bool but
there would still be a pass left and thus we would have a single
pending read left before or after running the polling mechanism and
this would cause a race condition.
Now the pending read mechanism is properly waited for before returning
control back to the caller.
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
Raise after loop completes without returning with most recent values
for r, data. This is a bit less fragile than checking tries < 4, since
changing the retry count requires changing values in multiple places.
(There seemed to already be handling in the 502 retry, tries <= 5,
which always evaluated to true, e.g.)
Previously, once out of retries, we would always return None without
raising.
This won't NameError so long as we make at least one HTTP request.