Class: Rubirai::MusicShareMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/rubirai/messages/message.rb

Overview

The music share card message

Instance Attribute Summary collapse

Attributes inherited from Message

#bot, #type

Class Method Summary collapse

Methods inherited from Message

all_types, check_type, #to_h, to_message

Instance Attribute Details

#briefString? (readonly)

Returns the brief message (optional).

Returns:

  • (String, nil)

    the brief message (optional)



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#jump_urlString (readonly)

Returns the jump url.

Returns:

  • (String)

    the jump url



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#kindString (readonly)

Returns the kind of music provider.

Returns:

  • (String)

    the kind of music provider



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#music_urlString (readonly)

Returns the music's url.

Returns:

  • (String)

    the music's url



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#picture_urlString (readonly)

Returns the picture's url.

Returns:

  • (String)

    the picture's url



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#summaryString (readonly)

Returns the music card summary.

Returns:

  • (String)

    the music card summary



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

#titleString (readonly)

Returns the music card title.

Returns:

  • (String)

    the music card title



513
514
515
# File 'lib/rubirai/messages/message.rb', line 513

set_message :MusicShare, :kind, :title, :summary, :jump_url, :picture_url, :music_url, :brief do |hash|
  raise(RubiraiError, 'non valid music type') unless all_kinds.include? hash['kind']
end

Class Method Details

.all_kindsArray<String>

List all kinds of music providers

Returns:

  • (Array<String>)

    kinds



495
496
497
# File 'lib/rubirai/messages/message.rb', line 495

def self.all_kinds
  %w[NeteaseCloudMusic QQMusic MiguMusic]
end