discordrb 1.0.9 → 1.1.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/lib/discordrb/bot.rb +6 -3
- data/lib/discordrb/data.rb +3 -0
- data/lib/discordrb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba9ef73aa069ebdb0bbbb9d89339cf4b10d9e706
|
4
|
+
data.tar.gz: 9a32dcb4a8c9923653255453107aaea6c0d634d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94cc392c8c4fda6078aefa460f9d22802d58f1fc0a4b9181482008a70aaa6e8e44825ff509b6e15e27ae7b2b3ae9cb659a1a53bc88450768159e13b2f86f2bf7
|
7
|
+
data.tar.gz: ad17ad5babe2f5975385da9a1470792bfd0b0be1ec20d51b978f212bac4afe56a251b1e3bcd0675e65ad44328e25906cf9e7183183953f4c49a88cf5d6fc269b
|
data/lib/discordrb/bot.rb
CHANGED
@@ -61,7 +61,11 @@ module Discordrb
|
|
61
61
|
debug("Creating private channel with user id #{id}")
|
62
62
|
return @private_channels[id] if @private_channels[id]
|
63
63
|
|
64
|
-
|
64
|
+
data = {
|
65
|
+
'recipient_id' => id
|
66
|
+
}
|
67
|
+
|
68
|
+
response = RestClient.post Discordrb::Endpoints::USERS + "/#{@bot_user.id}/channels", data.to_json, {:Authorization => @token, :content_type => :json}
|
65
69
|
channel = Channel.new(JSON.parse(response), self)
|
66
70
|
@private_channels[id] = channel
|
67
71
|
end
|
@@ -80,7 +84,6 @@ module Discordrb
|
|
80
84
|
'content' => content.to_s,
|
81
85
|
'mentions' => []
|
82
86
|
}
|
83
|
-
|
84
87
|
RestClient.post Discordrb::Endpoints::CHANNELS + "/#{channel_id}/messages", data.to_json, {:Authorization => @token, :content_type => :json}
|
85
88
|
end
|
86
89
|
|
@@ -145,7 +148,7 @@ module Discordrb
|
|
145
148
|
debug("Received token: #{login_response_object['token']}")
|
146
149
|
login_response_object['token']
|
147
150
|
rescue Exception => e
|
148
|
-
response_code = login_response.
|
151
|
+
response_code = login_response.nil? ? 0 : login_response.code ######## mackmm145
|
149
152
|
if login_attempts < 100 && ( e.inspect.include?("No such host is known.") || response_code == 523)
|
150
153
|
sleep 15
|
151
154
|
puts "login failed. reattempting. " + Time.now.to_s
|
data/lib/discordrb/data.rb
CHANGED
@@ -37,6 +37,9 @@ module Discordrb
|
|
37
37
|
def initialize(data, bot)
|
38
38
|
@bot = bot
|
39
39
|
|
40
|
+
#data is a sometimes a Hash and othertimes an array of Hashes, you only want the last one if it's an array
|
41
|
+
data = data[-1] if data.is_a?(Array)
|
42
|
+
|
40
43
|
@id = data['id']
|
41
44
|
@type = data['type'] || 'text'
|
42
45
|
|
data/lib/discordrb/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meew0
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|