discordrb 1.8.0 → 1.8.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 +5 -0
- data/lib/discordrb/bot.rb +21 -5
- 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: 6a817886abdced3f0f96221e3b286feadc093e8f
|
4
|
+
data.tar.gz: 8d4cbf89664f16b80d2aa800f13c8ffc565938db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2a51f5fc08c7803625df60cca4ce53e84a95041086085761ded3175d4b4287cda6b90381ac49b9605fa2a539e7b3a23bd097f01feefe0f1c71f227215900349
|
7
|
+
data.tar.gz: 192d176ba53f01de7b1c24ad68e36c9317caf25665a432c24096344ddc51e15c48e52ce395bd054bc19e8a7a926750e52dcce863c4f1d89fe05ca3eb27c1220a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.8.1
|
4
|
+
|
5
|
+
### Bugfixes
|
6
|
+
* Fixed an error (caused by an undocumented API change) that would write a traceback to the console every time someone started typing in a channel invisible to the bot.
|
7
|
+
|
3
8
|
## 1.8.0
|
4
9
|
* The built-in logger has been somewhat redone.
|
5
10
|
* It now has a fancy mode, settable using `Discordrb::LOGGER.fancy = true/false`, that makes use of ANSI escape codes to prettify the log output.
|
data/lib/discordrb/bot.rb
CHANGED
@@ -91,6 +91,9 @@ module Discordrb
|
|
91
91
|
@channels = {}
|
92
92
|
@users = {}
|
93
93
|
|
94
|
+
# Channels the bot has no permission to, for internal tracking
|
95
|
+
@restricted_channels = []
|
96
|
+
|
94
97
|
@event_threads = []
|
95
98
|
@current_thread = 0
|
96
99
|
end
|
@@ -171,12 +174,21 @@ module Discordrb
|
|
171
174
|
# @return [Channel] The channel identified by the ID.
|
172
175
|
def channel(id)
|
173
176
|
id = id.resolve_id
|
177
|
+
|
178
|
+
raise Discordrb::Errors::NoPermission if @restricted_channels.include? id
|
179
|
+
|
174
180
|
debug("Obtaining data for channel with id #{id}")
|
175
181
|
return @channels[id] if @channels[id]
|
176
182
|
|
177
|
-
|
178
|
-
|
179
|
-
|
183
|
+
begin
|
184
|
+
response = API.channel(token, id)
|
185
|
+
channel = Channel.new(JSON.parse(response), self)
|
186
|
+
@channels[id] = channel
|
187
|
+
rescue Discordrb::Errors::NoPermission
|
188
|
+
debug "Tried to get access to restricted channel #{id}, blacklisting it"
|
189
|
+
@restricted_channels << id
|
190
|
+
raise
|
191
|
+
end
|
180
192
|
end
|
181
193
|
|
182
194
|
# Creates a private channel for the given user ID, or if one exists already, returns that one.
|
@@ -922,8 +934,12 @@ module Discordrb
|
|
922
934
|
when :TYPING_START
|
923
935
|
start_typing(data)
|
924
936
|
|
925
|
-
|
926
|
-
|
937
|
+
begin
|
938
|
+
event = TypingEvent.new(data, self)
|
939
|
+
raise_event(event)
|
940
|
+
rescue Discordrb::Errors::NoPermission
|
941
|
+
debug 'Typing started in channel the bot has no access to, ignoring'
|
942
|
+
end
|
927
943
|
when :PRESENCE_UPDATE
|
928
944
|
now_playing = data['game']
|
929
945
|
presence_user = user(data['user']['id'].to_i)
|
data/lib/discordrb/version.rb
CHANGED