slackclient

package
v0.0.0-...-d2eaf0a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	ID   int
	Text string
}

type BotProfile

type BotProfile struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Cache

type Cache struct {
	Channels map[string]string
	Users    map[string]string
}

type Channel

type Channel struct {
	ID         string
	Name       string
	Is_Channel bool
}

type ChannelInfoResponse

type ChannelInfoResponse struct {
	Ok      bool
	Channel Channel
}

type ConversationsResponse

type ConversationsResponse struct {
	CursorResponseMetadata
	Ok       bool
	Channels []Channel
}

type Cursor

type Cursor struct {
	NextCursor string `json:"next_cursor"`
}

type CursorResponseMetadata

type CursorResponseMetadata struct {
	ResponseMetadata Cursor `json:"response_metadata"`
}

type File

type File struct {
	Preview string `json:"preview"`
}

type HistoryResponse

type HistoryResponse struct {
	CursorResponseMetadata
	Ok       bool
	HasMore  bool `json:"has_more"`
	Messages []Message
}

type Message

type Message struct {
	User        string
	BotID       string `json:"bot_id"`
	Text        string
	Attachments []Attachment
	Ts          string
	Type        string
	ReplyCount  int `json:"reply_count"`
}

type RTMClient

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

func (*RTMClient) Close

func (c *RTMClient) Close() error

func (*RTMClient) ListenForMessagesFromBot

func (c *RTMClient) ListenForMessagesFromBot(channelID, botName string) error

ListenForMessagesFromBot listens for the first message from the bot in a given channel and prints its contents

type RTMConnectResponse

type RTMConnectResponse struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error"`
	URL   string `json:"url"`
}

type RTMEvent

type RTMEvent struct {
	Type        string       `json:"type"`
	Channel     string       `json:"channel,omitempty"`
	User        string       `json:"user,omitempty"`
	Text        string       `json:"text,omitempty"`
	TS          string       `json:"ts,omitempty"`
	BotID       string       `json:"bot_id,omitempty"`
	BotProfile  BotProfile   `json:"bot_profile,omitempty"`
	Subtype     string       `json:"subtype,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
	Files       []File       `json:"files,omitempty"`
}

type SendMessage

type SendMessage struct {
	ThreadTS    string       `json:"thread_ts,omitempty"`
	Channel     string       `json:"channel"` // required
	Text        string       `json:"text,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

type SendMessageResponse

type SendMessageResponse struct {
	OK      bool    `json:"ok"`
	Error   string  `json:"error,omitempty"`
	Warning string  `json:"warning,omitempty"`
	TS      string  `json:"ts,omitempty"`
	Message Message `json:"message,omitempty"`
}

func (*SendMessageResponse) Output

func (r *SendMessageResponse) Output(team, channelID string) string

type SlackClient

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

func New

func New(team string, log *log.Logger) (*SlackClient, error)

func Null

func Null(team string, roundTripper http.RoundTripper) (*SlackClient, error)

Null produces a SlackClient suitable for testing that does not try to load the Slack token or cookies from disk, and starts with an empty cache.

func (*SlackClient) API

func (c *SlackClient) API(verb, path string, params map[string]string, body []byte) ([]byte, error)

func (*SlackClient) ChannelIDForName

func (c *SlackClient) ChannelIDForName(name string) (string, error)

func (*SlackClient) ChannelInfo

func (c *SlackClient) ChannelInfo(id string) (*Channel, error)

func (*SlackClient) ConnectToRTM

func (c *SlackClient) ConnectToRTM() (*RTMClient, error)

func (*SlackClient) GetLocation

func (c *SlackClient) GetLocation() *time.Location

func (*SlackClient) History

func (c *SlackClient) History(channelID string, startTimestamp string, thread string, limit int) (*HistoryResponse, error)

func (*SlackClient) SendMessage

func (c *SlackClient) SendMessage(channelID string, message string) (*SendMessageResponse, error)

func (*SlackClient) UsernameForID

func (c *SlackClient) UsernameForID(id string) (string, error)

func (*SlackClient) UsernameForMessage

func (c *SlackClient) UsernameForMessage(message Message) (string, error)

type User

type User struct {
	ID   string
	Name string
}

type UsersInfoResponse

type UsersInfoResponse struct {
	Ok   bool
	User User
}

type UsersResponse

type UsersResponse struct {
	CursorResponseMetadata
	Ok      bool
	Members []User
}

Jump to

Keyboard shortcuts

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