dialog_ruby 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +0 -0
- data/_dev/get_full_botapi.rb +59 -0
- data/_dev/inlinekb_pubsub.rb +69 -0
- data/_dev/main.rb +127 -0
- data/_dev/restriction.rb +32 -0
- data/_dev/ru.yml +79 -0
- data/_dev/sidekiq.rb +28 -0
- data/_dev/tdlib.rb +154 -0
- data/dialog.sh +51 -0
- data/dialog_ruby.gemspec +41 -0
- data/lib/architecture.md +22 -0
- data/lib/configuration.rb +117 -0
- data/lib/dialogStart.rb +189 -0
- data/lib/dialog_ruby.rb +59 -0
- data/lib/exec.sh +61 -0
- data/lib/exec_conf/cli_config +7 -0
- data/lib/exec_conf/dialog__sync.service +14 -0
- data/lib/exec_conf/dialog__sync.timer +11 -0
- data/lib/exec_conf/dialog_bot@.path +6 -0
- data/lib/exec_conf/dialog_bot@.service +18 -0
- data/lib/exec_conf/dialog_bot_dev@.path +6 -0
- data/lib/exec_conf/dialog_bot_dev_pre@.service +16 -0
- data/lib/exec_conf/dialog_bot_pre@.service +16 -0
- data/lib/exec_conf/dialog_redis@.service +14 -0
- data/lib/exec_conf/post-merge +5 -0
- data/lib/exec_conf/redis_global.conf +49 -0
- data/lib/exec_conf/redis_local.conf +4 -0
- data/lib/lang/global_ru.yml +29 -0
- data/lib/lib/dialect/canvas/canvas.rb +35 -0
- data/lib/lib/dialect/canvas/element/convert/SearchBaloo.rb +45 -0
- data/lib/lib/dialect/canvas/element/data/search.rb +34 -0
- data/lib/lib/dialect/canvas/element/send/Inline_query_result.rb +32 -0
- data/lib/lib/dialect/canvas/element/send/bot_message.rb +38 -0
- data/lib/lib/dialect/canvas/element/send/keyboards.rb +59 -0
- data/lib/lib/dialect/canvas/element/send/recognize.rb +51 -0
- data/lib/lib/dialect/canvas/element/send/restrict.rb +42 -0
- data/lib/lib/dialect/canvas/element/send/tdlib_chat.rb +33 -0
- data/lib/lib/dialect/canvas/element/send/tdlib_message.rb +38 -0
- data/lib/lib/dialect/canvas/mod/send/_Inline_query_result.rb +38 -0
- data/lib/lib/dialect/canvas/mod/send/_keyboards.rb +40 -0
- data/lib/lib/dialect/canvas/mod/send/func.rb +98 -0
- data/lib/lib/dialect/canvas/mod/send/general/_heads.rb +27 -0
- data/lib/lib/dialect/canvas/mod/send/general/chat.rb +38 -0
- data/lib/lib/dialect/canvas/mod/send/general/common.rb +32 -0
- data/lib/lib/dialect/canvas/mod/send/general/message.rb +37 -0
- data/lib/lib/dialect/canvas/mod/send/general/user.rb +36 -0
- data/lib/lib/dialect/canvas/mod/send/inline_query_result/common.rb +36 -0
- data/lib/lib/dialect/codegen/codegen.rb +74 -0
- data/lib/lib/dialect/codegen/erb/data/1.ModReceive2GetData.erb +27 -0
- data/lib/lib/dialect/codegen/erb/data/2.GetData2Elements.erb +27 -0
- data/lib/lib/dialect/codegen/erb/data/3.GenData2Dest.erb +34 -0
- data/lib/lib/dialect/codegen/erb/functional/1.Expect2Events.erb +37 -0
- data/lib/lib/dialect/codegen/erb/functional/2.1.Events2AppEvent.erb +26 -0
- data/lib/lib/dialect/codegen/erb/functional/2.2.1.Events2ModReceive.erb +73 -0
- data/lib/lib/dialect/codegen/erb/functional/2.2.2.ModReceive2AppEvent.erb +59 -0
- data/lib/lib/dialect/codegen/erb/functional/3.Appevent2EventBus.erb +35 -0
- data/lib/lib/dialect/codegen/erb/functional/4.1.AppEvent2Elements.erb +72 -0
- data/lib/lib/dialect/codegen/erb/functional/5.1.Element2ModElements.erb +70 -0
- data/lib/lib/dialect/codegen/erb/functional/5.2.Element2ModSend.erb +69 -0
- data/lib/lib/dialect/codegen/erb/functional/7.ElementChains.erb +91 -0
- data/lib/lib/dialect/codegen/repack/constructor/DockedGroupings2AppFunctions.rb +36 -0
- data/lib/lib/dialect/codegen/repack/constructor/Element2ModSend.rb +49 -0
- data/lib/lib/dialect/codegen/repack/constructor/ElementsInElements.rb +34 -0
- data/lib/lib/dialect/codegen/repack/functional/1.Expect2Events.rb +35 -0
- data/lib/lib/dialect/codegen/repack/functional/2.2.1.Events2ModReceive.rb +71 -0
- data/lib/lib/dialect/codegen/repack/functional/2.2.2.ModReceive2AppEvent.rb +45 -0
- data/lib/lib/dialect/codegen/repack/functional/5.1.Element2ModElements.rb +90 -0
- data/lib/lib/dialect/codegen/repack/functional/5.2.Element2ModSend.rb +60 -0
- data/lib/lib/dialect/codegen/repack/functional/7.ElementChains.rb +88 -0
- data/lib/lib/dialect/codegen/run.rb +79 -0
- data/lib/lib/metamess/_run.rb +162 -0
- data/lib/lib/metamess/content/content_o-command_f.rb +100 -0
- data/lib/lib/metamess/content/content_o-media_f.rb +149 -0
- data/lib/lib/metamess/content/content_o-simple_f.rb +35 -0
- data/lib/lib/metamess/content/content_o.rb +245 -0
- data/lib/lib/metamess/event/notify_o-chatmember_f.rb +124 -0
- data/lib/lib/metamess/event/notify_o-chattitle_f.rb +34 -0
- data/lib/lib/metamess/event/notify_o-create_f.rb +42 -0
- data/lib/lib/metamess/event/notify_o-migrate_f.rb +34 -0
- data/lib/lib/metamess/event/notify_o-pinned_f.rb +34 -0
- data/lib/lib/metamess/event/notify_o.rb +28 -0
- data/lib/lib/metamess/event_c.rb +26 -0
- data/lib/lib/metamess/func.rb +220 -0
- data/lib/lib/metamess/service/service_o-callback_f.rb +33 -0
- data/lib/lib/metamess/service/service_o-inline_f.rb +55 -0
- data/lib/lib/metamess/service/service_o.rb +26 -0
- data/lib/lib/naming.rb +130 -0
- data/lib/lib/storage/redis/redisPubSub.rb +51 -0
- data/lib/lib/storage/redis/rediscached.rb +97 -0
- data/lib/lib/tdlib/auth.rb +141 -0
- data/lib/lib/tdlib/func.rb +34 -0
- data/lib/lib/tdlib/init.rb +39 -0
- data/lib/lib/telegram/botapi.rb +71 -0
- data/lib/lib/telegram/infra_info.rb +50 -0
- data/lib/lib/telegram/wrappers.rb +41 -0
- data/lib/lib/tooling/lang.rb +24 -0
- data/lib/lib/tooling/log.rb +54 -0
- data/lib/lib/tooling/ruby.rb +25 -0
- data/lib/version.rb +3 -0
- data/logo.png +0 -0
- metadata +305 -0
data/lib/exec.sh
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = bash
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
set -e
|
13
|
+
|
14
|
+
runInitMain() (
|
15
|
+
if [ ! -f ~/.config/systemd/user/dialog_bot@.service ] || [ ! -f ~/.config/systemd/user/dialog_redis@.service ] ; then
|
16
|
+
cp ./engine/exec_conf/dialog*@.service ~/.config/systemd/user
|
17
|
+
sed -i "s#{RunPath}#`echo $PWD`#" ~/.config/systemd/user/dialog*@.service
|
18
|
+
fi
|
19
|
+
systemctl --user daemon-reload
|
20
|
+
)
|
21
|
+
|
22
|
+
botRunInit() (
|
23
|
+
runInitMain
|
24
|
+
mkdir -p ~/.config/systemd/user ./_data/${BotFullname}
|
25
|
+
|
26
|
+
if [ ! -f ./_data/${BotFullname}/redis.conf ]; then
|
27
|
+
cp ./engine/exec_conf/redis_local.conf ./_data/${BotFullname}/redis.conf
|
28
|
+
sed -i "s/{INSTANCE}/${BotFullname}/" ./_data/${BotFullname}/redis.conf
|
29
|
+
fi
|
30
|
+
systemctl --user daemon-reload
|
31
|
+
)
|
32
|
+
|
33
|
+
|
34
|
+
#####
|
35
|
+
DialogBotExec() (
|
36
|
+
systemctl --user restart dialog_redis@${BotFullname}
|
37
|
+
systemctl --user restart dialog_bot@${BotFullname}
|
38
|
+
|
39
|
+
case $Mode in
|
40
|
+
'prod')
|
41
|
+
echo "Ready!"
|
42
|
+
systemctl --user enable dialog_redis@${BotFullname}
|
43
|
+
systemctl --user enable dialog_bot@${BotFullname}
|
44
|
+
;;
|
45
|
+
'dev')
|
46
|
+
mkdir -p /tmp/_render
|
47
|
+
|
48
|
+
inotifywait -r -e DELETE --format '%w %f' -m ./engine |\
|
49
|
+
(
|
50
|
+
while read; do
|
51
|
+
echo "Bot restarting"
|
52
|
+
systemctl --user restart dialog_bot@${BotFullname}
|
53
|
+
done
|
54
|
+
)
|
55
|
+
|
56
|
+
systemctl --user stop dialog_bot@${BotFullname}
|
57
|
+
systemctl --user stop dialog_redis@${BotFullname}
|
58
|
+
;;
|
59
|
+
esac
|
60
|
+
)
|
61
|
+
#####
|
@@ -0,0 +1,14 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description= Dialog sync
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=oneshot
|
7
|
+
WorkingDirectory={RunPath}
|
8
|
+
ExecStart=/usr/bin/git pull
|
9
|
+
StandardOutput=syslog
|
10
|
+
StandardError=syslog
|
11
|
+
SyslogIdentifier=dialog_sync
|
12
|
+
|
13
|
+
[Install]
|
14
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,18 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description= Dialog (Telegram Bot abstraction layer) - instance %i
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=simple
|
7
|
+
WorkingDirectory={RunPath}
|
8
|
+
EnvironmentFile={RunPath}/_env/%i
|
9
|
+
ExecStart=/usr/bin/ruby.ruby2.5 ./dialog.rb start bot %i
|
10
|
+
RestartSec=5
|
11
|
+
TimeoutStopSec=5
|
12
|
+
Restart=on-failure
|
13
|
+
StandardOutput=syslog
|
14
|
+
StandardError=syslog
|
15
|
+
SyslogIdentifier=dialog_%i
|
16
|
+
|
17
|
+
[Install]
|
18
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description= Dialog (Telegram Bot abstraction layer) - instance %i
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=oneshot
|
7
|
+
WorkingDirectory={RunPath}
|
8
|
+
EnvironmentFile={RunPath}/_env/%i
|
9
|
+
ExecStartPre=/usr/bin/ruby.ruby2.5 ./dialog.rb start dev_offline %i
|
10
|
+
ExecStart=/usr/bin/systemctl --user restart dialog_bot@%i
|
11
|
+
StandardOutput=syslog
|
12
|
+
StandardError=syslog
|
13
|
+
SyslogIdentifier=dialog_dev_pre_%i
|
14
|
+
|
15
|
+
[Install]
|
16
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description= Dialog (Telegram Bot abstraction layer) - instance %i
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=oneshot
|
7
|
+
WorkingDirectory={RunPath}
|
8
|
+
EnvironmentFile={RunPath}/_env/%i
|
9
|
+
ExecStartPre=/usr/bin/ruby.ruby2.5 ./dialog.rb start check %i
|
10
|
+
ExecStart=/usr/bin/systemctl --user restart dialog_bot@%i
|
11
|
+
StandardOutput=syslog
|
12
|
+
StandardError=syslog
|
13
|
+
SyslogIdentifier=dialog_pre_%i
|
14
|
+
|
15
|
+
[Install]
|
16
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,14 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Redis
|
3
|
+
After=network.target
|
4
|
+
PartOf=redis.target
|
5
|
+
|
6
|
+
[Service]
|
7
|
+
Type=simple
|
8
|
+
#PrivateTmp=true
|
9
|
+
PIDFile={RunPath}/_data/%i/redis.pid
|
10
|
+
ExecStart=/usr/sbin/redis-server ./_data/%i/redis.conf
|
11
|
+
Restart=on-failure
|
12
|
+
|
13
|
+
[Install]
|
14
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,49 @@
|
|
1
|
+
daemonize no
|
2
|
+
port 0
|
3
|
+
unixsocketperm 700
|
4
|
+
loglevel notice
|
5
|
+
syslog-enabled yes
|
6
|
+
syslog-facility local1
|
7
|
+
databases 2
|
8
|
+
save 600 1
|
9
|
+
save 300 5
|
10
|
+
save 180 10
|
11
|
+
save 60 50
|
12
|
+
save 10 100
|
13
|
+
|
14
|
+
stop-writes-on-bgsave-error yes
|
15
|
+
rdbcompression yes
|
16
|
+
rdbchecksum yes
|
17
|
+
dbfilename dump.rdb
|
18
|
+
appendonly no
|
19
|
+
appendfsync everysec
|
20
|
+
no-appendfsync-on-rewrite no
|
21
|
+
maxclients 1000
|
22
|
+
|
23
|
+
auto-aof-rewrite-percentage 100
|
24
|
+
auto-aof-rewrite-min-size 64mb
|
25
|
+
aof-rewrite-incremental-fsync yes
|
26
|
+
|
27
|
+
|
28
|
+
aof-load-truncated yes
|
29
|
+
lua-time-limit 5000
|
30
|
+
slowlog-log-slower-than 10000
|
31
|
+
slowlog-max-len 128
|
32
|
+
latency-monitor-threshold 0
|
33
|
+
notify-keyspace-events ""
|
34
|
+
|
35
|
+
hash-max-ziplist-entries 512
|
36
|
+
hash-max-ziplist-value 64
|
37
|
+
list-max-ziplist-entries 512
|
38
|
+
list-max-ziplist-value 64
|
39
|
+
set-max-intset-entries 512
|
40
|
+
|
41
|
+
zset-max-ziplist-entries 128
|
42
|
+
zset-max-ziplist-value 64
|
43
|
+
hll-sparse-max-bytes 3000
|
44
|
+
activerehashing yes
|
45
|
+
client-output-buffer-limit normal 0 0 0
|
46
|
+
client-output-buffer-limit slave 256mb 64mb 60
|
47
|
+
client-output-buffer-limit pubsub 32mb 8mb 60
|
48
|
+
|
49
|
+
hz 10
|
@@ -0,0 +1,29 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
ru:
|
14
|
+
_pnp_cmd_start_personal: 'Привет! Чем могу помочь? (P.S - Это персональный контекст)'
|
15
|
+
_pnp_cmd_start_infra: 'Привет! Чем могу помочь? (P.S - Это инфраструктурный контекст)'
|
16
|
+
_pnp_cmd_start_group: 'Привет! Чем могу помочь? (P.S - Это групповой контекст)'
|
17
|
+
|
18
|
+
_restrictChatMember: 'Переход хода! =)'
|
19
|
+
_action_def_text: 'Ммм...просто думаю вслух'
|
20
|
+
_action_demo: 'Демонстрация моих возможностей'
|
21
|
+
_action_group2supergroup: 'Пожалуйста, повысьте группу до супергруппы - и добавьте меня обратно: я ничем не могу вам помочь в обычной группе.'
|
22
|
+
_action_help: 'Краткое описание ...'
|
23
|
+
_action_command_not_recognized: 'Возможно, я смогу понять вас в другой раз ...'
|
24
|
+
_action_session_reset: 'Настройки текущей сессии сброшены!'
|
25
|
+
_action_bot_ready: 'Слушаю'
|
26
|
+
_action_bot_has_no_rights: 'Простите, не могу управлять вашим чатом'
|
27
|
+
|
28
|
+
_action_create_chat: 'Создать: чат'
|
29
|
+
_action_create_chat_desc: 'Описание_чата...'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
module Dialog
|
14
|
+
module Canvas
|
15
|
+
class << self
|
16
|
+
|
17
|
+
def run(args)
|
18
|
+
fqn = args[:mmsg][:fqn]
|
19
|
+
args[:x][:fqn]="#{fqn[:c].capitalize}#{fqn[:o].capitalize}#{fqn[:f].capitalize}#{fqn[:g].capitalize}"
|
20
|
+
Dialog.logger.debug("Try to run: Class: #{args[:x][:fqn]}\n")
|
21
|
+
begin
|
22
|
+
method = "get_#{Dialog.config.naming.app}#{args[:x][:fqn]}"
|
23
|
+
Dialog::Generated.send(method.to_sym, args)
|
24
|
+
rescue NoMethodError => @e
|
25
|
+
# true
|
26
|
+
Dialog.logger.error "Error in method run: #{@e.message}\n, #{@e.backtrace.join("\n\t")}" if @e
|
27
|
+
rescue => @e
|
28
|
+
raise
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
#
|
@@ -0,0 +1,45 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
module Dialog
|
14
|
+
module ElementData
|
15
|
+
module SearchBaloo
|
16
|
+
class << self
|
17
|
+
|
18
|
+
def convert_Inline_query_resultArticle(args)
|
19
|
+
result = Array.new
|
20
|
+
args[:x][:dataRespRaw].each do |ext, arrayName|
|
21
|
+
arrayName.each do |name|
|
22
|
+
result << {id: rand(1 .. 90000), type: "article", title: "#{name}", input_message_content: {message_text: name}}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
args[:x][:dataResp] = result
|
26
|
+
args[:x][:send][:results] = args[:x][:dataResp]
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def convert_Inline_query_resultDocument(args)
|
31
|
+
result = Array.new
|
32
|
+
if args[:x][:dataRespRaw].has_key?(:pdf)
|
33
|
+
args[:x][:dataRespRaw][:pdf].each do |name|
|
34
|
+
result << {id: rand(1 .. 90000), type: "document", title: "#{name}", mime_type: "application/pdf", document_url: "http://www.innosense.org/#{URI.escape(name)}"}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
args[:x][:dataResp] = result
|
38
|
+
args[:x][:send][:results] = args[:x][:dataResp]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
#
|
@@ -0,0 +1,34 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
module Dialog
|
14
|
+
module ElementData
|
15
|
+
class << self
|
16
|
+
|
17
|
+
def exec_DialogElementDataSearchBaloo(args)
|
18
|
+
res = {}
|
19
|
+
args[:x][:dataReq] = args[:x][:dataReq].split(' ')[1..-1].join(' ') if args[:mmsg][:fqn][:f] == "inline" and args[:x][:dataReqType] == 'DialogArchiGetdataField'
|
20
|
+
Open3.popen3('/usr/bin/baloosearch', '-l20', args[:x][:dataReq]) {|i,o,e,t|
|
21
|
+
o.each do |result|
|
22
|
+
File.extname(result) == "" ? ext = "none" : ext = File.extname(result)[1..-1].strip.downcase
|
23
|
+
name = File.basename(result, ".*")
|
24
|
+
res[ext.to_sym] ||= []
|
25
|
+
res[ext.to_sym] << name
|
26
|
+
end
|
27
|
+
}
|
28
|
+
args[:x][:dataRespRaw] = res
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
#
|
@@ -0,0 +1,32 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
module Dialog
|
14
|
+
module ElementSend
|
15
|
+
class << self
|
16
|
+
|
17
|
+
def send_DialogElementSendInline_query_resultArticle(args)
|
18
|
+
args[:smsg] ||={}
|
19
|
+
args[:x].has_key?(:dataResp) ? results = args[:x][:dataResp] : results = makeInline_query_resultArticle(args, props, viewId)
|
20
|
+
args[:smsg][:results] = results
|
21
|
+
end
|
22
|
+
|
23
|
+
def send_DialogElementSendInline_query_resultDocument(args)
|
24
|
+
args[:smsg] ||={}
|
25
|
+
args[:x].has_key?(:dataResp) ? results = args[:x][:dataResp] : results = makeInline_query_resultDocument(args, props, viewId)
|
26
|
+
args[:smsg][:results] = results
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
#
|
@@ -0,0 +1,38 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 2 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
|
13
|
+
module Dialog
|
14
|
+
module ElementSend
|
15
|
+
class << self
|
16
|
+
|
17
|
+
def send_DialogElementSendBot_messageSend(args)
|
18
|
+
args[:api] = {:op => 'sendMessage'}
|
19
|
+
return Dialog::BotApi.apiAction(args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def send_DialogElementSendBot_messageDelete(args)
|
23
|
+
args[:api] = {:op => 'deleteMessage'}
|
24
|
+
args[:smsg][:message_id] = args[:mmsg][:fqndata][:o][:msg][:id]
|
25
|
+
return Dialog::BotApi.apiAction(args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_DialogElementSendBot_messageForward(args)
|
29
|
+
args[:api] = {:op => 'forwardMessage'}
|
30
|
+
args[:smsg][:message_id] = args[:mmsg][:fqndata][:o][:msg][:id]
|
31
|
+
args[:smsg][:chat_id] = args[:mmsg][:fqndata][:o][:chat][:id]
|
32
|
+
return Dialog::BotApi.apiAction(args)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
#
|