【发布时间】:2017-08-13 22:24:19
【问题描述】:
我目前在 Cloud9 上使用 XMPP4R。
conference.on_message {|time, nick, text|
case text
when /regex/i
#Same Command as on_private_message
end
end
}
conference.on_private_message {|time,nick, text|
case text
when /regex/i
#Same Command as on_message
end
end
}
conference.on_message 是会议的聊天消息,conference.on_private_message 是会议的私人消息聊天。
我想让 on_message 和 on_private_message 都作为 1 而不是上面显示的 2。
我尝试过这样的事情(如下),但它只工作conference.on_private_message。我怎样才能使它成为可能?
(conference.on_message || conference.on_private_message) { |time, nick, text|
case text
when /regex/i
#Same Command on both on_message and on_private_message
end
end
}
【问题讨论】:
标签: ruby-on-rails ruby c9.io xmpp4r