fastlane-plugin-telegram_sender 0.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81729af09c7148d8a877739d10ea2338868b1052f80477f81099403b09a2a44a
4
- data.tar.gz: 5945a4cddfb132b766ea7fedb36a6e256e7dac59f9c2afa93331d723393766e8
3
+ metadata.gz: 2279c7ada556448daf2deb207b845e5b24685e57328c1dbf24457200ec4c4f2a
4
+ data.tar.gz: '09e57bcc52e966c8e62c45ae901c67c453418192ea16769b8b843e6a6aba2a06'
5
5
  SHA512:
6
- metadata.gz: 0a51e0dd1b93c4dd8a0b9a8213ed11817f94d44749acb875ebc6da7e96230f5498820186b6b91e8f2100497e07d57b5adf4243747479f1da0fc5dfa5e85b22cb
7
- data.tar.gz: 82e6ba68fa9e4b9c03d5fe34efd2855d54638ea957ff0148dec6bd94e641d71079358e6de763b23c6f79666086c47aea42fa1572f912dadccab033ae88714cec
6
+ metadata.gz: 75faf430c75a163f7f83500cdb4f48ea8cf5f0485a22c7e3c82798a26a1cf7354cccab53b32359eb0ad5f3a69a15e94e3b68a9756874889f36613ee00982e763
7
+ data.tar.gz: f2cf46c15566ca7ec5372e2866c6a8afd7101c4a5dded66d23e59fde95c084bf7cb00e9617748b471838a81b17181964ecaaaed913b0732effe2c205c6139812
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TelegramSender
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  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.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-01-21 00:00:00.000000000 Z
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: