dialog_ruby 0.1.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.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +0 -0
  4. data/_dev/get_full_botapi.rb +59 -0
  5. data/_dev/inlinekb_pubsub.rb +69 -0
  6. data/_dev/main.rb +127 -0
  7. data/_dev/restriction.rb +32 -0
  8. data/_dev/ru.yml +79 -0
  9. data/_dev/sidekiq.rb +28 -0
  10. data/_dev/tdlib.rb +154 -0
  11. data/dialog.sh +51 -0
  12. data/dialog_ruby.gemspec +41 -0
  13. data/lib/architecture.md +22 -0
  14. data/lib/configuration.rb +117 -0
  15. data/lib/dialogStart.rb +189 -0
  16. data/lib/dialog_ruby.rb +59 -0
  17. data/lib/exec.sh +61 -0
  18. data/lib/exec_conf/cli_config +7 -0
  19. data/lib/exec_conf/dialog__sync.service +14 -0
  20. data/lib/exec_conf/dialog__sync.timer +11 -0
  21. data/lib/exec_conf/dialog_bot@.path +6 -0
  22. data/lib/exec_conf/dialog_bot@.service +18 -0
  23. data/lib/exec_conf/dialog_bot_dev@.path +6 -0
  24. data/lib/exec_conf/dialog_bot_dev_pre@.service +16 -0
  25. data/lib/exec_conf/dialog_bot_pre@.service +16 -0
  26. data/lib/exec_conf/dialog_redis@.service +14 -0
  27. data/lib/exec_conf/post-merge +5 -0
  28. data/lib/exec_conf/redis_global.conf +49 -0
  29. data/lib/exec_conf/redis_local.conf +4 -0
  30. data/lib/lang/global_ru.yml +29 -0
  31. data/lib/lib/dialect/canvas/canvas.rb +35 -0
  32. data/lib/lib/dialect/canvas/element/convert/SearchBaloo.rb +45 -0
  33. data/lib/lib/dialect/canvas/element/data/search.rb +34 -0
  34. data/lib/lib/dialect/canvas/element/send/Inline_query_result.rb +32 -0
  35. data/lib/lib/dialect/canvas/element/send/bot_message.rb +38 -0
  36. data/lib/lib/dialect/canvas/element/send/keyboards.rb +59 -0
  37. data/lib/lib/dialect/canvas/element/send/recognize.rb +51 -0
  38. data/lib/lib/dialect/canvas/element/send/restrict.rb +42 -0
  39. data/lib/lib/dialect/canvas/element/send/tdlib_chat.rb +33 -0
  40. data/lib/lib/dialect/canvas/element/send/tdlib_message.rb +38 -0
  41. data/lib/lib/dialect/canvas/mod/send/_Inline_query_result.rb +38 -0
  42. data/lib/lib/dialect/canvas/mod/send/_keyboards.rb +40 -0
  43. data/lib/lib/dialect/canvas/mod/send/func.rb +98 -0
  44. data/lib/lib/dialect/canvas/mod/send/general/_heads.rb +27 -0
  45. data/lib/lib/dialect/canvas/mod/send/general/chat.rb +38 -0
  46. data/lib/lib/dialect/canvas/mod/send/general/common.rb +32 -0
  47. data/lib/lib/dialect/canvas/mod/send/general/message.rb +37 -0
  48. data/lib/lib/dialect/canvas/mod/send/general/user.rb +36 -0
  49. data/lib/lib/dialect/canvas/mod/send/inline_query_result/common.rb +36 -0
  50. data/lib/lib/dialect/codegen/codegen.rb +74 -0
  51. data/lib/lib/dialect/codegen/erb/data/1.ModReceive2GetData.erb +27 -0
  52. data/lib/lib/dialect/codegen/erb/data/2.GetData2Elements.erb +27 -0
  53. data/lib/lib/dialect/codegen/erb/data/3.GenData2Dest.erb +34 -0
  54. data/lib/lib/dialect/codegen/erb/functional/1.Expect2Events.erb +37 -0
  55. data/lib/lib/dialect/codegen/erb/functional/2.1.Events2AppEvent.erb +26 -0
  56. data/lib/lib/dialect/codegen/erb/functional/2.2.1.Events2ModReceive.erb +73 -0
  57. data/lib/lib/dialect/codegen/erb/functional/2.2.2.ModReceive2AppEvent.erb +59 -0
  58. data/lib/lib/dialect/codegen/erb/functional/3.Appevent2EventBus.erb +35 -0
  59. data/lib/lib/dialect/codegen/erb/functional/4.1.AppEvent2Elements.erb +72 -0
  60. data/lib/lib/dialect/codegen/erb/functional/5.1.Element2ModElements.erb +70 -0
  61. data/lib/lib/dialect/codegen/erb/functional/5.2.Element2ModSend.erb +69 -0
  62. data/lib/lib/dialect/codegen/erb/functional/7.ElementChains.erb +91 -0
  63. data/lib/lib/dialect/codegen/repack/constructor/DockedGroupings2AppFunctions.rb +36 -0
  64. data/lib/lib/dialect/codegen/repack/constructor/Element2ModSend.rb +49 -0
  65. data/lib/lib/dialect/codegen/repack/constructor/ElementsInElements.rb +34 -0
  66. data/lib/lib/dialect/codegen/repack/functional/1.Expect2Events.rb +35 -0
  67. data/lib/lib/dialect/codegen/repack/functional/2.2.1.Events2ModReceive.rb +71 -0
  68. data/lib/lib/dialect/codegen/repack/functional/2.2.2.ModReceive2AppEvent.rb +45 -0
  69. data/lib/lib/dialect/codegen/repack/functional/5.1.Element2ModElements.rb +90 -0
  70. data/lib/lib/dialect/codegen/repack/functional/5.2.Element2ModSend.rb +60 -0
  71. data/lib/lib/dialect/codegen/repack/functional/7.ElementChains.rb +88 -0
  72. data/lib/lib/dialect/codegen/run.rb +79 -0
  73. data/lib/lib/metamess/_run.rb +162 -0
  74. data/lib/lib/metamess/content/content_o-command_f.rb +100 -0
  75. data/lib/lib/metamess/content/content_o-media_f.rb +149 -0
  76. data/lib/lib/metamess/content/content_o-simple_f.rb +35 -0
  77. data/lib/lib/metamess/content/content_o.rb +245 -0
  78. data/lib/lib/metamess/event/notify_o-chatmember_f.rb +124 -0
  79. data/lib/lib/metamess/event/notify_o-chattitle_f.rb +34 -0
  80. data/lib/lib/metamess/event/notify_o-create_f.rb +42 -0
  81. data/lib/lib/metamess/event/notify_o-migrate_f.rb +34 -0
  82. data/lib/lib/metamess/event/notify_o-pinned_f.rb +34 -0
  83. data/lib/lib/metamess/event/notify_o.rb +28 -0
  84. data/lib/lib/metamess/event_c.rb +26 -0
  85. data/lib/lib/metamess/func.rb +220 -0
  86. data/lib/lib/metamess/service/service_o-callback_f.rb +33 -0
  87. data/lib/lib/metamess/service/service_o-inline_f.rb +55 -0
  88. data/lib/lib/metamess/service/service_o.rb +26 -0
  89. data/lib/lib/naming.rb +130 -0
  90. data/lib/lib/storage/redis/redisPubSub.rb +51 -0
  91. data/lib/lib/storage/redis/rediscached.rb +97 -0
  92. data/lib/lib/tdlib/auth.rb +141 -0
  93. data/lib/lib/tdlib/func.rb +34 -0
  94. data/lib/lib/tdlib/init.rb +39 -0
  95. data/lib/lib/telegram/botapi.rb +71 -0
  96. data/lib/lib/telegram/infra_info.rb +50 -0
  97. data/lib/lib/telegram/wrappers.rb +41 -0
  98. data/lib/lib/tooling/lang.rb +24 -0
  99. data/lib/lib/tooling/log.rb +54 -0
  100. data/lib/lib/tooling/ruby.rb +25 -0
  101. data/lib/version.rb +3 -0
  102. data/logo.png +0 -0
  103. 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,7 @@
