Documentation
¶
Overview ¶
Package slack is a minimal Slack Web API client for zen's Slack task watcher. It only implements the handful of methods the watcher needs (reactions.list, conversations.replies, reactions.add, chat.postMessage, chat.getPermalink, auth.test) — it is not a general-purpose Slack SDK.
Index ¶
- type APIError
- type Client
- func (c *Client) AddReaction(ctx context.Context, channel, ts, name string) error
- func (c *Client) AuthTest(ctx context.Context) (userID string, err error)
- func (c *Client) ConversationsReplies(ctx context.Context, channel, ts string) ([]Message, error)
- func (c *Client) HasReaction(ctx context.Context, channel, ts, name string) (bool, error)
- func (c *Client) ListReactions(ctx context.Context, emoji string, maxPages int) ([]ReactionHit, error)
- func (c *Client) Permalink(ctx context.Context, channel, ts string) (string, error)
- func (c *Client) PostMessage(ctx context.Context, channel, text string) error
- type Message
- type Reaction
- type ReactionHit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a thin wrapper around the Slack Web API, authenticated with a single user token (scopes: reactions:read, channels:history, groups:history, im:history, mpim:history, chat:write).
func (*Client) AddReaction ¶
AddReaction adds a reaction to a message. Slack's "already_reacted" error is treated as success — idempotent under daemon restarts re-processing the same message.
func (*Client) ConversationsReplies ¶
ConversationsReplies returns the parent message plus all replies in a thread.
func (*Client) HasReaction ¶
HasReaction reports whether a message already carries a reaction named name.
func (*Client) ListReactions ¶
func (c *Client) ListReactions(ctx context.Context, emoji string, maxPages int) ([]ReactionHit, error)
ListReactions pages through reactions.list for the authenticated user and returns every message that carries a reaction named emoji, across up to maxPages pages of 100 items each. reactions.list documents no sort order or since-timestamp filter, so callers must dedupe against their own seen-set rather than relying on pagination order or an early cutoff.
type Reaction ¶
type Reaction struct {
Name string `json:"name"`
Count int `json:"count"`
Users []string `json:"users"`
}
Reaction is a single named reaction on a message, with the count and users who added it.
type ReactionHit ¶
ReactionHit identifies a message carrying the emoji ListReactions searched for.