discordrb 1.7.0 → 1.7.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: 444d3ff3a3d9f6ead173e204baff8943bd5e6997
4
- data.tar.gz: 28672c3ca7bf371d173f7bb30f08d8e5fcdce310
3
+ metadata.gz: 0c3fe1d82b773f30ce3cd65fdb933734e0242356
4
+ data.tar.gz: 0c28cf978735af1868f3bec8a12c1ee2a12b5cac
5
5
  SHA512:
6
- metadata.gz: f7fee8556f251531d2091a42b2986b5e89008f2eee4f4677fda8e758e221eb310a3735e236ce1ee88dae1923fabc1984c2a229e46bc0b8b7fca28f6904638070
7
- data.tar.gz: 9ac7891121c7a7d196ad9a2ef032c642a0e21a5993f9cdbfc7db8ded7a409bcd470a7a7a8729dbcd3ed1458c9c1cd1dc9f0b5533674426f32d35b3dfe681676c
6
+ metadata.gz: 6f466e2de8b97084a729402eabb301442a27358c20ac362004fb8957ff93444b78a6207176104953f3cfe5d684c549e59801c8b400fbe9229d80e211d903db87
7
+ data.tar.gz: 667503328f7ccbd4430c0190790c5e07da68304031e7ef8b93c0f39ec51cc28c12f1762f2f8eeb89afd49140cb433becbde22df38cfb52e5642033a0bbd8cbaf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.1
4
+ * A `clear!` method was added to EventContainer that removes all events from it, so you can overwrite modules by defining them again. (It's unnecessary for CommandContainers because commands can never be duplicate.)
5
+
6
+ ### Bugfixes
7
+ * The tokens will now be verified correctly when obtained from the cache. (I messed up last time)
8
+ * Events of the same type in different containers will now be merged correctly when including both containers.
9
+ * Got rid of the annoying `undefined method 'game' for nil:NilClass` error that sometimes occurred on startup. (It was harmless but now it's gone entirely)
10
+
3
11
  ## 1.7.0
4
12
  * **`bot.find` and `bot.find_user` have had their fuzzy search feature removed because it only caused problems. If you still need it, you can copy the code from the repo's history.** In addition, `find` was renamed to `find_channel` but still exists as a (deprecated) alias.
5
13
  * The in-line documentation using Yard is now complete and can be [accessed at RubyDoc](http://www.rubydoc.info/github/meew0/discordrb/master/). It's not quite polished yet and some things may be confusing, but it should be mostly usable.
data/README.md CHANGED
@@ -12,6 +12,8 @@ An implementation of the [Discord](https://discordapp.com/) API using Ruby.
12
12
  * [Development](https://github.com/meew0/discordrb#development), [Contributing](https://github.com/meew0/discordrb#contributing)
13
13
  * [License](https://github.com/meew0/discordrb#license)
14
14
 
15
+ See also: [Documentation](https://discord.gg/0SBTUU1wZTWfFQL2), [Tutorials](https://github.com/meew0/discordrb/wiki)
16
+
15
17
  ## Installation
16
18
 
17
19
  ### Linux
data/lib/discordrb/bot.rb CHANGED
@@ -866,7 +866,8 @@ module Discordrb
866
866
  raise_event(event)
867
867
  when 'PRESENCE_UPDATE'
868
868
  now_playing = data['game']
869
- played_before = user(data['user']['id'].to_i).game
869
+ presence_user = user(data['user']['id'].to_i)
870
+ played_before = presence_user.nil? ? nil : presence_user.game
870
871
  update_presence(data)
871
872
 
872
873
  event = if now_playing != played_before
@@ -312,6 +312,11 @@ module Discordrb
312
312
  @event_handlers[clazz].delete(handler)
313
313
  end
314
314
 
315
+ # Removes all events from this event handler.
316
+ def clear!
317
+ @event_handlers.clear if @event_handlers
318
+ end
319
+
315
320
  # Adds an event handler to this container. Usually, it's more expressive to just use one of the shorthand adder
316
321
  # methods like {#message}, but if you want to create one manually you can use this.
317
322
  # @param handler [Discordrb::Events::EventHandler] The handler to add.
@@ -327,7 +332,7 @@ module Discordrb
327
332
  handlers = container.instance_variable_get '@event_handlers'
328
333
  fail "Couldn't include the container #{container} as it doesn't have any event handlers - have you tried to include a commands container into an event-only bot?" unless handlers
329
334
  @event_handlers ||= {}
330
- @event_handlers.merge! handlers
335
+ @event_handlers.merge!(handlers) { |_, old, new| old + new }
331
336
  end
332
337
 
333
338
  alias_method :include!, :include_events
@@ -89,7 +89,7 @@ module Discordrb
89
89
  # Tests a token by making an API request, throws an error if not successful
90
90
  # @param token [String] A plaintext token to test
91
91
  def test_token(token)
92
- Discordrb::API.validate_token(token + 'a')
92
+ Discordrb::API.validate_token(token)
93
93
  end
94
94
 
95
95
  # Hashes a password using PBKDF2 with a SHA256 digest
@@ -1,5 +1,5 @@
1
1
  # Discordrb and all its functionality, in this case only the version.
2
2
  module Discordrb
3
3
  # The current version of discordrb.
4
- VERSION = '1.7.0'.freeze
4
+ VERSION = '1.7.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discordrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - meew0