Commit Graph

334 Commits

Author SHA1 Message Date
e64787a415 Guard against AttributeErrors when clearing cached slot cache. 2016-04-05 18:22:44 -04:00
dfd51b95d6 Make Message.clean_content a cached property again.
Instead, clear the cached properties so they will be re-cached when
invoked again.
2016-04-05 18:01:55 -04:00
f235dc5ca4 Fix handling of message update in MESSAGE_UPDATE 2016-04-05 18:01:54 -04:00
c2ffff1549 Fix bug where @everyone usernames bypass Message.clean_content. 2016-03-02 23:30:09 -05:00
085e8d4eb3 Message.clean_content now handles everyone mentions properly. 2016-01-30 06:17:20 -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
89a418a388 Add __slots__ for missing classes that didn't have it. 2016-01-06 23:40:20 -05:00
db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
33dbd84398 Message no longer upgrades if the channel is an Object 2015-12-29 01:20:36 -05:00
f1f0e169e4 Add __slots__ where appropriate to data classes. 2015-12-19 06:18:12 -05:00
613214f197 Add Message.clean_content property to get prettified mentions. 2015-12-17 00:15:41 -05:00
ebcb532c38 Change regex from \d+ to [0-9]+ for performance reasons.
\d+ includes unicode characters while [0-9]+ doesn't.
2015-12-16 23:46:02 -05:00
9f92536441 Clean-up documentation to use NumPy style docs on remaining classes. 2015-12-16 22:20:54 -05:00
de1c74a399 Make more things into properties.
A lot of the expensive getters were transformed into cached properties
instead. A lot of things that were properties were transformed into
properties as well.
2015-12-16 22:03:16 -05:00
c3e7ba3671 Message.channel's Object instance has an is_private attribute now.
This was to allow for basic checks such as message.channel.is_private
to succeed at the very least. It is a very small mitigation and not
perfect since it doesn't have every attribute that PrivateChannel
itself has. However you could retrieve the user info through the
Message.author attribute.
2015-11-28 23:06:23 -05:00
ed53f3fb3a Add caveat note about Message.mention_everyone 2015-11-28 22:35:53 -05:00
101d8d52b6 Add warning for Message.mentions order being non-deterministic. 2015-11-28 20:16:17 -05:00
acbbaa39ad Add Message.channel_mentions 2015-11-19 23:10:15 -05:00
da37ff16c1 Add get_raw_[channel_]mentions to Message 2015-11-19 23:01:43 -05:00
e88c194e9a Fix is_private check in mentions array handling. 2015-11-19 22:21:15 -05:00
692a6a3bc6 Fix ordering issue with Message.server 2015-11-18 20:04:27 -05:00
75658f46a2 Message.mentions now returns a list of Member instead of User 2015-11-16 21:18:30 -05:00
c49ff36a7b Make Message.channel an Object if something goes wrong.
Fixes #21
2015-10-27 17:21:08 -04:00
1a13f9ad30 Add Message.server attribute shortcut. 2015-10-23 17:41:28 -04:00
c8535f714e Documentation fixes for Message. 2015-10-21 21:09:01 -04:00
15b83b2743 Message.author is now either Member or User.
Closes #11.
2015-10-14 05:58:04 -04:00
b4e6591c9d Refactor parse_time into its own utils file. 2015-09-04 22:00:22 -04:00
b00ad4ad79 Use kwargs if the number of arguments needed is too many. 2015-09-04 21:16:27 -04:00
b7fc383013 Python3 import fixes. 2015-08-28 16:55:40 -04:00
de3bce2b32 Fix issue with some MESSAGE_UPDATE events. 2015-08-24 06:34:38 -04:00
b5a371812f Some documentation warning fixes. 2015-08-21 23:46:01 -04:00
2edd29684d Change the way timestamps are parsed. 2015-08-21 23:38:41 -04:00
3e0f09d32c Initial commit 2015-08-21 18:18:34 -04:00