rtm

package
v0.0.0-...-2ff72c0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeHello      MessageType = "hello"
	MessageTypeMessage                = "message"
	MessageTypeUserTyping             = "user_typing"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	MessageBase
	Hello      MessageHello
	Message    MessageMessage
	UserTyping MessageUserTyping
}

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

type MessageBase

type MessageBase struct {
	Type MessageType `json:"type"`
}

type MessageHello

type MessageHello struct {
}

type MessageMessage

type MessageMessage struct {
	Channel   string `json:"channel"`
	User      string `json:"user"`
	Text      string `json:"text"`
	Timestamp string `json:"ts"`
}

type MessageType

type MessageType string

type MessageUserTyping

type MessageUserTyping struct {
	Channel string `json:"channel"`
	User    string `json:"user"`
}

type Session

type Session struct {
	Conn *websocket.Conn
	State
	Incoming   <-chan Message
	OutgoingID int
}

func StartSession

func StartSession(slack *slack.Slack) (*Session, error)

func (*Session) SendMessage

func (s *Session) SendMessage(channel, text string) error

type State

type State struct {
	Self  slack.User   `json:"self"`
	Users []slack.User `json:"users"`
}

func (*State) FindUser

func (s *State) FindUser(ID string) *slack.User

Jump to

Keyboard shortcuts

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