185 Commits

Author SHA1 Message Date
Rapptz
5cb3ad14e8 Make emojis and members stateful. 2017-01-03 09:51:55 -05:00
Rapptz
a7a60e433b Make roles and guilds stateful. 2017-01-03 09:51:55 -05:00
Rapptz
d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -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
31229a53e9 Optimise VoiceState for memory.
Instead of storing one VoiceState per Member, only store them if
necessary. This should bring down the number of instances
significantly.
2017-01-03 09:51:47 -05:00
Rapptz
044b0824e6 Begin working on the rewrite. 2017-01-03 09:51:47 -05:00
Rapptz
a8264f6540 Chunk every guild if it's a user bot.
This also increases the timeout for chunking by 30 seconds for every
chunk we're waiting for.
2016-12-24 17:32:20 -05:00
Rapptz
bed2e90e82 Properly propagate loop. Fixes #420. 2016-12-21 00:06:19 -05:00
Rapptz
a0f4ad36eb Timeout waiting for chunking.
Sometimes the bot would keep waiting for chunks that somehow finished
before getting to the `wait` call. This is more so a temporary fix
rather than a fully correct one.
2016-12-16 21:28:12 -05:00
khazhyk
c8fd8a9e1a Fix crash on duplicate or out of order reactions.
Eventual consistency ftw
2016-11-30 16:47:00 -05:00
Rapptz
92c3c2804d Support MESSAGE_REACTION_REMOVE_ALL event. 2016-11-21 02:49:50 -05:00
khazhyk
8bd242f00b Fix crash on reaction remove.
Discord can sometimes send integer 0 as the emoji id instead of
null to signify a non-custom emoji, which was causing a crash due
to a 'is not None' check assuming the reaction was for an emoji
with id 0. Probably a discord bug, but preferable to handle here
rather than crash users.
2016-11-05 21:46:07 -07:00
Rapptz
12a3403af3 Change reaction events signature and name.
This changes the event signature to be (reaction, user) instead of
(message, reaction, user) since the reaction data class already has
the message being reacted to as a member.

The name was shortened from on_message_reaction_ to on_reaction_ since
the message prefix was deemed redundant.
2016-11-03 20:16:39 -04: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
Khazhismel
c5a989eeb2 Add custom emoji support. 2016-07-31 22:39:43 -07:00
Rapptz
b0e5357716 Fix voice state update issue in on_voice_state_update
Bug was caused to the shallow copy not copying over the VoiceState
information embedded into the copy. This would mean that when the event
is called, before and after voice state information is essentially
equivalent.

The solution to fix this is to also copy the VoiceState objects.
2016-07-23 05:18:56 -04:00
Rapptz
3cd9f80854 Fix bug where discriminators would not update in PRESENCE_UPDATE. 2016-07-21 01:09:12 -04:00
Rapptz
bd39c3ef45 Add utility properties to CallMessage to query information. 2016-07-15 23:42:53 -04:00
Rapptz
1c8ab25917 Add support for querying information about group calls. 2016-07-15 22:46:00 -04:00
Rapptz
91351a3238 Handle adding and removal of group members. 2016-07-15 22:03:22 -04:00
Rapptz
c7f99afe7e Handle private channel CHANNEL_CREATE better. 2016-07-15 21:34:39 -04:00
Rapptz
a128249b63 Add support for different message types and call message. 2016-07-13 20:11:18 -04:00
Rapptz
69c506d7ae Handle CHANNEL_UPDATE for group direct messages. 2016-07-13 17:23:35 -04:00
Rapptz
ddd3fd0a3d Begin working on gateway v6 changes.
The first batch of changes are related to channel types and group
direct messages. Support these first so READY begins parsing.
2016-07-13 00:10:16 -04:00
Rapptz
d87d11c5a6 Fix voice states being overwritten after a GUILD_SYNC.
This was a two-fold problem. The first of which involved the overwriting
of members during a GUILD_SYNC. Since we are requesting a chunk anyway,
we have all the member references we need without actually chunking. The
second problem came from the order. We were doing a GUILD_SYNC and then
doing the chunking requests. We should do the GUILD_SYNC after the
chunking in order to just update presences.
2016-06-28 19:07:56 -04:00
Rapptz
a1ae8fdb10 Handle MESSAGE_DELETE_BULK. 2016-06-22 06:15:52 -04:00
Rapptz
8b3617111a Support for v5 Gateway. 2016-06-22 05:00:08 -04:00
Rapptz
c97e5a17e6 Update positions when a role is added or removed. 2016-06-01 21:06:04 -04:00
Rapptz
5016f12079 Add Role.server attribute.
This breaks events that expected a server parameter for the role events.
2016-06-01 19:27:48 -04:00
Rapptz
8638ff4414 Update voice client main ws references when reconnecting. 2016-06-01 05:20:22 -04:00
Rapptz
e0a91df32b Add RESUME support. 2016-06-01 05:13:15 -04:00
Rapptz
bf650297a1 Only trigger on_voice_state_update if the member actually exists. 2016-05-20 19:22:22 -04:00
Rapptz
a31188c966 Fix bug where members leaving will stay in Channel.voice_members. 2016-05-20 19:21:06 -04:00
Rapptz
cf2bee5c43 Fix issue with Member.joined_at being None. 2016-05-10 06:04:44 -04:00
Rapptz
d9c780b8a8 Working multi-server voice support. 2016-05-01 20:54:13 -04:00
Rapptz
5e8c79bf76 Attempt to consistently sort of all Member.roles 2016-04-29 22:44:25 -04:00
Rapptz
ebaf74e784 Sort member.roles by ID but keep the default role in index 0.
This should make the events checking if `before` and `after` roles
are equivalent more sane for users.
2016-04-29 22:29:56 -04:00
Rapptz
133e8d3a44 Add support for server specific nicknames. 2016-04-29 06:39:21 -04:00
Rapptz
1c623ccf11 Begin working on gateway v4 support.
Bump websockets requirement to v3.1

Should be squashed...
2016-04-27 18:36:13 -04:00
Rapptz
8d7dd79673 Fix deadlock issue when joining large guilds. 2016-04-15 23:27:23 -04:00
Rapptz
7eb9a7dfdc Handle bot tag updates in GUILD_MEMBER_UPDATE. 2016-04-12 18:19:02 -04:00
Rapptz
7023b353f6 User JSON object has 'username' keys not 'name'. 2016-04-11 14:39:04 -04:00
Rapptz
6076c8c671 Better chunking behaviour and add members on PRESENCE_UPDATE.
This should hopefully cover all cases where members are added.
There was a bug where an array of chunks received would get entirely
processed if only a single chunk was received. This was fixed by
explicitly bailing early if we're requesting for chunks.
2016-04-11 14:24:15 -04:00
Khazhismel
84f1342b85 Fix chunk requests not actually being batched. 2016-04-11 11:53:54 -04:00
Rapptz
0401ab561b Proper chunking for unavailable guilds.
This will also delay on_ready until all chunking is complete.
2016-04-10 00:47:00 -04:00
Zeta
f235dc5ca4 Fix handling of message update in MESSAGE_UPDATE 2016-04-05 18:01:54 -04:00
Rapptz
8b7f15ef8d Skip member_update event when a member is not in a guild. 2016-04-02 23:38:45 -04:00
Rapptz
80587fc1e9 Change parsing of READY to be eager again. 2016-03-06 14:41:31 -05:00