fastlane-plugin-telegram_sender 0.1.0 → 0.1.2
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/README.md +13 -5
- data/lib/fastlane/plugin/telegram_sender/actions/pin_message.rb +77 -0
- data/lib/fastlane/plugin/telegram_sender/actions/telegram_sender_action.rb +11 -2
- data/lib/fastlane/plugin/telegram_sender/actions/unpin_all.rb +69 -0
- data/lib/fastlane/plugin/telegram_sender/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2279c7ada556448daf2deb207b845e5b24685e57328c1dbf24457200ec4c4f2a
|
4
|
+
data.tar.gz: '09e57bcc52e966c8e62c45ae901c67c453418192ea16769b8b843e6a6aba2a06'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75faf430c75a163f7f83500cdb4f48ea8cf5f0485a22c7e3c82798a26a1cf7354cccab53b32359eb0ad5f3a69a15e94e3b68a9756874889f36613ee00982e763
|
7
|
+
data.tar.gz: f2cf46c15566ca7ec5372e2866c6a8afd7101c4a5dded66d23e59fde95c084bf7cb00e9617748b471838a81b17181964ecaaaed913b0732effe2c205c6139812
|
data/README.md
CHANGED
@@ -10,11 +10,19 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
10
10
|
fastlane add_plugin telegram_sender
|
11
11
|
```
|
12
12
|
|
13
|
-
## About
|
14
|
-
|
15
|
-
Allows post messages to telegram
|
16
|
-
|
17
|
-
|
13
|
+
## About telegram
|
14
|
+
|
15
|
+
Allows post messages to telegram chats and topics
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
telegram(
|
19
|
+
token: ENV['TG_BOT_TOKEN'], # get token from @BotFather
|
20
|
+
chat_id: ENV['TG_CHAT_ID'], # https://stackoverflow.com/questions/33858927/how-to-obtain-the-chat-id-of-a-private-telegram-channel
|
21
|
+
message_thread_id: ENV['TG_MESSAGE_THREAD_ID'], # message_thread_id of topic
|
22
|
+
animation: ENV['ANIMATION_ID'], # Pass a file_id as String to send an animation that exists on the Telegram servers
|
23
|
+
text: "Hello world, Telegram!" # Required
|
24
|
+
)
|
25
|
+
```
|
18
26
|
|
19
27
|
## Example
|
20
28
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class PinMessageAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message("Unpin all messages in a telegram chat")
|
6
|
+
|
7
|
+
token = params[:token]
|
8
|
+
chat_id = params[:chat_id]
|
9
|
+
message_id = params[:message_id]
|
10
|
+
|
11
|
+
uri = URI.parse("https://api.telegram.org/bot#{token}/pinChatMessage")
|
12
|
+
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
if params[:proxy]
|
15
|
+
proxy_uri = URI.parse(params[:proxy])
|
16
|
+
http = Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
|
17
|
+
end
|
18
|
+
http.use_ssl = true
|
19
|
+
|
20
|
+
require 'net/http/post/multipart'
|
21
|
+
request = Net::HTTP::Post::Multipart.new(uri,
|
22
|
+
{
|
23
|
+
"chat_id" => chat_id,
|
24
|
+
"message_id" => message_id,
|
25
|
+
"disable_notification" => true
|
26
|
+
})
|
27
|
+
|
28
|
+
response = http.request(request)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
"Allows unpin messages in a telegram chat"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
["dimariouz"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.return_value
|
40
|
+
response
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.details
|
44
|
+
"Allows unpin messages in a telegram chat"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.available_options
|
48
|
+
[
|
49
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
50
|
+
env_name: "TELEGRAM_TOKEN",
|
51
|
+
description: "A unique authentication token given when a bot is created",
|
52
|
+
optional: false,
|
53
|
+
type: String),
|
54
|
+
FastlaneCore::ConfigItem.new(key: :chat_id,
|
55
|
+
env_name: "TELEGRAM_CHAT_ID",
|
56
|
+
description: "Unique identifier for the target chat (not in the format @channel). For getting chat id you can send any message to your bot and get chat id from response https://api.telegram.org/botYOUR_TOKEN/getupdates",
|
57
|
+
optional: false,
|
58
|
+
type: String),
|
59
|
+
FastlaneCore::ConfigItem.new(key: :message_id,
|
60
|
+
env_name: "TELEGRAM_PIN_MESSAGE_ID",
|
61
|
+
description: "Unique identifier for the target message. For getting message id you can send any message to your bot and get chat id from response https://api.telegram.org/botYOUR_TOKEN/getupdates",
|
62
|
+
optional: true,
|
63
|
+
type: String),
|
64
|
+
FastlaneCore::ConfigItem.new(key: :proxy,
|
65
|
+
env_name: "TELEGRAM_PROXY",
|
66
|
+
description: "Proxy URL to be used in network requests. Example: (https://123.45.67.89:80)",
|
67
|
+
optional: true,
|
68
|
+
type: String)
|
69
|
+
]
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.is_supported?(platform)
|
73
|
+
true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -9,8 +9,11 @@ module Fastlane
|
|
9
9
|
message_thread_id = params[:message_thread_id]
|
10
10
|
text = params[:text]
|
11
11
|
parse_mode = params[:parse_mode]
|
12
|
+
animation = params[:animation]
|
12
13
|
|
13
|
-
|
14
|
+
method = (animation == nil ? "sendMessage" : "sendAnimation")
|
15
|
+
textParam = (animation == nil ? "text" : "caption")
|
16
|
+
uri = URI.parse("https://api.telegram.org/bot#{token}/#{method}")
|
14
17
|
|
15
18
|
http = Net::HTTP.new(uri.host, uri.port)
|
16
19
|
if params[:proxy]
|
@@ -24,7 +27,8 @@ module Fastlane
|
|
24
27
|
{
|
25
28
|
"chat_id" => chat_id,
|
26
29
|
"message_thread_id" => message_thread_id,
|
27
|
-
"
|
30
|
+
"#{textParam}" => text,
|
31
|
+
"animation" => animation,
|
28
32
|
"parse_mode" => parse_mode
|
29
33
|
})
|
30
34
|
|
@@ -64,6 +68,11 @@ module Fastlane
|
|
64
68
|
description: "Unique identifier for the target topic (not in the format @channel). For getting chat id you can send any message to your bot and get chat id from response https://api.telegram.org/botYOUR_TOKEN/getupdates",
|
65
69
|
optional: true,
|
66
70
|
type: String),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :animation,
|
72
|
+
env_name: "ANIMATION_ID",
|
73
|
+
description: "Pass a file_id as String to send an animation that exists on the Telegram servers",
|
74
|
+
optional: true,
|
75
|
+
type: String),
|
67
76
|
FastlaneCore::ConfigItem.new(key: :text,
|
68
77
|
env_name: "TELEGRAM_TEXT",
|
69
78
|
description: "Text of the message to be sent",
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class UnpinAllAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message("Unpin all messages in a telegram chat")
|
6
|
+
|
7
|
+
token = params[:token]
|
8
|
+
chat_id = params[:chat_id]
|
9
|
+
|
10
|
+
uri = URI.parse("https://api.telegram.org/bot#{token}/unpinAllChatMessages")
|
11
|
+
|
12
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
13
|
+
if params[:proxy]
|
14
|
+
proxy_uri = URI.parse(params[:proxy])
|
15
|
+
http = Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
|
16
|
+
end
|
17
|
+
http.use_ssl = true
|
18
|
+
|
19
|
+
require 'net/http/post/multipart'
|
20
|
+
request = Net::HTTP::Post::Multipart.new(uri,
|
21
|
+
{
|
22
|
+
"chat_id" => chat_id
|
23
|
+
})
|
24
|
+
|
25
|
+
response = http.request(request)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Allows unpin messages in a telegram chat"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.authors
|
33
|
+
["dimariouz"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.return_value
|
37
|
+
response
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.details
|
41
|
+
"Allows unpin messages in a telegram chat"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.available_options
|
45
|
+
[
|
46
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
47
|
+
env_name: "TELEGRAM_TOKEN",
|
48
|
+
description: "A unique authentication token given when a bot is created",
|
49
|
+
optional: false,
|
50
|
+
type: String),
|
51
|
+
FastlaneCore::ConfigItem.new(key: :chat_id,
|
52
|
+
env_name: "TELEGRAM_CHAT_ID",
|
53
|
+
description: "Unique identifier for the target chat (not in the format @channel). For getting chat id you can send any message to your bot and get chat id from response https://api.telegram.org/botYOUR_TOKEN/getupdates",
|
54
|
+
optional: false,
|
55
|
+
type: String),
|
56
|
+
FastlaneCore::ConfigItem.new(key: :proxy,
|
57
|
+
env_name: "TELEGRAM_PROXY",
|
58
|
+
description: "Proxy URL to be used in network requests. Example: (https://123.45.67.89:80)",
|
59
|
+
optional: true,
|
60
|
+
type: String)
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.is_supported?(platform)
|
65
|
+
true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-telegram_sender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Doroschuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,7 +159,9 @@ files:
|
|
159
159
|
- LICENSE
|
160
160
|
- README.md
|
161
161
|
- lib/fastlane/plugin/telegram_sender.rb
|
162
|
+
- lib/fastlane/plugin/telegram_sender/actions/pin_message.rb
|
162
163
|
- lib/fastlane/plugin/telegram_sender/actions/telegram_sender_action.rb
|
164
|
+
- lib/fastlane/plugin/telegram_sender/actions/unpin_all.rb
|
163
165
|
- lib/fastlane/plugin/telegram_sender/helper/telegram_sender_helper.rb
|
164
166
|
- lib/fastlane/plugin/telegram_sender/version.rb
|
165
167
|
homepage:
|