Class: MatrixQQ::Matrix::Forward::Group
- Inherits:
-
Object
- Object
- MatrixQQ::Matrix::Forward::Group
- Defined in:
- lib/matrix_qq/matrix/forward/group.rb
Overview
send to qq group
Instance Method Summary collapse
- #format_matrix_message(msg, name, type = 'm.text') ⇒ Object
-
#initialize(dbus, matrix, info, room) ⇒ Group
constructor
A new instance of Group.
- #message(msg, name, type, room = '') ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(dbus, matrix, info, room) ⇒ Group
Returns a new instance of Group.
6 7 8 9 10 11 |
# File 'lib/matrix_qq/matrix/forward/group.rb', line 6 def initialize(dbus, matrix, info, room) @dbus = dbus @info = info @matrix = matrix @room = room end |
Instance Method Details
#format_matrix_message(msg, name, type = 'm.text') ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/matrix_qq/matrix/forward/group.rb', line 22 def (msg, name, type = 'm.text') room = "{#{@info['send_room']}} " if @info['print_room'] return "#{room}#{name} 发送了一条消息" if msg =~ /^-msg / return '有人发送了一条消息' if msg =~ /^-all / return if msg =~ /^- / info = type.match(/^m\./).post_match info ||= 'text' msg, name, info, room end |
#message(msg, name, type, room = '') ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/matrix_qq/matrix/forward/group.rb', line 33 def (msg, name, type, room = '') case type when 'text' m = msg.match(/^-name /) m ? m.post_match : "#{room}[#{name}] #{msg}" when 'notice' then "#{room}[#{name}] notice #{msg}" when 'emote' then "#{room}#{name} #{msg}" else "#{room}#{name} send a #{type}" end end |