class Caridina::Events::Message::Content

Overview

This event's content can have different fields according to its field #msgtype. Each available content is represent by its own type. To know which message event you are dealing with, you can use a case clause over the content's type.

case event.content
when Caridina::Events::Message::Text
  # handle a message
when Caridina::Events::Message::MSC2676::Text
  # handle a message edit
when Caridina::Events::Message::Unknown
  # Unknown message type, but you can still inspect `event.content.body` and
  # `event.content.msgtype`.
else
  # fallback
end

Matrix API

Included Modules

Direct Known Subclasses

Defined in:

caridina/events/modules/instant_messaging.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def body : String #

def msgtype : String #

def relates_to : RelatesTo | Nil #