m

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package m provides Matrix-namespace events.

Index

Constants

View Source
const FullyReadEventType event.Type = "m.fully_read"

FullyReadEventType is the event type for m.fully_read.

View Source
const ReactionEventType event.Type = "m.reaction"

ReactionEventType is the event type for m.reaction.

View Source
const SpaceChildEventType = "m.space.child"

SpaceChildEventType is the event type for m.space.child.

View Source
const SpaceParentEventType = "m.space.parent"

SpaceParentEventType is the event type for m.space.parent.

Variables

This section is empty.

Functions

func MarshalFullyReadEvent

func MarshalFullyReadEvent(ev FullyReadEvent) event.RawEvent

MarshalFullyReadEvent marshals the given fully read event.

Types

type DiscordMember

type DiscordMember struct {
	ID           uint64        `json:"id,string"`
	Username     string        `json:"username"`
	Roles        []DiscordRole `json:"roles"`
	DisplayColor uint32        `json:"displayColor"`
	Bot          bool          `json:"bot"`
}

DiscordMember describes a Discord member, which sits inside a field labeled "uk.half-shot.discord.member" in the RoomMemberEvent.

func DiscordMemberFromMatrix

func DiscordMemberFromMatrix(m *event.RoomMemberEvent) *DiscordMember

DiscordMemberFromMatrix returns the DiscordMember of the given Matrix member event, if any.

func (DiscordMember) DisplayHexColor

func (m DiscordMember) DisplayHexColor() string

DisplayHexColor returns the DisplayColor in hexadecimal w/ the # prefix.

type DiscordRole

type DiscordRole struct {
	Name     string `json:"name"`
	Position int    `json:"position"`
	Color    uint32 `json:"color"`
}

DiscordRole describes the role of a Discord user.

type FullyReadEvent

type FullyReadEvent struct {
	FullyReadEventInfo `json:"-"`
	// EventID is the event the user's read marker is located at in the room.
	EventID matrix.EventID `json:"event_id"`
}

FullyReadEvent describes the m.fully_read event.

type FullyReadEventInfo

type FullyReadEventInfo struct {
	event.EventInfo
	// RoomID is the room that the event read marker belongs to.
	RoomID matrix.RoomID `json:"room_id"`
}

FullyReadEventInfo is the information outside the content piece of FullyReadEvent.

type NotificationCount

type NotificationCount struct {
	Highlight    int `json:"highlight_count,omitempty"`
	Notification int `json:"notification_count,omitempty"`
}

NotificationCount is the struct type inside api.SyncJoinedRoomEvents.UnreadCount.

type ReactionEvent

type ReactionEvent struct {
	event.RoomEventInfo `json:"-"`

	RelatesTo ReactionRelatesTo `json:"m.relates_to"`
}

ReactionEvent is a reaction event of type m.reaction.

type ReactionRelatesTo

type ReactionRelatesTo struct {
	RelType RelType        `json:"rel_type"` // often m.annotation
	EventID matrix.EventID `json:"event_id"`
	Key     string         `json:"key"`
}

ReactionRelatesTo is the type of the relates_to object inside an m.reaction.

type RelType

type RelType string

RelType is the type for the "m.relates_to".rel_type field.

const (
	Annotation RelType = "m.annotation"
	Replace    RelType = "m.replace"
)

type SpaceChildEvent

type SpaceChildEvent struct {
	event.StateEventInfo `json:"-"`

	Via       []string `json:"via"`
	Order     string   `json:"order,omitempty"`
	Suggested bool     `json:"suggested,omitempty"`
}

SpaceChildEvent is an event emitted by space rooms to advertise children rooms.

func (*SpaceChildEvent) ChildRoomID

func (ev *SpaceChildEvent) ChildRoomID() matrix.RoomID

ChildRoomID returns the room ID that this space child event describes.

type SpaceParentEvent

type SpaceParentEvent struct {
	event.StateEventInfo `json:"-"`

	Via       []string `json:"via"`
	Canonical bool     `json:"canonical,omitempty"`
}

SpaceParentEvent is an event emitted by children rooms to advertise spaces.

func (*SpaceParentEvent) SpaceRoomID

func (ev *SpaceParentEvent) SpaceRoomID() matrix.RoomID

SpaceRoomID returns the room ID that this space child event describes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL