boppers 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gems.locked +1 -1
- data/lib/boppers/notifier/telegram.rb +7 -10
- data/lib/boppers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77306f9f179e0f4e7fe5cc73db627c7029b3dcf4
|
4
|
+
data.tar.gz: 86ec66cb44941b313083fc0c1049fb24b8d12261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 628e66d5e17e3161de9178b30e9ea554b9499ccd35789f3c80f2c26a919f89e97875b24371b3ebd2d44a1287aefc7bb37e8cce8c316e72a4261cb6071f25c503
|
7
|
+
data.tar.gz: 567b790974604ffaaeb7ec2735db15765b537790368ff9739d8ef031a69d0769f5bf2a4255f53bd85d37d7f4e9d45ae7627626908473ce8d28d0fd23c51f7587
|
data/gems.locked
CHANGED
@@ -6,28 +6,25 @@ module Boppers
|
|
6
6
|
attr_reader :api_token, :channel_id, :subscribe
|
7
7
|
|
8
8
|
def initialize(api_token:, channel_id:, subscribe: nil)
|
9
|
-
require "telegram_bot"
|
10
|
-
|
11
9
|
@api_token = api_token
|
12
10
|
@channel_id = channel_id
|
13
11
|
@subscribe = subscribe
|
14
12
|
end
|
15
13
|
|
16
14
|
def call(title, message, options)
|
15
|
+
context = self
|
17
16
|
telegram_options = options.fetch(:telegram, {})
|
18
17
|
title = telegram_options.delete(:title) { title }
|
19
18
|
message = telegram_options.delete(:message) { message }
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
notification.chat = TelegramBot::Channel.new(id: channel_id)
|
24
|
-
notification.text = "#{title}\n\n#{message}"
|
20
|
+
telegram_options[:text] = "#{title}\n\n#{message}"
|
21
|
+
telegram_options[:chat_id] = channel_id
|
25
22
|
|
26
|
-
|
27
|
-
|
23
|
+
HttpClient.post do
|
24
|
+
url "https://api.telegram.org/bot#{context.api_token}/sendMessage"
|
25
|
+
params telegram_options
|
26
|
+
options expect: 200
|
28
27
|
end
|
29
|
-
|
30
|
-
notification.send_with(bot)
|
31
28
|
end
|
32
29
|
end
|
33
30
|
end
|
data/lib/boppers/version.rb
CHANGED