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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79ffeb9b74702dcf9a25f0e92fcc0c06b0af8eb9
4
- data.tar.gz: bf9eca745cecae8bd9078f3fbd27aeab1ae7d0e9
3
+ metadata.gz: 6a817886abdced3f0f96221e3b286feadc093e8f
4
+ data.tar.gz: 8d4cbf89664f16b80d2aa800f13c8ffc565938db
5
5
  SHA512:
6
- metadata.gz: 5cb906cf412f9e5147bbf0196d9b15c0bafbc00fad70c17e9606404770bad93b0a0eca0beb0da2f67b85ec6a4b5c643cc6ba654193404df4abaf103c0ab2b4ba
7
- data.tar.gz: 187edc158381c52b3778f3d364fb399eba254963efcc28380e37371f67225d001543274331aec48138348e100a31abfe4d02e264a99cd71d901595467d9e0fbb
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
- response = API.channel(token, id)
178
- channel = Channel.new(JSON.parse(response), self)
179
- @channels[id] = channel
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
- event = TypingEvent.new(data, self)
926
- raise_event(event)
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)
@@ -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.8.0'.freeze
4
+ VERSION = '1.8.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.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - meew0