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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -0
- data/lib/discordrb/bot.rb +2 -1
- data/lib/discordrb/container.rb +6 -1
- data/lib/discordrb/token_cache.rb +1 -1
- data/lib/discordrb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3fe1d82b773f30ce3cd65fdb933734e0242356
|
4
|
+
data.tar.gz: 0c28cf978735af1868f3bec8a12c1ee2a12b5cac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/discordrb/container.rb
CHANGED
@@ -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!
|
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
|
92
|
+
Discordrb::API.validate_token(token)
|
93
93
|
end
|
94
94
|
|
95
95
|
# Hashes a password using PBKDF2 with a SHA256 digest
|
data/lib/discordrb/version.rb
CHANGED