Documentation ¶
Index ¶
- func SendNotification(message string, room int)
- type ChatMessage
- func GetPlayerMessages(p *player.Player) ([]*ChatMessage, error)
- func GetRoomMessages(room int) ([]*ChatMessage, error)
- func GetScrollback(room int) ([]*ChatMessage, error)
- func NewBotMessage(message string, room int) *ChatMessage
- func NewChatMessage(message string, room int, player *player.Player) *ChatMessage
- func NewInGameChatMessage(lobbyID uint, player *player.Player, message string) *ChatMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendNotification ¶
Types ¶
type ChatMessage ¶
type ChatMessage struct { // Message ID ID uint `json:"id"` CreatedAt time.Time `json:"timestamp"` Player player.Player `json:"-"` PlayerID uint `json:"-"` // ID of the player who sent the message Room int `json:"room"` // room to which the message was sent Message string `json:"message" sql:"type:varchar(150)"` // the actual Message Deleted bool `json:"deleted"` // true if the message has been deleted by a moderator Bot bool `json:"bot"` // true if the message was sent by the notification "bot" InGame bool `json:"ingame"` // true if the message is in-game }
ChatMessage Represents a chat mesasge sent by a particular player
func GetPlayerMessages ¶
func GetPlayerMessages(p *player.Player) ([]*ChatMessage, error)
Return all messages sent by player to room
func GetRoomMessages ¶
func GetRoomMessages(room int) ([]*ChatMessage, error)
Return a list of ChatMessages spoken in room
func GetScrollback ¶
func GetScrollback(room int) ([]*ChatMessage, error)
Get a list of last 20 messages sent to room, used by frontend for displaying the chat history/scrollback
func NewBotMessage ¶
func NewBotMessage(message string, room int) *ChatMessage
func NewChatMessage ¶
func NewChatMessage(message string, room int, player *player.Player) *ChatMessage
Return a new ChatMessage sent from specficied player
func NewInGameChatMessage ¶
func NewInGameChatMessage(lobbyID uint, player *player.Player, message string) *ChatMessage
func (*ChatMessage) MarshalJSON ¶
func (m *ChatMessage) MarshalJSON() ([]byte, error)
func (*ChatMessage) Save ¶
func (m *ChatMessage) Save()
func (*ChatMessage) Send ¶
func (m *ChatMessage) Send()
Click to show internal directories.
Click to hide internal directories.