Commit Graph
118 Commits
Author SHA1 Message Date
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 dea3ba5eb7 Propagate Cloudflare 429 HTML text. 2019-03-31 05:44:00 -04:00
CapnSandCapnS 4ec7213506 Added functionality to edit user settings
Changing docs to fit other parts of the lib

Co-Authored-By: CapnS <38225872+CapnS@users.noreply.github.com>

Removing Type Checking

Made all of Rapptz's suggested changes

Removing imports that are no longer needed
2019-03-28 17:33:39 -04:00
Rapptz 548b9d5693 Double underscore HTTPClient's internal session. 2019-03-24 14:45:18 -04:00
NCPlayz 8a30a4cac0 Add support for guild widget 2019-03-19 09:22:48 -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
Rapptz 5e65ec978c Take back ownership of files from aiohttp for retrying requests.
Fix #1809
2019-03-18 07:54:36 -04:00
SnowyLumaandSnowyLuma 42a7c4f7e5 Add support for guild banners
Document banner attribute of Guild and Invite

Update discord/utils.py

Co-Authored-By: SnowyLuma <38926001+SnowyLuma@users.noreply.github.com>
2019-03-09 00:37:49 -05:00
Tarek1337 616616b847 Add support for guild descriptions 2019-03-08 21:45:43 -05:00
Rapptz df130e10f0 Prevent AttributeError when closing HTTPClient early. 2019-03-02 16:48:40 -05:00
Rapptz 48b60b2eac Prepare fix for aiohttp 4.0 breaking change with session creation. 2019-02-27 06:34:30 -05:00
Rapptz 5d78f43e55 Expose more information from partial invites, along with counts.
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
2019-02-12 20:22:47 -05:00
Toby Harradine 8586251089 Use non-deprecated method of acquiring lock 2019-02-06 01:52:56 -05:00
Dante Dam 9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Tyler febb8a965c Allow additional parameters on channel creation 2019-01-28 21:47:22 -05:00
Rapptz dec14faea9 Log rate limit hits into WARNING instead of INFO. 2018-12-27 08:25:51 -05:00
Rapptz 648e62031d Add support for explicit_content_filter in Guild.edit 2018-12-17 18:04:32 -05:00
CapnS 2c7c541f4e Added User.mutual_friends() 2018-12-14 19:05:33 -05:00
Rapptz 8b18fa307b Add support for default notification level in audit logs and Guild.edit 2018-11-25 01:42:33 -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 51d626eabe [lint] Remove redundant paranthesis
Remove redundant parenthisis around await expressions.  Left over from
f25091ef.
2018-11-24 22:17:58 -05:00
Hornwitser fa46b07db1 [lint] Rename exception variables to exc
Use the more explicit (and common) exc instead of e as the variable
holding the exception in except handlers.
2018-11-24 22:17:57 -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
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
mental ee57e89488 Added hypesquad house functionality 2018-08-22 22:01:19 -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 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 4aecdea052 Make TextChannel.create_webhook name parameter mandatory. 2018-07-20 04:17:28 -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
slice 9fe7776a33 Add support for getting individual ban entries 2018-05-07 16:42:04 -07:00
Rapptz 6782fdd34d Add missing coroutine decorator to HTTPClient.get_attachment
Fixes #1104
2018-02-26 18:55:05 -05:00
Rapptz da9828c41f Use the proper endpoint for removing your own reaction. 2017-12-21 19:20:48 -05:00
Rapptz 5c5a59c18e Add Client.clear to clear the bot's internal state to a clean slate.
In case you want to have some external restart loop.
2017-12-16 21:36:39 -05:00
Rapptz f0c53e4519 Fix URI quoting in Route. 2017-10-24 00:50:20 -04:00
Gorialis 6fc2b51dea Quote all Route params 2017-10-20 05:57:33 +09:00
Rapptz 47a58d354d Reimplement zlib streaming.
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.
2017-10-14 21:19:46 -04:00
Rapptz 92a37c2e4f Revert "Implement zlib streaming for the gateway."
This reverts commit 462191a08b.
2017-10-14 15:22:39 -04:00
Rapptz 462191a08b Implement zlib streaming for the gateway. 2017-10-12 22:53:20 -04:00
Rapptz 065f408a10 Move pre-emptive message to DEBUG log level. 2017-10-01 13:43:20 -04:00
Rapptz 711dfb83ab Allow creating a channel with a category. 2017-09-29 05:54:29 -04: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
Harmon 91e2163523 Fix typo in http.create_channel 2017-09-13 18:05:09 -05: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 63bca6604b Manually format reason parameter for kick and ban.
Related to: https://github.com/aio-libs/aiohttp/issues/2235
2017-08-30 17:58:53 -04:00
Rapptz 37b0fdb898 Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.

Fixes #704
2017-08-21 01:57:07 -04:00
Rapptz 13c6a0a17a Add support for Guild.system_channel 2017-08-17 18:14:52 -04:00
PapyrusThePlant 0d21e83b7f Fix the proxy support for aiohttp>=1.4. 2017-08-11 16:44:15 +02:00
khazhyk 62cdfbdbcd Raise in HTTPClient.request when out of retries
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.
2017-07-22 20:10:28 -07:00