kybus-bot 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kybus/bot/adapters/debug.rb +13 -7
- data/lib/kybus/bot/test.rb +1 -1
- data/lib/kybus/bot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcb4039ffd0fa38cadb57ba4a6a0813d5c105590677f1e6f6a7ef85fa6ee2365
|
4
|
+
data.tar.gz: abf1c8941afd74565c25e012b3eec8e94e17d1e0a42a83b2bc20be1eceac0192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e09cd5437c55dbfc6a38df6c3f8ff1383f6f2974538e3ec2ebd380ea38db0e12cd9ce8ba82b87de15bd1200fef0d610ab1e81ee34c644e5fd064f564a31bd7
|
7
|
+
data.tar.gz: 159c13cb384b3168647e572544cdb96098a4d11b8ae4ed7c1143ba562fd0c52eccdf9295729f97e1614ef44d020681bd9615dc064522664114a3c211d9319566
|
@@ -11,10 +11,12 @@ module Kybus
|
|
11
11
|
# Wraps a debugging message inside a class.
|
12
12
|
class DebugMessage < Kybus::Bot::Message
|
13
13
|
# It receives a string with the raw text and the id of the channel
|
14
|
-
|
14
|
+
attr_reader :attachment
|
15
|
+
|
16
|
+
def initialize(text, channel, attachment = nil)
|
15
17
|
@text = text
|
16
18
|
@channel = channel
|
17
|
-
@
|
19
|
+
@attachment = attachment
|
18
20
|
end
|
19
21
|
|
20
22
|
# Returns the channel id
|
@@ -30,6 +32,10 @@ module Kybus
|
|
30
32
|
def user
|
31
33
|
channel_id
|
32
34
|
end
|
35
|
+
|
36
|
+
def has_attachment?
|
37
|
+
!!attachment
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
# This class simulates a message chat with a user.
|
@@ -60,7 +66,7 @@ module Kybus
|
|
60
66
|
DebugMessage.new(@pending_messages.shift, @name)
|
61
67
|
end
|
62
68
|
|
63
|
-
def send_data(message)
|
69
|
+
def send_data(message, attachment)
|
64
70
|
return unless @echo
|
65
71
|
|
66
72
|
puts "Sending message to channel: #{@name}"
|
@@ -70,8 +76,8 @@ module Kybus
|
|
70
76
|
attr_writer :echo
|
71
77
|
|
72
78
|
# receives the answer from the bot
|
73
|
-
def answer(message)
|
74
|
-
send_data(message)
|
79
|
+
def answer(message, attachment = nil)
|
80
|
+
send_data(message, attachment)
|
75
81
|
@state = :open
|
76
82
|
end
|
77
83
|
end
|
@@ -120,8 +126,8 @@ module Kybus
|
|
120
126
|
end
|
121
127
|
|
122
128
|
# interface for sending messages
|
123
|
-
def send_message(channel_name, contents)
|
124
|
-
channel(channel_name).answer(contents)
|
129
|
+
def send_message(channel_name, contents, attachment = nil)
|
130
|
+
channel(channel_name).answer(contents, attachment)
|
125
131
|
end
|
126
132
|
|
127
133
|
# interface for sending video
|
data/lib/kybus/bot/test.rb
CHANGED
data/lib/kybus/bot/version.rb
CHANGED