discordrb 3.2.0.1 → 3.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d481e5416bf7291ce7caf55bb4dd569bed5d3c24
4
- data.tar.gz: e7b1c76a69dbf8f45ef0f5c5c3ff644064c2c7e7
3
+ metadata.gz: 4939129e8cf010565fc013b55fe508b4deca321d
4
+ data.tar.gz: dbd591ca56690a5f84bb9c16e16decc80a2bb04e
5
5
  SHA512:
6
- metadata.gz: 76539fe4f6a7111c82082c36f00b3db680df5b9b177db85a90f3f08603a7c118a2731008d6167512c9ae8639a50d284c708c814f2955b1ddb23021a7a7f6fa8c
7
- data.tar.gz: 85c3eb941d435a1f2b4d10b991659e35c90924d7b7f120bd5c10e792b93e072e76d63c05adaa629b4a09437a53aba458fe7aab68aa14f96326481b9f555204f6
6
+ metadata.gz: 30a433b6b450baee30a4f49521c88c5cd2888cccbda0a1a1c5bece024e8520cda5f430fc0802c16e1f146e3550e1e00a715b796c569f9d080f19f5bad35c73c4
7
+ data.tar.gz: 67f13b1e9a5bf1037f531778c9a7c9051f27fafd608e1c02abf3c19c5d1c1390b647cd669851d29c4407cd30ac858de552ab318bd24962c7d9b6374e8e6a2187
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.2.1
4
+
5
+ - `Bot#stop` and `Gateway#stop` now explicitly return `nil`, for more convenient use in commands
6
+ - The API method to query for users has been removed as the endpoint no longer exists
7
+ - Some more methods have been changed to resolve IDs, which means they can be called with integer and string IDs instead of just the objects ([#313](https://github.com/meew0/discordrb/pull/313), thanks @LikeLakers2)
8
+ - Bulk deleting now uses the new non-deprecated URL – this has no immediate effect, but once the old one will be removed bots using it will not be able to bulk delete anymore (see also [#309](https://github.com/meew0/discordrb/issues/309))
9
+ ### Bugfixes
10
+
11
+ - Fixed another bug with resumes that caused issues when resuming a zombie connection
12
+ - Fixed a bug that caused issues when playing short files ([#326](https://github.com/meew0/discordrb/issues/316))
13
+
3
14
  ## 3.2.0.1
4
15
 
5
16
  - Attempt to fix an issue that causes a strange problem with dependencies when installing discordrb
data/README.md CHANGED
@@ -29,7 +29,7 @@ See also: [Documentation](http://www.rubydoc.info/gems/discordrb), [Tutorials](h
29
29
 
30
30
  This section only applies to you if you want to use voice functionality.
31
31
  * [libsodium](https://github.com/meew0/discordrb/wiki/Installing-libsodium)
32
- * A compiled libopus distribution for your system, anywhere the script can find it (on Windows, make sure it's named `opus.dll`)
32
+ * A compiled libopus distribution for your system, anywhere the script can find it. See [here](https://github.com/meew0/discordrb/wiki/Installing-libopus) for installation instructions.
33
33
  * [FFmpeg](https://www.ffmpeg.org/download.html) installed and in your PATH
34
34
 
35
35
  In addition to this, if you're on Windows and want to use voice functionality, your installed Ruby version **needs to be 32 bit**, as otherwise Opus won't work.
@@ -128,7 +128,7 @@ module Discordrb::API::Channel
128
128
  :channels_cid_messages_bulk_delete,
129
129
  channel_id,
130
130
  :post,
131
- "#{Discordrb::API.api_base}/channels/#{channel_id}/messages/bulk_delete",
131
+ "#{Discordrb::API.api_base}/channels/#{channel_id}/messages/bulk-delete",
132
132
  { messages: messages }.to_json,
133
133
  Authorization: token,
134
134
  content_type: :json
@@ -2,18 +2,6 @@
2
2
  module Discordrb::API::User
3
3
  module_function
4
4
 
5
- # Returns users based on a query
6
- # https://discordapp.com/developers/docs/resources/user#query-users
7
- def query(token, query, limit = nil)
8
- Discordrb::API.request(
9
- :users,
10
- nil,
11
- :get,
12
- "#{Discordrb::API.api_base}/users?q=#{query}#{"&limit=#{limit}" if limit}",
13
- Authorization: token
14
- )
15
- end
16
-
17
5
  # Get user data
18
6
  # https://discordapp.com/developers/docs/resources/user#get-user
19
7
  def resolve(token, user_id)
@@ -2513,10 +2513,10 @@ module Discordrb
2513
2513
  end
2514
2514
 
2515
2515
  # Forcibly moves a user into a different voice channel. Only works if the bot has the permission needed.
2516
- # @param user [User] The user to move.
2517
- # @param channel [Channel] The voice channel to move into.
2516
+ # @param user [User, #resolve_id] The user to move.
2517
+ # @param channel [Channel, #resolve_id] The voice channel to move into.
2518
2518
  def move(user, channel)
2519
- API::Server.update_member(@bot.token, @id, user.id, channel_id: channel.id)
2519
+ API::Server.update_member(@bot.token, @id, user.resolve_id, channel_id: channel.resolve_id)
2520
2520
  end
2521
2521
 
2522
2522
  # Deletes this server. Be aware that this is permanent and impossible to undo, so be careful!
@@ -2530,9 +2530,9 @@ module Discordrb
2530
2530
  end
2531
2531
 
2532
2532
  # Transfers server ownership to another user.
2533
- # @param user [User] The user who should become the new owner.
2533
+ # @param user [User, #resolve_id] The user who should become the new owner.
2534
2534
  def owner=(user)
2535
- API::Server.transfer_ownership(@bot.token, @id, user.id)
2535
+ API::Server.transfer_ownership(@bot.token, @id, user.resolve_id)
2536
2536
  end
2537
2537
 
2538
2538
  # Sets the server's name.
@@ -184,6 +184,9 @@ module Discordrb
184
184
  def stop(no_sync = false)
185
185
  @should_reconnect = false
186
186
  close(no_sync)
187
+
188
+ # Return nil so command bots don't send a message
189
+ nil
187
190
  end
188
191
 
189
192
  # Kills the websocket thread, stopping all connections to Discord.
@@ -395,9 +398,6 @@ module Discordrb
395
398
  # Make sure to reset ACK handling, so we don't keep reconnecting
396
399
  @last_heartbeat_acked = true
397
400
 
398
- # If we suspended the session before because of a reconnection, we need to resume it now
399
- @session.resume if @session && @session.suspended?
400
-
401
401
  # We don't want to have redundant heartbeat threads, so if one already exists, don't start a new one
402
402
  return if @heartbeat_thread
403
403
 
@@ -686,8 +686,13 @@ module Discordrb
686
686
  setup_heartbeats(interval)
687
687
 
688
688
  LOGGER.debug("Trace: #{packet['d']['_trace']}")
689
+ LOGGER.debug("Session: #{@session.inspect}")
689
690
 
690
691
  if @session && @session.should_resume?
692
+ # Make sure we're sending heartbeats again
693
+ @session.resume
694
+
695
+ # Send the actual resume packet to get the missing events
691
696
  resume
692
697
  else
693
698
  identify
@@ -3,5 +3,5 @@
3
3
  # Discordrb and all its functionality, in this case only the version.
4
4
  module Discordrb
5
5
  # The current version of discordrb.
6
- VERSION = '3.2.0.1'.freeze
6
+ VERSION = '3.2.1'.freeze
7
7
  end
@@ -193,13 +193,13 @@ module Discordrb::Voice
193
193
  raise IOError, 'File or stream not found!' if @first_packet
194
194
 
195
195
  @bot.debug('EOF while reading, breaking immediately')
196
- break
196
+ next :stop
197
197
  end
198
198
 
199
199
  # Check whether the buffer has enough data
200
200
  if !buf || buf.length != DATA_LENGTH
201
201
  @bot.debug("No data is available! Retrying #{@retry_attempts} more times")
202
- break if @retry_attempts.zero?
202
+ next :stop if @retry_attempts.zero?
203
203
 
204
204
  @retry_attempts -= 1
205
205
  next
@@ -272,7 +272,7 @@ module Discordrb::Voice
272
272
 
273
273
  unless header_str
274
274
  @bot.debug 'Finished DCA parsing (header is nil)'
275
- break
275
+ next :stop
276
276
  end
277
277
 
278
278
  header = header_str.unpack('s<')[0]
@@ -280,7 +280,7 @@ module Discordrb::Voice
280
280
  raise 'Negative header in DCA file! Your file is likely corrupted.' if header < 0
281
281
  rescue EOFError
282
282
  @bot.debug 'Finished DCA parsing (EOFError)'
283
- break
283
+ next :stop
284
284
  end
285
285
 
286
286
  # Read bytes
@@ -323,6 +323,11 @@ module Discordrb::Voice
323
323
 
324
324
  # Get packet data
325
325
  buf = yield
326
+
327
+ # Stop doing anything if the stop signal was sent
328
+ break if buf == :stop
329
+
330
+ # Proceed to the next packet if we got nil
326
331
  next unless buf
327
332
 
328
333
  # Track intermediate adjustment so we can measure how much encoding contributes to the total time
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: 3.2.0.1
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - meew0
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client