rtm

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicEvent

type BasicEvent struct {
	TypeStr  string
	RawEvent map[string]interface{}
}

func (BasicEvent) Type

func (e BasicEvent) Type() string

type BasicMessage

type BasicMessage struct {
	// contains filtered or unexported fields
}

func (BasicMessage) Channel

func (m BasicMessage) Channel() string

func (BasicMessage) Subtype

func (m BasicMessage) Subtype() string

func (BasicMessage) Text

func (m BasicMessage) Text() string

func (BasicMessage) Timestamp

func (m BasicMessage) Timestamp() string

func (BasicMessage) Type

func (m BasicMessage) Type() string

func (BasicMessage) User

func (m BasicMessage) User() string

type ChannelCreated

type ChannelCreated struct {
	ID      string
	Name    string
	Created int
	Creator string
}

func (ChannelCreated) Type

func (c ChannelCreated) Type() string

type ChannelRename

type ChannelRename struct {
	ID      string
	Name    string
	Created int
}

func (ChannelRename) Type

func (c ChannelRename) Type() string

type Conn

type Conn struct {
	Token string
	// contains filtered or unexported fields
}

func Dial

func Dial(token string) (conn *Conn, err error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) NextEvent

func (c *Conn) NextEvent() Event

NextEvent blocks until the next Event is sent and then returns it to the caller.

func (*Conn) SendMessage

func (c *Conn) SendMessage(text, channel string) error

func (Conn) UnescapeMessage

func (c Conn) UnescapeMessage(message string) string

UnescapeMessage takes in the escape string text of a message and returns a new string that appears as it would to a user.

UnescapeMessage does so by parsing escape sequences according to <https://api.slack.com/docs/formatting> and substituting the appropriate user-facing junk (e.g. <@UABC123> would become @firba1, assuming there's a user named firba1 with the user ID UABC123).

func (Conn) UnescapeMessagePostprocess added in v0.3.0

func (c Conn) UnescapeMessagePostprocess(
	message string,
	postprocessor func(userString string, escapeType EscapeType) string,
) string

type EscapeType added in v0.3.0

type EscapeType int
const (
	LinkEscape EscapeType = iota
	UserEscape
	ChannelEscape
	CommandEscape
)

type Event

type Event interface {
	Type() string
}

type Hello

type Hello struct{}

func (Hello) Type

func (h Hello) Type() string

type Message

type Message interface {
	Event
	Subtype() string
	Text() string
	User() string
	Channel() string
	Timestamp() string
}

Jump to

Keyboard shortcuts

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