Method: WeChat::Bot::Message#reply

Defined in:
lib/wechat/bot/message.rb

#reply(text, **args) ⇒ Object

回复消息



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/wechat/bot/message.rb', line 78

def reply(text, **args)
  to_user = args[:username] || @from.username
  to_user = @bot.contact_list.find(nickname: args[:nickname]) if args[:nickname]

  message_type = args[:type] || :text

  # if @bot.config.special_users.include?(to_user) && to_user != 'filehelper'
  #   @bot.logger.error "特殊账户无法回复: #{to_user}"
  #   raise NoReplyException, "特殊账户无法回复: #{to_user}"
  # end

  @bot.client.send(message_type, to_user, text)
end