Class: Fastlane::Actions::TelegramAction

Inherits:
Action
  • Object
show all
Includes:
FastlaneCraft
Defined in:
lib/fastlane-craft/telegram.rb

Constant Summary

Constants included from FastlaneCraft

FastlaneCraft::HTML, FastlaneCraft::MARKDOWN, FastlaneCraft::VERSION

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



72
73
74
# File 'lib/fastlane-craft/telegram.rb', line 72

def self.authors
  %w[sroik elfenlaid]
end

.available_optionsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fastlane-craft/telegram.rb', line 25

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :bot_api_token,
      env_name: 'FL_TELEGRAM_BOT_API_TOKEN',
      description: 'API Token for telegram bot',
      verify_block: proc do |value|
        msg = "No bot API token for TelegramAction given, pass using `bot_api_token: 'token'`"
        UI.user_error!(msg) unless value && !value.empty?
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :message,
      env_name: 'FL_TELEGRAM_MESSAGE',
      description: 'The message that should be displayed on Telegram',
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :chat_id,
      env_name: 'FL_TELEGRAM_CHAT_ID',
      description: 'telegram chat id',
      verify_block: proc do |value|
        msg = "No chat id for TelegramAction given, pass using `chat_id: 'chat id'`"
        UI.user_error!(msg) unless value && !value.empty?
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :parse_mode,
      env_name: 'FL_TELEGRAM_MESSAGE_PARSE_MODE',
      description: 'telegram message parse mode',
      optional: true
    )
  ]
end

.categoryObject



80
81
82
# File 'lib/fastlane-craft/telegram.rb', line 80

def self.category
  :notifications
end

.descriptionObject



17
18
19
# File 'lib/fastlane-craft/telegram.rb', line 17

def self.description
  'Send a success/error message to your Telegram group'
end

.detailsObject



21
22
23
# File 'lib/fastlane-craft/telegram.rb', line 21

def self.details
  'Send a success/error message to your Telegram group'
end

.example_codeObject



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fastlane-craft/telegram.rb', line 60

def self.example_code
  [
    'telegram(message: "App successfully released!")',
    'telegram(
      bot_api_token: "bot api token here",
      chat_id: "telegram chat id here",
      message: "message here"
      parse_mode: "message parse mode here"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/fastlane-craft/telegram.rb', line 76

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



8
9
10
11
# File 'lib/fastlane-craft/telegram.rb', line 8

def self.run(params)
  notifier = TelegramNotifier.new(bot_api_token: params[:bot_api_token], chat_id: params[:chat_id])
  notifier.notify(message: params[:message], parse_mode: params[:parse_mode])
end