Class: MatrixQQ::QQ::ForwardFriend::Matrix

Inherits:
Object
  • Object
show all
Defined in:
lib/matrix_qq/qq/forward_friend/matrix.rb

Instance Method Summary collapse

Constructor Details

#initialize(dbus, matrix, info, room) ⇒ Matrix

Returns a new instance of Matrix.



5
6
7
8
9
10
# File 'lib/matrix_qq/qq/forward_friend/matrix.rb', line 5

def initialize(dbus, matrix, info, room)
  @dbus = dbus
  @info = info
  @matrix = matrix
  @room = room
end

Instance Method Details

#message(messages) ⇒ Object



20
21
22
23
24
# File 'lib/matrix_qq/qq/forward_friend/matrix.rb', line 20

def message(messages)
  messages.inject('') do |obj, msg|
    obj + QQ.cq_call(msg)
  end
end

#runObject



12
13
14
15
16
17
18
# File 'lib/matrix_qq/qq/forward_friend/matrix.rb', line 12

def run
  msg = message @info['message']
  sender = "[#{user @info['user_id']}] " if @info['print_sender']
  MatrixQQ::Matrix::Send.text \
    @matrix, @room,
    "#{sender}#{msg}"
end

#user(user) ⇒ Object



26
27
28
# File 'lib/matrix_qq/qq/forward_friend/matrix.rb', line 26

def user(user)
  @dbus.get_stranger_info(user_id: user)['nickname']
end