Class: Discordrb::Commands::CommandEvent

Inherits:
Events::MessageEvent show all
Defined in:
lib/discordrb/commands/events.rb

Overview

Extension of MessageEvent for commands that contains the command called, makes the bot readable and adds a message to be saved

Instance Attribute Summary collapse

Attributes inherited from Events::MessageEvent

#message

Instance Method Summary collapse

Methods inherited from Events::MessageEvent

#from_bot?, #send_message

Constructor Details

#initialize(message, bot) ⇒ CommandEvent

Returns a new instance of CommandEvent.



9
10
11
12
# File 'lib/discordrb/commands/events.rb', line 9

def initialize(message, bot)
  super(message, bot)
  @saved_message = ''
end

Instance Attribute Details

#botObject (readonly)

Returns the value of attribute bot.



6
7
8
# File 'lib/discordrb/commands/events.rb', line 6

def bot
  @bot
end

#commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/discordrb/commands/events.rb', line 7

def command
  @command
end

#saved_messageObject (readonly)

Returns the value of attribute saved_message.



6
7
8
# File 'lib/discordrb/commands/events.rb', line 6

def saved_message
  @saved_message
end

Instance Method Details

#<<(message) ⇒ Object



14
15
16
17
# File 'lib/discordrb/commands/events.rb', line 14

def <<(message)
  @saved_message += "#{message}\n"
  nil
end