chat

package
v0.0.0-...-7e6db5d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	MessageChan chan Message
	// contains filtered or unexported fields
}

func Connect

func Connect(ctx context.Context, wsUrl, jwt string) (*Chat, error)

func (*Chat) Send

func (c *Chat) Send(message string) error

func (*Chat) SendPriv

func (c *Chat) SendPriv(recipient Chatter, message string) error

type Chatter

type Chatter string

type Message

type Message struct {
	Raw     []byte `json:"-"`
	Private bool   `json:"-"`

	Sender    Chatter       `json:"nick"`
	Features  []UserFeature `json:"features"`
	Timestamp int64         `json:"timestamp"`
	Data      string        `json:"data"`
	Entities  struct {
		Nicks []struct {
			Nick   string `json:"nick"`
			Bounds []int  `json:"bounds"`
		} `json:"nicks"`
	} `json:"entities"`
}

func (Message) Mentions

func (m Message) Mentions(nick Chatter) bool

Addresses returns true if it the message mentions the provided nick

func (Message) Mod

func (m Message) Mod() bool

Mod returns true if it the message was sent by a mod

func (Message) WithoutNick

func (m Message) WithoutNick(nick Chatter) string

type UserFeature

type UserFeature string
const (
	FeatureMod UserFeature = "moderator"
)

Jump to

Keyboard shortcuts

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