1333 Commits

Author SHA1 Message Date
Ethan
7ee63a26f0 Fix docstring 2017-08-22 04:45:52 -04:00
Steve C
7ee5dc22fb Fix a couple docstrings 2017-08-22 04:45:52 -04:00
Rapptz
8eb6fa0329 Fix multi-part sending with aiohttp in webhooks. 2017-08-22 00:26:43 -04:00
Rapptz
754f3a2ae9 Don't make session a keyword only argument. 2017-08-21 14:57:57 -04:00
Rapptz
84f38b166e Add atomic keyword argument for member role editing operations.
This affects:

* Member.add_roles
* Member.remove_roles

This is the main attempt of fixing long standing bugs like #56. Since
cache consistency is too hard to ask for due to eventual consistency
and this generally being one of the only main roadblocks that the
cache ruins, it's best to just implement it in terms of the atomic
endpoint instead.

Fixes #56
2017-08-21 10:40:33 -04: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
Rapptz
f1e59ea933 Game objects are really dumb. 2017-08-21 02:49:49 -04:00
Rapptz
b5d987347a Fix some docstrings. 2017-08-21 02:11:00 -04:00
Rapptz
310cb05040 Fix Webhook.execute alias. 2017-08-21 02:04:44 -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
deaba1f5ab Use time.monotonic instead of time.time for heartbeat code. 2017-08-19 22:15:29 -04:00
Rapptz
1c60f9ccf4 Consume remaining keyword arguments in Game constructor. 2017-08-19 12:10:48 -04:00
Rapptz
9a0e9b0494 Update system_content strings for MessageType.new_member. 2017-08-17 18:36:10 -04:00
Rapptz
3b3b8a5150 Remove incorrect extraneous usage of reason keyword argument.
Fixes #726
2017-08-17 18:20:28 -04:00
Rapptz
13c6a0a17a Add support for Guild.system_channel 2017-08-17 18:14:52 -04:00
Rapptz
b8c19954e4 Add default type for Game.
Good meme.
2017-08-16 19:36:17 -04:00
Ashton Tito
e0f733a5c1 use cdn url for custom emojis 2017-08-16 07:10:48 -04:00
Gorialis
80586cb081 Minor fixes in migrating doc 2017-08-16 07:09:06 -04:00
Rapptz
0f7482ed6e Add Client.latency, AutoShardedClient.latency and latencies.
This should allow an easier way to query the Discord protocol gateway
latency, defined by the difference HEARTBEAT_ACK between and the last
sent HEARTBEAT.
2017-08-15 23:41:11 -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
MysterialPy
adf99eb2cd Add delete_after to 'edit'.
Allow for edited messages to be deleted after [float] seconds with optional parameter delete_after.
2017-08-15 20:05:48 -04:00
Rapptz
d8360411ea Fix cases where user_id can be None in audit logs. 2017-08-15 06:12:57 -04:00
Rapptz
fce2ef5534 [commands] Raise when an invalid prefix is given.
Fixes #712
2017-08-15 06:12:09 -04:00
Rapptz
434d6dc347 Fix extraneous parentheses in Client.emojis render in migrating docs. 2017-08-12 18:41:21 -04:00
PapyrusThePlant
0d21e83b7f Fix the proxy support for aiohttp>=1.4. 2017-08-11 16:44:15 +02:00
Rapptz
eb673ec2af [commands] Ensure no mentions escape clean_content
Some clever nicknames or role names would lead themselves to
resolving to pings.
2017-08-10 03:17:24 -04:00
Rapptz
cb709cc9da [commands] Fix clean_content converter not properly escaping mentions.
In some cases, the Discord provided role_mentions and mentions array
would be empty, such as wrapping a mention with a backtick or
other frivolous characters. Since we want to completely nullify
mentions, we should not rely on the Discord provided arrays and instead
use and resolve the IDs from the content itself.
2017-08-10 02:46:00 -04:00
Rapptz
be1cffb7c3 Support for discord.Object in Member.remove_roles and Member.add_roles 2017-08-09 18:41:54 -04:00
Rapptz
f554861e68 Make discord.Object hashable. 2017-08-09 18:39:32 -04:00
Mitchell Ferree
ecdd21212c Disallow setting non-permission attributes 2017-08-08 22:19:59 -04:00
Rapptz
de65f7309b Add heartbeat_timeout to the Client options.
This setting configures how long before a timeout event is emitted
internally and disconnects the websocket. Since some users were
experiencing issues with the gateway not responding, this should help
mitigate the issue for those with poor PCs.
2017-08-08 21:12:04 -04:00
Rapptz
ceafae0ab2 Add DiscordWebSocket.latency to measure discord heartbeat latency. 2017-08-08 20:35:42 -04:00
Matt Gardner
f490afa5dc Fixed ExponentialBackoff not working when integral 2017-08-08 17:31:09 -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
Gorialis
20fae90a08 Add operation documentation for VerificationLevel, ContentFilter 2017-08-02 01:38:15 +09:00
Gorialis
934456035e Change VerificationLevel, ContentFilter to be IntEnums 2017-08-02 01:24:05 +09:00
Rapptz
e493f1f2f4 Remove Guild.create_invite too since it relies on a default channel. 2017-07-31 21:39:48 -04:00
Rapptz
3dc1195637 Remove Guild.default_channel
The concept no longer exists.
2017-07-31 21:32:12 -04:00
Rapptz
9cfa39a1c7 Fix AsyncIterator documentation to properly show coroutines. 2017-07-29 15:26:02 -04:00
Rapptz
51a39b5b1c Rename avatar_is_animated to is_avatar_animated and make it a method. 2017-07-27 06:26:00 -04:00
Rapptz
fe3b917564 Continue connection loop with back-off if connecting fails >5 times. 2017-07-25 20:00:00 -04:00
khazhyk
0a588fac1c allow trailing null bytes in uploaded jpegs 2017-07-25 06:09:41 -04:00
khazhyk
2c4876f2e7 add Guild.icon_url_as
Guild icons can also be up to 1024px, jpg, png, or webp
2017-07-25 06:09:41 -04:00
khazhyk
12ca0d9b16 avatar_url_as improvements
static_format will only apply to static (not animated) avatars. Makes
it easier to grab gif-or-'format' of an avatar. Defaults to 'webp'

This is for a similar usecase to avatar_url_as(format=None), except
one can specify the non-animated format, instead of always using
webp.

add User.avatar_is_animated property.

add validation for avatar_url_as, since invalid arguments result in
a url which will return 415, which can be confusing for a user. (They
just see a blank page)

Discord accepts size=16-2048, but images cap at 1024px, so accept 16-1024
Discord accepts "jpg", "jpeg", "png", "gif", and "webp", *unless* the
avatar is not animated, in which case "gif" is not supported. :\
2017-07-25 06:09:40 -04:00
Juan
ea0c37b538 accept_invite() doesn't exist on rewrite 2017-07-25 06:58:42 -03:00
khazhyk
f1e08cccac Add bulk argument to TextChannel.purge
bulk=False will never use bulk message delete. Useful e.g. for
using the purge interface for deleting the bot's own messages.
2017-07-24 00:11:05 -04: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
khazhyk
2850995062 Retry on 500 in HTTPClient.request
Discord official client retries on 500, so worst case scenario, we're
not any worse than the official client which seriously outnumbers us.
2017-07-22 20:10:25 -07:00
Daniel
b532da7906 Fix waiting for resume when calling stop() on AudioPlayer 2017-07-21 18:37:22 -04:00