kybus-bot 0.4.2 → 0.4.6
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 +4 -4
- data/lib/kybus/bot/adapters/debug.rb +9 -1
- data/lib/kybus/bot/base.rb +5 -0
- data/lib/kybus/bot/command_definition.rb +4 -0
- data/lib/kybus/bot/test.rb +32 -0
- data/lib/kybus/bot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '01392aefbe8bf2a7f5be90e5cc0f77fbbcf66ece5ed77c2bd9f01be3fb9b476b'
|
4
|
+
data.tar.gz: 43ec132ea325c8fe9cd6401d6976a80fcd9e57939483b8f79ea48848b0015bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63f439ab82c6faf1324133146b5b47bff2a0c9fa8d29c8daab00f322edd6c5b47a639f0bd99150cdd420e9a95e2ddd9f32a62245f9ddd85bd6eba35af643481a
|
7
|
+
data.tar.gz: a8a5cffea95d2831d911577d5754d45ed97361bda2f99ddf42812aa2b4058b800abb8a17944d7d84c8f14eba4f4d734290b5c0c24355082e3bf54340adce3bee
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative '../message'
|
5
|
+
|
3
6
|
module Kybus
|
4
7
|
module Bot
|
5
8
|
# :nodoc: #
|
@@ -8,9 +11,10 @@ module Kybus
|
|
8
11
|
# Wraps a debugging message inside a class.
|
9
12
|
class DebugMessage < Kybus::Bot::Message
|
10
13
|
# It receives a string with the raw text and the id of the channel
|
11
|
-
def initialize(text, channel)
|
14
|
+
def initialize(text, channel, attachments = {})
|
12
15
|
@text = text
|
13
16
|
@channel = channel
|
17
|
+
@attachments = attachments
|
14
18
|
end
|
15
19
|
|
16
20
|
# Returns the channel id
|
@@ -22,6 +26,10 @@ module Kybus
|
|
22
26
|
def raw_message
|
23
27
|
@text
|
24
28
|
end
|
29
|
+
|
30
|
+
def user
|
31
|
+
channel_id
|
32
|
+
end
|
25
33
|
end
|
26
34
|
|
27
35
|
# This class simulates a message chat with a user.
|
data/lib/kybus/bot/base.rb
CHANGED
@@ -51,6 +51,7 @@ module Kybus
|
|
51
51
|
@pool_size = configs['pool_size']
|
52
52
|
@provider = Kybus::Bot::Adapter.from_config(configs['provider'])
|
53
53
|
@commands = Kybus::Bot::CommandDefinition.new
|
54
|
+
register_command('default') do; end
|
54
55
|
|
55
56
|
# TODO: move this to config
|
56
57
|
@repository = Kybus::Storage::Repository.from_config(
|
@@ -148,6 +149,10 @@ module Kybus
|
|
148
149
|
provider.mention(name)
|
149
150
|
end
|
150
151
|
|
152
|
+
def registered_commands
|
153
|
+
@commands.registered_commands
|
154
|
+
end
|
155
|
+
|
151
156
|
# Loads command from state
|
152
157
|
def current_command_object
|
153
158
|
command = @state[:cmd]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
require_relative 'adapters/debug'
|
3
|
+
|
4
|
+
module Kybus
|
5
|
+
module Bot
|
6
|
+
class Base
|
7
|
+
CONFIG = {
|
8
|
+
'name' => 'test',
|
9
|
+
'state_repository' => {
|
10
|
+
'name' => 'json',
|
11
|
+
'storage' => 'storage'
|
12
|
+
},
|
13
|
+
'pool_size' => 1,
|
14
|
+
'provider' => {
|
15
|
+
'name' => 'debug',
|
16
|
+
'echo' => true,
|
17
|
+
'channels' => { 'testing' => [] }
|
18
|
+
}
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
def self.make_test_bot
|
22
|
+
new(CONFIG)
|
23
|
+
end
|
24
|
+
|
25
|
+
def receives(msg, attachments = {})
|
26
|
+
msg = ::Kybus::Bot::Adapter::DebugMessage.new(msg, 'testing', attachments)
|
27
|
+
@last_message = msg
|
28
|
+
process_message(msg)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/kybus/bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kybus-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gilberto Vargas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kybus-core
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/kybus/bot/command_definition.rb
|
223
223
|
- lib/kybus/bot/message.rb
|
224
224
|
- lib/kybus/bot/migrator.rb
|
225
|
+
- lib/kybus/bot/test.rb
|
225
226
|
- lib/kybus/bot/testing.rb
|
226
227
|
- lib/kybus/bot/version.rb
|
227
228
|
homepage: https://github.com/tachomex/kybus
|