pubsub

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pubsub provides Slack event ingestion and reply publishing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSlackInput

func NewSlackInput(msg *slackevents.MessageEvent, text string) *cmd.CommandInput

NewSlackInput はSlackの入力を元にpubsub.Inputを返す

func NewSlackInputFromAppMention

func NewSlackInputFromAppMention(msg *slackevents.AppMentionEvent, text string) *cmd.CommandInput

NewSlackInputFromAppMention はAppMentionEventを元にpubsub.Inputを返す

func SlackListener

func SlackListener(
	ctx context.Context,
	smc *socketmode.Client,
	commandQueue chan *cmd.CommandInput,
	cfg Config,
)

SlackListener はSocket Modeでメッセージ監視し、コマンドをcommandQueueに投げます。

func SlackWriter

func SlackWriter(ctx context.Context, smc *socketmode.Client, outputQueue chan *cmd.CommandOutput)

SlackWriter はoutputQueueから来たコマンド実行結果をSlackに書き込みます

Types

type Config

type Config struct {
	ReplyConfig
	SlackBotToken         string   `toml:"slack_bot_token"`
	SlackAppToken         string   `toml:"slack_app_token"`
	AllowUnsafeOpenAccess bool     `toml:"allow_unsafe_open_access"`
	AcceptReminder        bool     `toml:"accept_reminder"`
	AcceptBotMessage      bool     `toml:"accept_bot_message"`
	AcceptThreadMessage   bool     `toml:"accept_thread_message"`
	AllowedUserIDs        []string `toml:"allowed_user_ids"`
	AllowedChannelIDs     []string `toml:"allowed_channel_ids"`
}

Config defines Slack pub/sub settings.

type ReplyConfig

type ReplyConfig struct {
	Username        string `toml:"username"`
	IconEmoji       string `toml:"icon_emoji"`
	IconURL         string `toml:"icon_url"`
	PostAsReply     bool   `toml:"post_as_reply"`
	AlwaysBroadcast bool   `toml:"always_broadcast"`
	Monospaced      bool
}

ReplyConfig defines reply formatting options.

Jump to

Keyboard shortcuts

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