action_bot 0.1.17 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action_bot/base.rb +1 -0
- data/lib/action_bot/controller.rb +1 -1
- data/lib/configuration/configurators/app_configurator.rb +1 -1
- data/scaffolds/bots/example_long_polling_bot.rb +6 -1
- data/scaffolds/config/configuration.rb +5 -5
- data/scaffolds/controllers/hello_controller.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: a4dd4aedf212a7767933f9cd317bdf9f866b7acbd2e6925e19f3f7b53e429caa
|
4
|
+
data.tar.gz: a93595bb31bf30c867c492417524dcc4203d3d45419b2b2f75663527876fa4a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9759a5c2b72b6197da0eb94920ab09ea30bedcb857374527ddfab3728b2509779e915c4d19a21e6913ca670b6e1398e07f252b316e5c5995dfb04ca52284de7
|
7
|
+
data.tar.gz: 4f052bfc2df5bbe175d569ecb41f0814a2f13ae93786e2342ef4a1c7c300bce47647e4ad4c6e5b11d7e9829ff67e2b42b3f498233ce7ed5d747394210b80a5c7
|
data/lib/action_bot/base.rb
CHANGED
@@ -9,6 +9,7 @@ module ActionBot
|
|
9
9
|
controller, action = kwargs.first
|
10
10
|
controller_object = "#{controller.to_s.camelize}Controller".constantize.new
|
11
11
|
raise "No such method: #{action} for #{controller}" unless controller_object.respond_to?(action)
|
12
|
+
|
12
13
|
controller_object.params = ActionController::Parameters.new params
|
13
14
|
controller_object.public_send(action)
|
14
15
|
throw(:done)
|
@@ -17,12 +17,17 @@ class ExampleLongPollingBot < ActionBot::Base
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def run
|
20
|
-
|
20
|
+
return unless message_legal?
|
21
|
+
|
22
|
+
on @message == 'hello_world', hello: :world, params: {
|
21
23
|
tg_chat_id: tg_chat_id
|
22
24
|
}
|
23
25
|
end
|
24
26
|
|
25
27
|
private
|
28
|
+
|
29
|
+
def message_legal?
|
30
|
+
@message.respond_to?(:text) && @message.text
|
26
31
|
|
27
32
|
def tg_chat_id
|
28
33
|
@message.chat.id
|
@@ -7,11 +7,11 @@ AppConfigurator.configure do |config|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Configure database
|
10
|
-
config.db_url = begin
|
11
|
-
|
12
|
-
rescue Errno::ENOENT
|
13
|
-
|
14
|
-
end
|
10
|
+
# config.db_url = begin
|
11
|
+
# YAML::load(IO.read('config/secrets/database.yml'))["database_url"]
|
12
|
+
# rescue Errno::ENOENT
|
13
|
+
# ENV["DATABASE_URL"]
|
14
|
+
# end
|
15
15
|
|
16
16
|
# Configure i18n
|
17
17
|
config.i18n_locale = :en
|