Version: v0.0.0-...-f5ab1f4 Latest Latest

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 2 Imported by: 0



Package message defines in/out message types.



This section is empty.


This section is empty.


This section is empty.


type InMessage

type InMessage struct {
	Sender      Sender
	Matches     []string // captured strings in the pattern
	Type        Type
	ChannelID   string
	ChannelName string
	UserID      string
	UserName    string
	Text        string
	RawMessage  interface{} // adapter's raw message data

InMessage represents an incoming message.

func (*InMessage) MentionName

func (in *InMessage) MentionName() string

MentionName returns the name of mentioned user.

func (*InMessage) MentionlessText

func (in *InMessage) MentionlessText() string

MentionlessText returns the text which is trimmed the mention part.

func (*InMessage) Reply

func (in *InMessage) Reply(text string) error

Reply sends a reply message to the sender.

type OutMessage

type OutMessage struct {
	ChannelID   string
	ChannelName string
	UserName    string
	IconURL     string
	Text        string
	InReplyTo   *InMessage // reply target message
	TriggeredBy *InMessage // trigger source message

OutMessage represents an outgoing message.

type Sender

type Sender interface {
	Send(*OutMessage) error
	SenderName() string

Sender is a message sender.

type Type

type Type uint

Type is a message type.

const (
	// UnknownMessage means the message is unknown type.
	UnknownMessage Type = 0

	// PublicMessage means the message is a public message.
	PublicMessage Type = 1 << iota

	// MentionMessage means the message is a mention and reply message.

	// DirectMessage means the message is a direct(private) message.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL