Documentation
¶
Index ¶
- func ConfigDisplayPath(path string) string
- func IsChannelID(channel string) bool
- func LookupKnownChannel(known map[string]string, name string) (string, bool)
- func NewAPIClient(token string, extra ...slack.Option) *slack.Client
- func ResolveAppToken(flagValue string, envKey string, cfg *SlackConfig) string
- func ResolveBotToken(flagValue string, envKey string, cfg *SlackConfig) string
- func ResolveChannel(api *slack.Client, cfg *SlackConfig, channel string) (string, error)
- type SlackConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDisplayPath ¶
ConfigDisplayPath returns an absolute path for startup logging, falling back to the original path when Abs fails.
func IsChannelID ¶
IsChannelID reports whether channel looks like a Slack channel/DM/group ID.
func LookupKnownChannel ¶
LookupKnownChannel resolves a channel name via the knownChannels map.
func NewAPIClient ¶
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 ¶
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.