slack

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractReactionName added in v1.1.0

func ExtractReactionName(reaction string) string

ExtractReactionName extracts reaction name (reaction) from reaction string (:reaction:)

func IsReaction added in v1.1.0

func IsReaction(reaction string) bool

IsReaction judges whether an argument is reaction string or not.

func NewClient

func NewClient(botToken string, options ...Option) (*client, error)

NewClient builds a slack client

func NewSocketClient

func NewSocketClient(client Client, debugMode bool) *socketClient

func RemoveSkinToneFromReaction added in v1.1.0

func RemoveSkinToneFromReaction(reaction string) string

RemoveSkinToneFromReaction uses regexp to remove the skin-tone string

Types

type APIError

type APIError string
const (
	ErrThreadNotFound APIError = "thread_not_found"
	ErrUserNotFound   APIError = "user_not_found"
)

func (APIError) Error

func (e APIError) Error() string

type Client

type Client interface {
	PostMessage(ctx context.Context, channelID, message, ts string) error
	PostEphemeral(ctx context.Context, channelID, userID, ts, message string) error
	GetConversationReplies(ctx context.Context, channelID, ts string) ([]slack.Message, error)
	GetUsersInfo(ctx context.Context, userID ...string) (*[]slack.User, error)
	GetReaction(ctx context.Context, channelID, ts string, full bool) ([]slack.ItemReaction, error)

	GetClient() *slack.Client
	GetAppUserID() string
}

type HandlerFactory

type HandlerFactory interface {
	MentionEventHandler() MentionEventHandler
}

type Listener

type Listener interface {
	Listen(ctx context.Context)
}

type MentionEventHandler

type MentionEventHandler func(ctx context.Context, event *slackevents.AppMentionEvent)

type Option

type Option = slack.Option

func AppTokenOption

func AppTokenOption(appToken string) Option

type SocketClient

type SocketClient interface {
	Events() chan socketmode.Event
	Debugf(format string, v ...interface{})
	Run() error
	Ack(req socketmode.Request, payload ...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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