kybus-bot 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b9b6a8575a2207a5aeff2a9a890973019460a86d904f2bc5989e4da2269cbff
4
- data.tar.gz: 527bbd3abfb670bb76b4181e919124d43c2fc0c4cd353bb6457fc7a36ba34db0
3
+ metadata.gz: fcb4039ffd0fa38cadb57ba4a6a0813d5c105590677f1e6f6a7ef85fa6ee2365
4
+ data.tar.gz: abf1c8941afd74565c25e012b3eec8e94e17d1e0a42a83b2bc20be1eceac0192
5
5
  SHA512:
6
- metadata.gz: 31fbae47c94d21fe626e3b00a24fae3e22d5928da955e9efc795f76808baab49bed4ef358e229fe7172f4db343dbd8d8a1a62f2a3f5945e8b7416c1738209796
7
- data.tar.gz: b23e6febfc1daf445702e2670f181de76bbcd7170426ded2e6a52cf6a2e081092246be1603a275e5e52623916446e3f7b9b9a85d112872a5a1995f064a973fd1
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
- def initialize(text, channel, attachments = {})
14
+ attr_reader :attachment
15
+
16
+ def initialize(text, channel, attachment = nil)
15
17
  @text = text
16
18
  @channel = channel
17
- @attachments = attachments
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
@@ -22,7 +22,7 @@ module Kybus
22
22
  new(CONFIG)
23
23
  end
24
24
 
25
- def receives(msg, attachments = {})
25
+ def receives(msg, attachments = nil)
26
26
  msg = ::Kybus::Bot::Adapter::DebugMessage.new(msg, 'testing', attachments)
27
27
  @last_message = msg
28
28
  process_message(msg)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kybus
4
4
  module Bot
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kybus-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Vargas