chat

package
v1.799.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeChatProviderType added in v1.798.1

func NormalizeChatProviderType(typ string) string

Types

type ChatProvider

type ChatProvider interface {
	SendMessage(chatId string, text string) error
	ParseWebhookRequest(body []byte) (*IncomingMessage, error)
	SetWebhook(webhookUrl string) error
}

func GetChatProvider

func GetChatProvider(typ string, token string, providerKey string, lang string) (ChatProvider, error)

type DiscordChatProvider added in v1.798.1

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

func NewDiscordChatProvider added in v1.798.1

func NewDiscordChatProvider(botToken string, publicKeyHex string, httpClient *http.Client) (*DiscordChatProvider, error)

func (*DiscordChatProvider) GetWebhookResponse added in v1.798.1

func (p *DiscordChatProvider) GetWebhookResponse(body []byte, header http.Header) (*WebhookResponse, error)

func (*DiscordChatProvider) ParseWebhookRequest added in v1.798.1

func (p *DiscordChatProvider) ParseWebhookRequest(body []byte) (*IncomingMessage, error)

func (*DiscordChatProvider) SendMessage added in v1.798.1

func (p *DiscordChatProvider) SendMessage(chatId string, text string) error

func (*DiscordChatProvider) SetWebhook added in v1.798.1

func (p *DiscordChatProvider) SetWebhook(webhookUrl string) error

type ImmediateWebhookResponder added in v1.798.1

type ImmediateWebhookResponder interface {
	GetWebhookResponse(body []byte, header http.Header) (*WebhookResponse, error)
}

type IncomingMessage

type IncomingMessage struct {
	ChatId   string
	UserId   string
	Text     string
	Username string
}

type TelegramChatProvider

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

func NewTelegramChatProvider

func NewTelegramChatProvider(botToken string, httpClient *http.Client) (*TelegramChatProvider, error)

func (*TelegramChatProvider) ParseWebhookRequest

func (p *TelegramChatProvider) ParseWebhookRequest(body []byte) (*IncomingMessage, error)

func (*TelegramChatProvider) SendMessage

func (p *TelegramChatProvider) SendMessage(chatId string, text string) error

func (*TelegramChatProvider) SetWebhook

func (p *TelegramChatProvider) SetWebhook(webhookUrl string) error

type WebhookResponse added in v1.798.1

type WebhookResponse struct {
	StatusCode  int
	ContentType string
	Body        []byte
}

Jump to

Keyboard shortcuts

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