Commit Graph

632 Commits

Author SHA1 Message Date
1c623ccf11 Begin working on gateway v4 support.
Bump websockets requirement to v3.1

Should be squashed...
2016-04-27 18:36:13 -04:00
5a2b8e2ce6 Properly close session if client failed to start
`keep_alive` was not defined until it was created in `received_message`, `ws` is `None` until its actually connected, which doesn't always happen.  If an error happens before things start up properly, the client should now clean its objects up (fixes `unclosed client session` warning).
2016-04-22 22:40:25 -04:00
8d7dd79673 Fix deadlock issue when joining large guilds. 2016-04-15 23:27:23 -04:00
03862a7145 Add a None check when setting status in Client.change_status. 2016-04-14 20:38:13 -04:00
7adf761a35 Retry if send_message or edit_message encounter a 502. 2016-04-14 13:16:27 -04:00
53bc9a3007 Yield from parser coroutine instead of making it a task.
This should give us a bit better sequential message processing.
2016-04-12 18:18:03 -04:00
5c407df2b7 Fix Client.login documentation to showcase email/password login. 2016-04-11 14:30:44 -04:00
28b3d375e9 Check the right status code for improper token being passed. 2016-04-11 14:25:20 -04:00
29d3f5a886 Allow Client.edit_profile to work with bot accounts. 2016-04-09 21:42:26 -04:00
72e84a1b47 Change all email/password pair examples to use token. 2016-04-08 22:02:38 -04:00
93edf88ee4 Change login, start and run to be variadic. 2016-04-08 22:00:06 -04:00
222a89a653 Fix unclosed response and document token login a bit better. 2016-04-08 21:16:30 -04:00
7f340f88ad Add support for token login (for bots) 2016-04-08 21:11:22 -04:00
7dcf0c059c Clarify that Client.close is a coroutine. 2016-03-29 20:44:33 -04:00
78e2db1863 Add support for aiohttp connectors.
Fixes #98.
2016-03-07 17:54:51 -05:00
6694df268c Fix crashing when an unhandled event occurs. 2016-03-06 16:26:58 -05:00
425bd2c091 Move chunking logic back into ConnectionState.
This allows for a nicer design when dealing with parsers that could
end up being coroutines.
2016-03-06 05:24:18 -05:00
d4fa60e1cf Ensure the auth cache file is not world readable. 2016-03-02 23:26:04 -05:00
489363f5f8 Switch URLs from Client.delete_server and Client.leave_server. 2016-02-23 19:01:04 -05:00
87f7fced24 Add Client.delete_server. 2016-02-23 18:59:44 -05:00
89de0e7e9f Client.send_file can now send content along with the message.
There is a breaking change here. We have to change the filename
parameter to be a keyword only argument so there are fewer errors
and surprises.
2016-02-18 19:41:48 -05:00
3ec99a7cb8 Fix NameError issue in Client.send_file. 2016-02-17 21:24:40 -05:00
ff14fa0fe8 Switch to using ClientSession objects for aiohttp v0.21 2016-02-15 19:49:30 -05:00
0b80575ae3 Fix case when no chunks are necessary. 2016-02-14 21:51:49 -05:00
4584c68f0c Remove request_offline option. 2016-02-14 21:49:34 -05:00
4768d950c5 Offline members are now added by default automatically.
This commit adds support for GUILD_MEMBERS_CHUNK which had to be done
due to forced large_threshold requirements in the library.
2016-02-14 19:24:26 -05:00
f9a3979008 Update member references when status changes. 2016-01-30 04:36:32 -05:00
e2c9cb7f8e Force content-type for file uploads. 2016-01-29 00:25:54 -05:00
8b1854e759 Add and remove some of the on_socket_* events.
on_socket_raw_receive and on_socket_raw_send were added back in an odd
way. The rest of them such as on_socket_closed, on_socket_opened, and
on_socket_receive were removed.
2016-01-25 01:55:31 -05:00
e7931eccc8 Support changing owners in Client.edit_server. 2016-01-22 18:12:09 -05:00
99749a2798 Change docstring for Client.send_message to point to a valid property. 2016-01-18 17:45:53 -05:00
8de55fa203 Update voice channel if we move to different channels. 2016-01-17 18:34:40 -05:00
26e9b79a2d Fix IndexError in Client.move_member. 2016-01-15 01:48:43 -05:00
dca3b52e5d Client.invites_from now returns a list instead of a generator.
The old syntax is a bit awkward to use and has little benefit in this
case. This is a breaking change.
2016-01-14 15:45:37 -05:00
d33d0bed69 Add support for async for in Client.logs_from.
This is a breaking change. Code will still work in Python 3.4 as-is but
if you use Python 3.5 you will have to change your code to the new
`async for` syntax as the older version is not supported in 3.5.

On the other hand, this comes with performance improvements if you use
Python 3.5 as it will lazily load 100 message chunks on an as needed
basis rather than loading all messages in one go.
2016-01-14 15:42:56 -05:00
2c31c466b2 Fix Client.remove_roles to actually remove roles. 2016-01-10 03:19:41 -05:00
af94179be5 Change order of documentation by source declaration. 2016-01-08 19:19:53 -05:00
a1a47c6f38 Document the breaking change with the new dictionary storage change.
Since the only things dict views support are iteration we should
advise people who want the old behaviour to change it to a list.
2016-01-08 14:04:58 -05:00
6d5175ad9a Document how Client.run should be the last function to call. 2016-01-08 13:31:03 -05:00
777b5a09e2 document public get_ methods and make others private 2016-01-08 13:24:56 -05:00
10b0b62f50 performance improvements
Replaced server member lists, channel lists, and private channel lists
with dicts. This allows O(1) lookups and removes (previously it would be
an O(N) operation to lookup or remove). I did pretty extensive testing
and benchmarking to compare the performance of using lists vs using
dicts. Iterating through lists to find an item is only faster in the
average case for extremely small lists (less than 3 items). For 100
items, using a dict is about 10 times faster on average (and about 100
times faster for 1000 items). The overhead in dicts is in memory usage
and initial creation time. Creating and populating a dict is about 2 to
3 times slower than creating and appending items to a list. However this
cost is still tiny.  For 1000 items this equates to about a 70
microsecond difference (on an i7 CPU) for populating the entire dict.
The memory overhead for a dict (compared to a list) is about 25-60 KB
per 1000 items (can vary depending on dict resizing).

Originally I wanted to use OrderedDicts to presereve order, but in my
testing OrderedDicts have about 6x the memory overhead compared to
normal dicts.
2016-01-08 13:24:55 -05:00
5ca13cac8e Add Message.nonce attribute. 2016-01-07 02:06:11 -05:00
e88bc28236 Documentation fixes to quiet Sphinx warnings. 2016-01-07 00:21:00 -05:00
db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
97874293e2 Revert "Use super() in classes that could be subclassed."
This reverts commit 948f565b43.
2016-01-04 20:26:59 -05:00
948f565b43 Use super() in classes that could be subclassed. 2016-01-04 18:25:20 -05:00
5a1d7a2d94 Change permissions to remove the can_ prefix. 2016-01-03 21:45:28 -05:00
46be218394 Remove print statement from bytes check. 2016-01-01 21:09:56 -05:00
080b8119ad Implement compressed READY 2016-01-01 21:08:43 -05:00
6d94e68c7a Actually send the payload data in Client.create_server 2015-12-31 20:57:53 -05:00