Class: Arkaan::Chatrooms::Message

Inherits:
Object
  • Object
show all
Includes:
Arkaan::Concerns::Enumerable, Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/arkaan/chatrooms/message.rb

Overview

This model represents an in-game tchat message sent in the tchat of a campaign.

Author:

Instance Attribute Summary collapse

Instance Attribute Details

#campaignArkaan::Chatrooms::Campaign

Returns the chatroom in which the message has been emitted.

Returns:



27
# File 'lib/arkaan/chatrooms/message.rb', line 27

belongs_to :chatroom, class_name: 'Arkaan::Chatrooms::Campaign', inverse_of: :messages

#dataHash

Returns the additional data passed to the message (arguments of the command, or content of the text).

Returns:

  • (Hash)

    the additional data passed to the message (arguments of the command, or content of the text)



17
# File 'lib/arkaan/chatrooms/message.rb', line 17

field :data, type: Hash, default: {}

#deletedBoolean

Returns TRUE if the message has been marked as deleted by its user, FALSE otherwise.

Returns:

  • (Boolean)

    TRUE if the message has been marked as deleted by its user, FALSE otherwise.



23
# File 'lib/arkaan/chatrooms/message.rb', line 23

field :deleted, type: Boolean, default: false

#playerArkaan::Account

Returns the account that has emitted the message in the campaign.

Returns:

  • (Arkaan::Account)

    the account that has emitted the message in the campaign.



30
# File 'lib/arkaan/chatrooms/message.rb', line 30

belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :messages

#rawString

Returns the content as typed by the user, without any parsing or transformation.

Returns:

  • (String)

    the content as typed by the user, without any parsing or transformation.



20
# File 'lib/arkaan/chatrooms/message.rb', line 20

field :raw, type: String, default: ''

#typeSymbol

Returns the type of message (plain text or command) contained in the data, used to display it.

Returns:

  • (Symbol)

    the type of message (plain text or command) contained in the data, used to display it.



14
# File 'lib/arkaan/chatrooms/message.rb', line 14

enum_field :type, %i[text command], default: :text