slack

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package slack posts one sweep summary per team to the team's channel.

The summary is the run history of the scheduled sweep: no report repository and no database, so a channel that fills with runs that changed nothing stops being read. Silence is therefore part of the contract, and Client.Post refuses an empty message rather than posting a heartbeat.

Index

Constants

View Source
const TokenEnv = "MARGE_SLACK_TOKEN"

TokenEnv carries the bot token of the sweep's own Slack app. The app holds chat:write and nothing else.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Token string
	// APIURL overrides Slack's own root. Only the tests set it.
	APIURL string
	HTTP   *http.Client
}

Client posts messages with chat.postMessage.

func LoadClient

func LoadClient() *Client

LoadClient returns the client the environment configures, or nil when it carries no token, which is not an error: a sweep run by hand posts nothing. The caller reports the summary on its own output either way.

func (*Client) Post

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

Post sends text to channel. An empty channel or an empty text is an error: both mean the caller decided to post and then had nothing to say.

Jump to

Keyboard shortcuts

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