slackbot

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSlackWebhookMessage

func NewSlackWebhookMessage(msg string) *slack.WebhookMessage

Types

type BotService added in v0.14.1

type BotService struct {
	// contains filtered or unexported fields
}

func NewBotService added in v0.14.1

func NewBotService(slackConfig configs.SectionSlack) *BotService

func (*BotService) Check added in v0.14.1

func (s *BotService) Check(ctx context.Context) error

func (*BotService) GetService added in v0.14.1

func (s *BotService) GetService() *services.Services

func (*BotService) Handle added in v0.14.1

func (s *BotService) Handle(method, path string, handler gin.HandlerFunc)

func (*BotService) Run added in v0.14.1

func (s *BotService) Run() error

func (*BotService) SetLogger added in v0.14.1

func (s *BotService) SetLogger(logger *logger.Logger)

func (*BotService) SetService added in v0.14.1

func (s *BotService) SetService(services *services.Services)

func (*BotService) Stop added in v0.14.1

func (s *BotService) Stop(ctx context.Context) error

type Client

type Client struct {
	*slack.Client
	// contains filtered or unexported fields
}

func NewSlackCli

func NewSlackCli(httpCli HttpClient, clientID, clientSecret, refreshToken, accessToken string) *Client

func (*Client) GetUserInfoWithTokenExpirationCheck added in v0.24.1

func (cli *Client) GetUserInfoWithTokenExpirationCheck(channel string, storeFn StoreNewTokenFunc, options ...slack.MsgOption) (slackUser *slack.User, err error)

GetUserInfoWithTokenExpirationCheck will checks if the error is "token_expired" error, if so, will get new token and try again.

func (*Client) SendMessageWithTokenExpirationCheck

func (cli *Client) SendMessageWithTokenExpirationCheck(channel string, storeFn StoreNewTokenFunc, options ...slack.MsgOption) (channelID string, msgTimestamp string, respText string, err error)

SendMessageWithTokenExpirationCheck will checks if the error is "token_expired" error, if so, will get new token and try again.

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type StoreNewTokenFunc

type StoreNewTokenFunc func(accessToken string, refreshToken string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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