Class: Pindo::Command::Feishu::SendMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/pindo/command/feishu/send_message.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ SendMessage

Returns a new instance of SendMessage.



16
17
18
19
20
21
22
# File 'lib/pindo/command/feishu/send_message.rb', line 16

def initialize(options)
  @options = options
  @webhook_url = options[:webhook_url]
  @message = options[:message]
  @title = options[:title] || "通知"
  @at_all = options[:at_all] || false
end

Class Method Details

.run(options) ⇒ Object



12
13
14
# File 'lib/pindo/command/feishu/send_message.rb', line 12

def self.run(options)
  new(options).run
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pindo/command/feishu/send_message.rb', line 24

def run
  unless @webhook_url
    puts "错误:未提供飞书 webhook URL"
    return false
  end

  unless @message
    puts "错误:未提供消息内容"
    return false
  end

  send_message
end