discordrb 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of discordrb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/discordrb/api.rb +9 -0
- data/lib/discordrb/bot.rb +35 -1
- data/lib/discordrb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb4293a540d97b7c63609c9df1fbf4673f2572ea
|
4
|
+
data.tar.gz: 316bc0f2f6853ae080ded0ed26765c8051b8479a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 268cb865059b2b8931bf8179a080bd3bfed369464e02f919ae19f346f276439b69d490163677e79caea20985c0f8cdb5623f0b80100ca0a0ee98ec92ccc8af7b
|
7
|
+
data.tar.gz: 900ccc20679e0ea98a5eb0b9b4bbbfaf73f4fc893cecb4faaecb3364363e5c559ceac8bccc091e1646c165ca09e1595e1c4cb32c345e68a18dca56d790aab0cd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.6.5
|
4
|
+
* The bot will now request the users that would previously be sent all in one READY packet in multiple chunks. This improves startup time slightly and ensures compatibility with the latest Discord change, but it also means that some users won't be in server members lists until a while after creation (usually a couple seconds at most).
|
5
|
+
|
3
6
|
## 1.6.4
|
4
7
|
|
5
8
|
### Bugfixes
|
data/lib/discordrb/api.rb
CHANGED
@@ -172,6 +172,15 @@ module Discordrb::API
|
|
172
172
|
)
|
173
173
|
end
|
174
174
|
|
175
|
+
# Get a member's data
|
176
|
+
def member(token, server_id, user_id)
|
177
|
+
request(
|
178
|
+
:get,
|
179
|
+
"#{APIBASE}/guilds/#{server_id}/members/#{user_id}",
|
180
|
+
Authorization: token
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
175
184
|
# Create a channel
|
176
185
|
def create_channel(token, server_id, name, type)
|
177
186
|
request(
|
data/lib/discordrb/bot.rb
CHANGED
@@ -946,6 +946,8 @@ module Discordrb
|
|
946
946
|
|
947
947
|
if @prevent_ready && packet['t'] == 'READY'
|
948
948
|
debug('READY packet was received and suppressed')
|
949
|
+
elsif @prevent_ready && packet['t'] == 'GUILD_MEMBERS_CHUNK'
|
950
|
+
# Ignore chunks as they will be handled later anyway
|
949
951
|
else
|
950
952
|
debug("Received packet #{event.data}")
|
951
953
|
end
|
@@ -983,8 +985,39 @@ module Discordrb
|
|
983
985
|
# Make sure to raise the event
|
984
986
|
raise_event(ReadyEvent.new)
|
985
987
|
|
988
|
+
# Afterwards, send out a members request to get the chunk data
|
989
|
+
chunk_packet = {
|
990
|
+
op: 8,
|
991
|
+
d: {
|
992
|
+
guild_id: @servers.keys,
|
993
|
+
query: '',
|
994
|
+
limit: 0
|
995
|
+
}
|
996
|
+
}.to_json
|
997
|
+
@ws.send(chunk_packet)
|
998
|
+
|
986
999
|
# Tell the run method that everything was successful
|
987
1000
|
@ws_success = true
|
1001
|
+
when 'GUILD_MEMBERS_CHUNK'
|
1002
|
+
id = data['guild_id'].to_i
|
1003
|
+
members = data['members']
|
1004
|
+
|
1005
|
+
start_time = Time.now
|
1006
|
+
|
1007
|
+
members.each do |member|
|
1008
|
+
# Add the guild_id to the member so we can reuse add_guild_member
|
1009
|
+
member['guild_id'] = id
|
1010
|
+
|
1011
|
+
add_guild_member(member)
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
duration = Time.now - start_time
|
1015
|
+
|
1016
|
+
if members.length < 1000
|
1017
|
+
debug "Got final chunk for server #{id}, parsing took #{duration} seconds"
|
1018
|
+
else
|
1019
|
+
debug "Got one chunk for server #{id}, parsing took #{duration} seconds"
|
1020
|
+
end
|
988
1021
|
when 'MESSAGE_CREATE'
|
989
1022
|
create_message(data)
|
990
1023
|
|
@@ -1139,7 +1172,8 @@ module Discordrb
|
|
1139
1172
|
'$device': 'discordrb',
|
1140
1173
|
'$referrer': '',
|
1141
1174
|
'$referring_domain': ''
|
1142
|
-
}
|
1175
|
+
},
|
1176
|
+
large_threshold: 100
|
1143
1177
|
}
|
1144
1178
|
}
|
1145
1179
|
|
data/lib/discordrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discordrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meew0
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|