slack

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIMessage

type APIMessage struct {
	Type  string `json:"type"`
	User  string `json:"user,omitempty"`
	Text  string `json:"text"`
	TS    string `json:"ts"`
	BotID string `json:"bot_id,omitempty"`
}

APIMessage is a raw Slack message from the API.

type Client

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

Client is a Slack Bot API client.

func New

func New(token, channel string) *Client

New creates a Slack client with the given bot token and channel.

func (*Client) ListMessages

func (c *Client) ListMessages(ctx context.Context, limit int) ([]MessageSummary, error)

ListMessages returns recent messages from the configured Slack channel.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, text string) error

SendMessage sends a text message to the configured Slack channel.

func (*Client) SetHTTPDoer

func (c *Client) SetHTTPDoer(doer apiclient.HTTPDoer)

SetHTTPDoer replaces the HTTP client used for API requests.

type Config

type Config struct {
	Name        string `mapstructure:"name"`
	Token       string `mapstructure:"token"`
	Channel     string `mapstructure:"channel"`
	Description string `mapstructure:"description"`
}

Config holds the configuration for a single Slack instance.

func LoadConfigs

func LoadConfigs(dir string) ([]Config, error)

LoadConfigs reads a .humanconfig YAML file from dir and returns the list of configured Slack instances. Returns nil and no error if the file does not exist.

type Instance

type Instance struct {
	Name        string
	Description string
	Channel     string
	Client      *Client
}

Instance represents a configured Slack bot ready for use.

func LoadInstances

func LoadInstances(dir string) ([]Instance, error)

LoadInstances reads config, applies env overrides, creates clients, and returns ready-to-use Slack instances.

type MessageSummary

type MessageSummary struct {
	User string `json:"user"`
	Text string `json:"text"`
	TS   string `json:"ts"`
}

MessageSummary is the CLI output type for the list command.

Jump to

Keyboard shortcuts

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