174 Commits

Author SHA1 Message Date
Rapptz
b05d8790fc Allow using Reaction objects while adding or removing reactions. 2017-04-21 17:32:09 -04:00
Rapptz
83649d7f0a Support for new member message types. 2017-04-21 03:49:05 -04:00
Rapptz
1fc08bc5a2 Remove unused imports. 2017-04-18 04:22:35 -04:00
Rapptz
51b0baeb9d Speed up message update handling.
Apparently, checking if something is not None and then calling it is
faster than having an identity function that will just return the
original value untransformed, such as a lambda or doing a str(str) call
2017-03-14 19:12:30 -04:00
Rapptz
c089aa199b Remove Message.edited_timestamp in favour of Message.edited_at 2017-03-14 19:07:08 -04:00
Rapptz
9a1215e13b Add support for message acking. 2017-02-27 23:29:52 -05:00
Rapptz
c8250d7cd5 Fix bug with Message.role_mentions always being empty. 2017-02-13 22:14:49 -05:00
Rapptz
926f01f0b6 Call message edit handlers after attempting to patch individual fields 2017-02-09 06:29:57 -05:00
Rapptz
3504de4635 Fix more places where server is used instead of guild in docstrings. 2017-02-08 22:51:40 -05:00
Rapptz
01c17704bc Remove unused Message._handle_upgrades function. 2017-01-29 20:41:53 -05:00
Rapptz
b27fab09eb Allow removing an embed in Message.edit 2017-01-29 20:32:24 -05:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
92dd519b1a Remove _get_guild_id from Messageable ABC. 2017-01-14 19:22:26 -05:00
Rapptz
98b981848d Move message creation to a factory method inside ConnectionState. 2017-01-03 09:52:10 -05:00
Rapptz
5e6bfecb07 Move away from StateContext and use ConnectionState directly. 2017-01-03 09:52:10 -05:00
Rapptz
dceba9d962 Add useful repr to all data classes. 2017-01-03 09:52:06 -05:00
Rapptz
ec6c7f8b34 Fix handling of author update and missing type attribute in Message. 2017-01-03 09:52:05 -05:00
Rapptz
79a49f9145 Absolute import some circular dependencies to appease Python 3.4. 2017-01-03 09:52:02 -05:00
Rapptz
802f6c91d4 Add Message.clear_reactions 2017-01-03 09:52:00 -05:00
Rapptz
c205eb3528 Re-add support for embeds. 2017-01-03 09:51:58 -05:00
Rapptz
42891c3084 Make Message.embeds to be based on discord.Embed 2017-01-03 09:51:58 -05:00
Rapptz
c187d87dae Re-add support for reactions.
We now store emojis in a global cache and make things like adding
and removing reactions part of the stateful Message class.
2017-01-03 09:51:57 -05:00
Rapptz
59a0df5f98 Rename try_insert_user to store_user 2017-01-03 09:51:56 -05:00
Rapptz
d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -05:00
Rapptz
f33eaa4a61 Stateful Message and remove Invite.xkcd since it is removed. 2017-01-03 09:51:53 -05:00
Rapptz
53ab263125 Split channel types.
This splits them into the following:

* DMChannel
* GroupChannel
* VoiceChannel
* TextChannel

This also makes the channels "stateful".
2017-01-03 09:51:52 -05:00
Rapptz
45c729b167 Switch IDs to use int instead of str 2017-01-03 09:51:49 -05:00
Rapptz
aa8a328f0a Remove Message.timestamp and make Message.channel_mentions lazy.
Message.timestamp is replaced with Message.created_at. This commit
also affects how MESSAGE_UPDATE is handled by only assuming that two
keys are provided rather than overwriting data with missing keys.
2017-01-03 09:51:48 -05:00
Rapptz
044b0824e6 Begin working on the rewrite. 2017-01-03 09:51:47 -05:00
khazhyk
4d87b2f817 Inject full Emoji to Reaction if we have it.
Reaction objects with custom Emoji are partial. If we know of this Emoji
(can find it on this client) then inject it. Otherwise, leave it as a
hollow Emoji. We can still react with a hollow Emoji, but can't get other
metadata about it.
2016-11-03 04:39:45 -04:00
khazhyk
c4acc0e1a1 Add support for reactions.
Reactions can be be standard emojis, or custom server emojis.

Adds
 - add/remove_reaction
 - get_reaction_users
 - Messages have new field reactions
 - new events - message_reaction_add, message_reaction_remove
 - new permission - add_reactions
2016-10-27 21:36:32 -07:00
Rapptz
da986b2d7c Support for pinned system messages. 2016-09-12 20:22:53 -04:00
Rapptz
bd39c3ef45 Add utility properties to CallMessage to query information. 2016-07-15 23:42:53 -04:00
Rapptz
33eba31aac Fix the displaying of Message.system_content 2016-07-15 22:11:56 -04:00
Rapptz
a128249b63 Add support for different message types and call message. 2016-07-13 20:11:18 -04:00
Rapptz
01a46f0612 Make Message.channel_mentions unique. 2016-06-27 21:44:29 -04:00
Rapptz
b3edb31df5 Add support for message pinning.
This includes `Client.pin_message`, `Client.unpin_message` and
`Client.pins_from`. This also adds the `Message.pinned` attribute
to the `Message` object.
2016-06-18 02:14:44 -04:00
Rapptz
5fa715c350 Fix typo in Message.role_mentions documentation. 2016-05-01 07:34:48 -04:00
Rapptz
79f6554289 Add Message.role_mentions and handle them in Message.clean_content 2016-04-29 07:54:49 -04:00
Rapptz
54e9be7aed Message.clean_content now takes into consideration @here mentions. 2016-04-23 02:13:33 -04:00
Rapptz
e64787a415 Guard against AttributeErrors when clearing cached slot cache. 2016-04-05 18:22:44 -04:00
Rapptz
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
Zeta
f235dc5ca4 Fix handling of message update in MESSAGE_UPDATE 2016-04-05 18:01:54 -04:00
Rapptz
c2ffff1549 Fix bug where @everyone usernames bypass Message.clean_content. 2016-03-02 23:30:09 -05:00
Rapptz
085e8d4eb3 Message.clean_content now handles everyone mentions properly. 2016-01-30 06:17:20 -05:00
Steven Berler
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
Rapptz
5ca13cac8e Add Message.nonce attribute. 2016-01-07 02:06:11 -05:00
Rapptz
89a418a388 Add __slots__ for missing classes that didn't have it. 2016-01-06 23:40:20 -05:00
Rapptz
db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
Rapptz
33dbd84398 Message no longer upgrades if the channel is an Object 2015-12-29 01:20:36 -05:00