discordrb 1.3.2 → 1.3.3

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: e7a553fc163491c4a828dfb1b0ae8eceea31002b
4
- data.tar.gz: f03090190ede187097ab7c6522e4c46bcab7a76b
3
+ metadata.gz: 1d6b8f8e3fef1615a2e7963791b338038e425687
4
+ data.tar.gz: 9319f93cbd5893e2f46ef76353b8a9ea326cc707
5
5
  SHA512:
6
- metadata.gz: 23c01ad25109395e1d09ff9ca80d7fc84136ddc265d76f3c74cd6e7cf038ceacfffb61eb30ff856ed8abcac6df60eea5d9de07fb85387bd7304a1b174b24c149
7
- data.tar.gz: aa0d36cc705bab5ac583a3f9a2317e20189e862832e49b76838e81c0106d39c24fba15e70ecda3ef4185ce998ff7232654451e392a3ded38178b95d3edd9a201
6
+ metadata.gz: 09f9d9c69de557771251771096ae0bee4957d529ca2882312fdec7d88fa2a87531e5885a7d17e7016ec235a01d2ec4e76871eca084639cd4205c5730ad758385
7
+ data.tar.gz: 8c9cef441cfd168f8d5f06da90cd62e3f9bec4ef47f1cb992342c0d982224bc7d20014b517dad03ae12786ccab55d208dfbeab1cd607e647ddbba123456ba3f1
data/README.md CHANGED
@@ -29,7 +29,12 @@ Run the [ping example](https://github.com/meew0/discordrb/blob/master/examples/p
29
29
  ERROR: Error installing discordrb:
30
30
  The 'websocket-driver' native gem requires installed build tools.
31
31
 
32
- You're missing the development kit required to build native extensions. Follow [these instructions](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions) and reinstall discordrb:
32
+ You're missing the development kit required to build native extensions. Download the development kit [here](http://rubyinstaller.org/downloads/) (scroll down to "Development Kit", then choose the one for Ruby 2.0 and your system architecture) and extract it somewhere. Open a command prompt in that folder and run:
33
+
34
+ $ ruby dk.rb init
35
+ $ ruby dk.rb install
36
+
37
+ Then reinstall discordrb:
33
38
 
34
39
  $ gem uninstall discordrb
35
40
  $ gem install discordrb
@@ -147,9 +147,9 @@ module Discordrb::API
147
147
  end
148
148
 
149
149
  # Edit a message
150
- def edit_message(token, channel_id, message, mentions = [])
150
+ def edit_message(token, channel_id, message_id, message, mentions = [])
151
151
  RestClient.patch(
152
- "#{APIBASE}/channels/#{channel_id}/messages",
152
+ "#{APIBASE}/channels/#{channel_id}/messages/#{message_id}",
153
153
  { 'content' => message, 'mentions' => mentions }.to_json,
154
154
  Authorization: token,
155
155
  content_type: :json
@@ -26,7 +26,7 @@ module Discordrb
26
26
  class Bot
27
27
  include Discordrb::Events
28
28
 
29
- attr_reader :bot_user
29
+ attr_reader :bot_user, :token
30
30
 
31
31
  def initialize(email, password, debug = false)
32
32
  # Make sure people replace the login details in the example files...
@@ -109,7 +109,8 @@ module Discordrb
109
109
  'content' => content.to_s,
110
110
  'mentions' => []
111
111
  }
112
- API.send_message(@token, channel_id, content)
112
+ response = API.send_message(@token, channel_id, content)
113
+ Message.new(JSON.parse(response), self)
113
114
  end
114
115
 
115
116
  def send_file(channel_id, file)
@@ -191,8 +192,8 @@ module Discordrb
191
192
  @event_handlers[clazz] << handler
192
193
  end
193
194
 
194
- def debug(message)
195
- puts "[DEBUG @ #{Time.now.to_s}] #{message}" if @debug
195
+ def debug(message, important = false)
196
+ puts "[DEBUG @ #{Time.now.to_s}] #{message}" if @debug || important
196
197
  end
197
198
 
198
199
  alias_method :<<, :add_handler
@@ -483,7 +484,7 @@ module Discordrb
483
484
  raise_event(event)
484
485
  end
485
486
  rescue Exception => e
486
- debug("Exception: #{e.inspect}")
487
+ debug("Exception: #{e.inspect}", true)
487
488
  e.backtrace.each {|line| debug(line) }
488
489
  end
489
490
  end
@@ -20,6 +20,9 @@ module Discordrb::Commands
20
20
  # The name of the help command (that displays information to other commands). Nil if none should exist
21
21
  help_command: attributes[:help_command] || :help,
22
22
 
23
+ # The message to display for when a command doesn't exist, %command% to get the command name in question and nil for no message
24
+ command_doesnt_exist_message: attributes[:command_doesnt_exist_message] || "The command `%command%` doesn't exist!",
25
+
23
26
  # All of the following need to be one character
24
27
  # String to designate previous result in command chain
25
28
  previous: attributes[:previous] || '~',
@@ -89,7 +92,7 @@ module Discordrb::Commands
89
92
  debug("Executing command #{name} with arguments #{arguments}")
90
93
  command = @commands[name]
91
94
  unless command
92
- event.respond "The command `#{name}` doesn't exist!"
95
+ event.respond @attributes[:command_doesnt_exist_message].gsub('%command%', name) if @attributes[:command_doesnt_exist_message]
93
96
  return
94
97
  end
95
98
  if permission?(user(event.user.id), command.attributes[:permission_level], event.server.id)
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'ostruct'
4
4
  require 'discordrb/permissions'
5
+ require 'discordrb/api'
5
6
 
6
7
  module Discordrb
7
8
  class User
@@ -229,6 +230,18 @@ module Discordrb
229
230
  @mentions << User.new(element, bot)
230
231
  end
231
232
  end
233
+
234
+ def reply(content)
235
+ @channel.send_message(content)
236
+ end
237
+
238
+ def edit(new_content)
239
+ API.edit_message(@bot.token, @channel.id, @id, new_content)
240
+ end
241
+
242
+ def delete
243
+ API.delete_message(@bot.token, @channel.id, @id)
244
+ end
232
245
  end
233
246
 
234
247
  class Server
@@ -1,3 +1,3 @@
1
1
  module Discordrb
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
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.3.2
4
+ version: 1.3.3
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-01 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket