Class: Rubirai::MessageEvent Abstract
- Defined in:
- lib/rubirai/events/message_events.rb,
lib/rubirai/message.rb
Overview
This class is abstract.
The base class for message events
Direct Known Subclasses
Instance Attribute Summary collapse
-
#message_chain ⇒ MessageChain
readonly
The message chain.
-
#sender ⇒ User
readonly
The sender.
Attributes inherited from Event
Instance Method Summary collapse
-
#respond(*msgs, quote: false) ⇒ Integer
Respond to a message event.
Methods inherited from Event
parse, #parse_val_from_key, set_event, type_to_klass, valid_type?
Instance Attribute Details
#message_chain ⇒ MessageChain (readonly)
Returns the message chain.
13 |
# File 'lib/rubirai/events/message_events.rb', line 13 set_event nil, :message_chain, :sender |
#sender ⇒ User (readonly)
Returns the sender.
13 |
# File 'lib/rubirai/events/message_events.rb', line 13 set_event nil, :message_chain, :sender |
Instance Method Details
#respond(*msgs, quote: false) ⇒ Integer
Respond to a message event
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/rubirai/message.rb', line 125 def respond(*msgs, quote: false) check_bot quote_id = quote ? (@message_chain.id || nil) : nil case self when FriendMessageEvent @bot.send_friend_msg(@sender.id, *msgs, quote: quote_id) when GroupMessageEvent @bot.send_group_msg(@sender.group.id, *msgs, quote: quote_id) when TempMessageEvent @bot.send_temp_msg(@sender.id, @sender.group.id, *msgs, quote: quote_id) else raise 'undefined error' end end |