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 +4 -4
- data/README.md +6 -1
- data/lib/discordrb/api.rb +2 -2
- data/lib/discordrb/bot.rb +6 -5
- data/lib/discordrb/commands/command-bot.rb +4 -1
- data/lib/discordrb/data.rb +13 -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: 1d6b8f8e3fef1615a2e7963791b338038e425687
|
4
|
+
data.tar.gz: 9319f93cbd5893e2f46ef76353b8a9ea326cc707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
data/lib/discordrb/api.rb
CHANGED
@@ -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
|
data/lib/discordrb/bot.rb
CHANGED
@@ -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
|
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)
|
data/lib/discordrb/data.rb
CHANGED
@@ -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
|
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.3.
|
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-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|