fastlane-plugin-telegram_plus 0.1.0
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 +7 -0
- data/LICENSE +22 -0
- data/README.md +63 -0
- data/lib/fastlane/plugin/telegram.rb +1 -0
- data/lib/fastlane/plugin/telegram_plus/actions/telegram_action.rb +144 -0
- data/lib/fastlane/plugin/telegram_plus/helper/telegram_plus_helper.rb +12 -0
- data/lib/fastlane/plugin/telegram_plus/version.rb +5 -0
- data/lib/fastlane/plugin/telegram_plus.rb +17 -0
- metadata +173 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: edefcb097a7611a51784d6be7b3be9e23e68ebeadbf6fc78ca6dfd75ff95e2ba
|
|
4
|
+
data.tar.gz: e7936cf4f66205d782b484908f8ad6a6d8db31b65697a27faa4adf8551c7cb03
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 887a2ad3b19747dea00f1112f7c93124613792161137ca96323bde2fedf1dc8430b56fbd899c834d5e07af7b3f9ea0dacbefc7923159e89fc650360e2c23c120
|
|
7
|
+
data.tar.gz: ef620b362aded29009c082bf55d863bf5b5055910ff3131e237caed3e11a21ef89640a087bad2142e017b9aa0bfc2501ca933d9e75fc66bf0bc00e235d4a5362
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 sergpetrov <s.a.petrov.spb@gmail.com>
|
|
4
|
+
Copyright (c) 2026 Maxim Feduishkin <maksihill@yandex.ru>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# telegram_plus plugin
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-telegram_plus)
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-telegram_plus`, add it to your project by running:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
fastlane add_plugin telegram_plus
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The action name remains `telegram`.
|
|
14
|
+
|
|
15
|
+
## About telegram_plus
|
|
16
|
+
|
|
17
|
+
Allows posting messages and documents to Telegram chats from fastlane.
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
telegram(
|
|
21
|
+
token: ENV['TG_BOT_TOKEN'], # get token from @BotFather
|
|
22
|
+
chat_id: ENV['TG_CHAT_ID'], # https://stackoverflow.com/questions/33858927/how-to-obtain-the-chat-id-of-a-private-telegram-channel
|
|
23
|
+
text: "Hello world, Telegram!", # Required
|
|
24
|
+
file: "file.pdf", # Optional. Please note, Bots can currently send files of any type of up to 50 MB in size.
|
|
25
|
+
mime_type: "application/pdf", # Required if file exists
|
|
26
|
+
message_thread_id: 42 # Optional. Telegram forum topic/thread id
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
|
33
|
+
|
|
34
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
|
35
|
+
|
|
36
|
+
## Run tests for this plugin
|
|
37
|
+
|
|
38
|
+
To run both the tests, and code style validation, run
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
rake
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To automatically fix many of the styling issues, use
|
|
45
|
+
```
|
|
46
|
+
rubocop -a
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Issues and Feedback
|
|
50
|
+
|
|
51
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
|
52
|
+
|
|
53
|
+
## Troubleshooting
|
|
54
|
+
|
|
55
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
|
56
|
+
|
|
57
|
+
## Using _fastlane_ Plugins
|
|
58
|
+
|
|
59
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
|
60
|
+
|
|
61
|
+
## About _fastlane_
|
|
62
|
+
|
|
63
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'fastlane/plugin/telegram_plus'
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
module Fastlane
|
|
2
|
+
module Actions
|
|
3
|
+
class TelegramAction < Action
|
|
4
|
+
def self.run(params)
|
|
5
|
+
UI.message('Sending message to a telegram channel')
|
|
6
|
+
|
|
7
|
+
token = params[:token]
|
|
8
|
+
chat_id = params[:chat_id]
|
|
9
|
+
text = params[:text]
|
|
10
|
+
parse_mode = params[:parse_mode]
|
|
11
|
+
message_thread_id = params[:message_thread_id]
|
|
12
|
+
file_path = params[:file]
|
|
13
|
+
mime_type = params[:mime_type]
|
|
14
|
+
|
|
15
|
+
file = nil
|
|
16
|
+
unless file_path.nil?
|
|
17
|
+
if File.exist?(file_path)
|
|
18
|
+
if mime_type.nil?
|
|
19
|
+
UI.user_error!('The mime type, required for send file')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
file = UploadIO.new(file_path, mime_type)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
if !file_path.nil? && file.nil?
|
|
27
|
+
UI.message("Can't find file on path location")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
method = (file.nil? ? 'sendMessage' : 'sendDocument')
|
|
31
|
+
uri = URI.parse("https://api.telegram.org/bot#{token}/#{method}")
|
|
32
|
+
|
|
33
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
34
|
+
if params[:proxy]
|
|
35
|
+
proxy_uri = URI.parse(params[:proxy])
|
|
36
|
+
http = Net::HTTP.new(uri.host,
|
|
37
|
+
uri.port,
|
|
38
|
+
proxy_uri.host,
|
|
39
|
+
proxy_uri.port,
|
|
40
|
+
proxy_uri.user,
|
|
41
|
+
proxy_uri.password)
|
|
42
|
+
end
|
|
43
|
+
http.use_ssl = true
|
|
44
|
+
|
|
45
|
+
require 'net/http/post/multipart'
|
|
46
|
+
text_parameter = (file.nil? ? 'text' : 'caption')
|
|
47
|
+
request_params = {
|
|
48
|
+
'chat_id' => chat_id,
|
|
49
|
+
text_parameter => text,
|
|
50
|
+
'parse_mode' => parse_mode,
|
|
51
|
+
'document' => file
|
|
52
|
+
}
|
|
53
|
+
unless message_thread_id.nil?
|
|
54
|
+
request_params['message_thread_id'] = message_thread_id.to_s
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
request = Net::HTTP::Post::Multipart.new(uri, request_params)
|
|
58
|
+
|
|
59
|
+
http.request(request)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.description
|
|
63
|
+
'Allows posting messages to Telegram chats'
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.authors
|
|
67
|
+
['Maxim Feduishkin']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.return_value
|
|
71
|
+
'Telegram API response'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.details
|
|
75
|
+
'Allows posting messages and documents to Telegram chats'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.available_options
|
|
79
|
+
[
|
|
80
|
+
FastlaneCore::ConfigItem.new(
|
|
81
|
+
key: :token,
|
|
82
|
+
env_name: 'TELEGRAM_TOKEN',
|
|
83
|
+
description: 'Bot authentication token',
|
|
84
|
+
optional: false,
|
|
85
|
+
type: String
|
|
86
|
+
),
|
|
87
|
+
FastlaneCore::ConfigItem.new(
|
|
88
|
+
key: :chat_id,
|
|
89
|
+
env_name: 'TELEGRAM_CHAT_ID',
|
|
90
|
+
description: 'Unique identifier for the target chat',
|
|
91
|
+
optional: false,
|
|
92
|
+
type: String
|
|
93
|
+
),
|
|
94
|
+
FastlaneCore::ConfigItem.new(
|
|
95
|
+
key: :text,
|
|
96
|
+
env_name: 'TELEGRAM_TEXT',
|
|
97
|
+
description: 'Text of the message to be sent',
|
|
98
|
+
optional: false,
|
|
99
|
+
type: String
|
|
100
|
+
),
|
|
101
|
+
FastlaneCore::ConfigItem.new(
|
|
102
|
+
key: :file,
|
|
103
|
+
env_name: 'TELEGRAM_FILE',
|
|
104
|
+
description: 'File path to the file to be sent',
|
|
105
|
+
optional: true,
|
|
106
|
+
type: String
|
|
107
|
+
),
|
|
108
|
+
FastlaneCore::ConfigItem.new(
|
|
109
|
+
key: :mime_type,
|
|
110
|
+
env_name: 'TELEGRAM_FILE_MIME_TYPE',
|
|
111
|
+
description: 'Mime type of file to be sent',
|
|
112
|
+
optional: true,
|
|
113
|
+
type: String
|
|
114
|
+
),
|
|
115
|
+
FastlaneCore::ConfigItem.new(
|
|
116
|
+
key: :parse_mode,
|
|
117
|
+
env_name: 'TELEGRAM_PARSE_MODE',
|
|
118
|
+
description: 'Parse mode: Markdown or HTML',
|
|
119
|
+
optional: true,
|
|
120
|
+
type: String
|
|
121
|
+
),
|
|
122
|
+
FastlaneCore::ConfigItem.new(
|
|
123
|
+
key: :message_thread_id,
|
|
124
|
+
env_name: 'TELEGRAM_MESSAGE_THREAD_ID',
|
|
125
|
+
description: 'Telegram forum topic id',
|
|
126
|
+
optional: true,
|
|
127
|
+
type: Integer
|
|
128
|
+
),
|
|
129
|
+
FastlaneCore::ConfigItem.new(
|
|
130
|
+
key: :proxy,
|
|
131
|
+
env_name: 'TELEGRAM_PROXY',
|
|
132
|
+
description: 'Proxy URL for network requests',
|
|
133
|
+
optional: true,
|
|
134
|
+
type: String
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def self.is_supported?(_platform)
|
|
140
|
+
true
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Fastlane
|
|
2
|
+
module Helper
|
|
3
|
+
class TelegramPlusHelper
|
|
4
|
+
# class methods that you define here become available in your action
|
|
5
|
+
# as `Helper::TelegramPlusHelper.your_method`
|
|
6
|
+
#
|
|
7
|
+
def self.show_message
|
|
8
|
+
UI.message('Hello from the telegram_plus plugin helper!')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'fastlane/plugin/telegram_plus/version'
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module TelegramPlus
|
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
|
6
|
+
def self.all_classes
|
|
7
|
+
pattern = 'telegram_plus/**/{actions,helper}/*.rb'
|
|
8
|
+
Dir[File.expand_path(pattern, File.dirname(__FILE__))]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# By default we want to import all available actions and helpers
|
|
14
|
+
# A plugin can contain any number of actions and plugins
|
|
15
|
+
Fastlane::TelegramPlus.all_classes.each do |current|
|
|
16
|
+
require current
|
|
17
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fastlane-plugin-telegram_plus
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Maxim Feduishkin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-06-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: multipart-post
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.10'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.10'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.12'
|
|
48
|
+
- - "<"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '2.0'
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '1.12'
|
|
58
|
+
- - "<"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rspec
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '3.6'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '3.6'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: rake
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '12.0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '12.0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: rubocop
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 0.49.1
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 0.49.1
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: simplecov
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0.15'
|
|
110
|
+
type: :development
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0.15'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: fastlane
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '2.53'
|
|
124
|
+
- - ">="
|
|
125
|
+
- !ruby/object:Gem::Version
|
|
126
|
+
version: 2.53.1
|
|
127
|
+
type: :development
|
|
128
|
+
prerelease: false
|
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - "~>"
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '2.53'
|
|
134
|
+
- - ">="
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: 2.53.1
|
|
137
|
+
description:
|
|
138
|
+
email: maksihill@yandex.ru
|
|
139
|
+
executables: []
|
|
140
|
+
extensions: []
|
|
141
|
+
extra_rdoc_files: []
|
|
142
|
+
files:
|
|
143
|
+
- LICENSE
|
|
144
|
+
- README.md
|
|
145
|
+
- lib/fastlane/plugin/telegram.rb
|
|
146
|
+
- lib/fastlane/plugin/telegram_plus.rb
|
|
147
|
+
- lib/fastlane/plugin/telegram_plus/actions/telegram_action.rb
|
|
148
|
+
- lib/fastlane/plugin/telegram_plus/helper/telegram_plus_helper.rb
|
|
149
|
+
- lib/fastlane/plugin/telegram_plus/version.rb
|
|
150
|
+
homepage: https://github.com/Kislotkaa/fastlane_telegram_plus
|
|
151
|
+
licenses:
|
|
152
|
+
- MIT
|
|
153
|
+
metadata: {}
|
|
154
|
+
post_install_message:
|
|
155
|
+
rdoc_options: []
|
|
156
|
+
require_paths:
|
|
157
|
+
- lib
|
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
|
+
requirements:
|
|
160
|
+
- - ">="
|
|
161
|
+
- !ruby/object:Gem::Version
|
|
162
|
+
version: '0'
|
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
|
+
requirements:
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: '0'
|
|
168
|
+
requirements: []
|
|
169
|
+
rubygems_version: 3.0.3.1
|
|
170
|
+
signing_key:
|
|
171
|
+
specification_version: 4
|
|
172
|
+
summary: Posts Telegram messages from fastlane
|
|
173
|
+
test_files: []
|