1
+ default_profile = "cli_{CLI_ID}";
2
+
3
+ cli_{CLI_ID} = {
4
+ config_directory = "{DIALOG_DIR}/_data/cli_{CLI_ID}/";
5
+ pfs_enabled = true;
6
+ log_level = 2;
7
+ };
@@ -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,11 @@
1
+ [Unit]
2
+ Description=Timer for dialog__sync
3
+ After=syslog.target network.target
4
+ [Install]
5
+ WantedBy=multi-user.target
6
+
7
+ [Timer]
8
+ OnBootSec=2min
9
+ OnUnitActiveSec=1min
10
+ Unit=dialog__sync.service
11
+
@@ -0,0 +1,6 @@
1
+ [Unit]
2
+ Description=Monitor /tmp/ready
3
+
4
+ [Path]
5
+ Unit=dialog_bot_pre@%i.service
6
+ PathChanged=/tmp/ready_%i
@@ -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,6 @@
1
+ [Unit]
2
+ Description=Monitor sqlite export
3
+
4
+ [Path]
5
+ Unit=dialog_bot_dev_pre@%i.service
6
+ PathChanged={RunPath}/_data/Dialect.sqlite
@@ -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,5 @@
1
+ cd ./_env
2
+
3
+ find . -mindepth 1 -not -path './_tmpl.bot' -print0 | while IFS= read -r -d $'\0' line; do
4
+ systemctl --user restart dialog_bot_pre@`echo $line|sed 's/^.\///'`.service
5
+ done
@@ -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,4 @@
1
+ include './engine/exec_conf/redis_global.conf'
2
+ unixsocket './redis.sock'
3
+ syslog-ident dialog_redis_{INSTANCE}
4
+ dir './_data/{INSTANCE}'
@@ -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
+ #