slackutil

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDisplayPath

func ConfigDisplayPath(path string) string

ConfigDisplayPath returns an absolute path for startup logging, falling back to the original path when Abs fails.

func IsChannelID

func IsChannelID(channel string) bool

IsChannelID reports whether channel looks like a Slack channel/DM/group ID.

func LookupKnownChannel

func LookupKnownChannel(known map[string]string, name string) (string, bool)

LookupKnownChannel resolves a channel name via the knownChannels map.

func NewAPIClient

func NewAPIClient(token string, extra ...slack.Option) *slack.Client

NewAPIClient creates a Slack API client honoring the SLACK_API_URL test hook.

func ResolveAppToken

func ResolveAppToken(flagValue string, envKey string, cfg *SlackConfig) string

ResolveAppToken returns the app token from CLI flag, env, then config.

func ResolveBotToken

func ResolveBotToken(flagValue string, envKey string, cfg *SlackConfig) string

ResolveBotToken returns the bot token from CLI flag, env, then config.

func ResolveChannel

func ResolveChannel(api *slack.Client, cfg *SlackConfig, channel string) (string, error)

ResolveChannel resolves a channel name or ID to a Slack channel ID.

Types

type SlackConfig

type SlackConfig struct {
	Source             string            `json:"source"`
	BotToken           string            `json:"botToken"`
	AppToken           string            `json:"appToken"`
	DefaultChannelId   string            `json:"defaultChannelId"`
	DefaultChannelName string            `json:"defaultChannelName"`
	KnownChannels      map[string]string `json:"knownChannels"`
	Config             json.RawMessage   `json:"config"`
}

SlackConfig is the shared Slack JSON configuration shape.

func Load

func Load(path string) (*SlackConfig, error)

Load reads and parses a Slack JSON config file.

Jump to

Keyboard shortcuts

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