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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62fe85ee830d1b97bab34f61e01961d2c159724c
4
- data.tar.gz: f42039af35431e99f4c513450360f0f96b145aa8
3
+ metadata.gz: ba9ef73aa069ebdb0bbbb9d89339cf4b10d9e706
4
+ data.tar.gz: 9a32dcb4a8c9923653255453107aaea6c0d634d0
5
5
  SHA512:
6
- metadata.gz: e81ca3b6bcc077c62ecf84d651963703d829e72dbd6667d852f930ba08ac30bc9e1e79ffed01a87ddc677d367cb6459e817e3f7161297c83009662de385d99c8
7
- data.tar.gz: 0e552aea62a2f0fe25613b489444c9b9e6f36860cac8e50276a5883aafe127a6d789de8b7501e379913e02b12192cb7ddb89868ef6e76ffd0a5610889a339788
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
- response = RestClient.get Discordrb::Endpoints::USERS + "/#{id}/channels", {:Authorization => @token}
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.code || 0 ######## mackmm145
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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Discordrb
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.1"
3
3
  end
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.0.9
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-09-23 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket