bothandler

package
v0.0.0-...-4de7fdf Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActiveMessagePlatforms = []MessagePlatform{}
View Source
var AddMessagePlatforms = []AddMessagePlatform{}
View Source
var CatchallExtendedHandlers = []CatchallExtendedHandler{}
View Source
var CatchallHandlers = []CatchallHandler{}
View Source
var Handlers = map[string]MessageHandler{}
View Source
var ImageHandlers = []ImageHandler{}
View Source
var MsgInputHandlers = map[string]MessageWithInputHandler{}

Functions

func ChannelMessageSend

func ChannelMessageSend(channelId string, message string) error

func RegisterCatchallExtendeHandler

func RegisterCatchallExtendeHandler(h CatchallExtendedHandler)

func RegisterCatchallHandler

func RegisterCatchallHandler(h CatchallHandler)

func RegisterImageHandler

func RegisterImageHandler(h ImageHandler)

func RegisterMessageHandler

func RegisterMessageHandler(m string, h MessageHandler)

func RegisterMessagePlatform

func RegisterMessagePlatform(m MessagePlatform)

func RegisterMessageWithInputHandler

func RegisterMessageWithInputHandler(m string, h MessageWithInputHandler)

func RegisterPassiveMessagePlatform

func RegisterPassiveMessagePlatform(m MessagePlatform)

func Shutdown

func Shutdown()

Types

type AddMessagePlatform

type AddMessagePlatform func(MessagePlatform)

type CatchallExtendedHandler

type CatchallExtendedHandler func(ExtendedMessage) *ExtendedMessage

type CatchallHandler

type CatchallHandler func(Request) string

type DiscordMessagePlatform

type DiscordMessagePlatform struct {
	Session  *discordgo.Session
	Channels map[string]string
	Me       *discordgo.User
}

Implements MessagePlatform

func NewMessagePlatformFromDiscord

func NewMessagePlatformFromDiscord(discordtoken string) (*DiscordMessagePlatform, error)

func (*DiscordMessagePlatform) ChannelMessageSend

func (s *DiscordMessagePlatform) ChannelMessageSend(channel, message string) error

func (*DiscordMessagePlatform) Close

func (dg *DiscordMessagePlatform) Close()

func (*DiscordMessagePlatform) ProcessMessages

func (dg *DiscordMessagePlatform) ProcessMessages()

func (*DiscordMessagePlatform) Send

func (dg *DiscordMessagePlatform) Send(text string)

Send to default channel

func (*DiscordMessagePlatform) SendWithOptions

func (dg *DiscordMessagePlatform) SendWithOptions(text string, options SendOptions)

type ExtendedMessage

type ExtendedMessage struct {
	Text  string
	Image []byte
}

type ImageHandler

type ImageHandler func(string, Request) string

type IrcMessagePlatform

type IrcMessagePlatform struct {
	Conn           *tls.Conn
	Signal         chan os.Signal
	ClientConfig   *irc.ClientConfig
	Client         *irc.Client
	DefaultChannel string
	CloseMe        bool
	// contains filtered or unexported fields
}

Implements MessagePlatform

func NewMessagePlatformFromIrc

func NewMessagePlatformFromIrc(serveraddr string, clientconfig *irc.ClientConfig, signal chan os.Signal) (*IrcMessagePlatform, error)

func (*IrcMessagePlatform) ChannelMessageSend

func (s *IrcMessagePlatform) ChannelMessageSend(channelId, message string) error

func (*IrcMessagePlatform) Close

func (s *IrcMessagePlatform) Close()

func (*IrcMessagePlatform) ProcessMessages

func (s *IrcMessagePlatform) ProcessMessages()

func (*IrcMessagePlatform) Send

func (s *IrcMessagePlatform) Send(text string)

func (*IrcMessagePlatform) SendWithOptions

func (s *IrcMessagePlatform) SendWithOptions(text string, options SendOptions)

type MessageHandler

type MessageHandler func() string

type MessagePlatform

type MessagePlatform interface {
	Send(string)
	SendWithOptions(string, SendOptions)
	ProcessMessages()
	Close()
	ChannelMessageSend(channel string, message string) error
}

type MessageWithInputHandler

type MessageWithInputHandler func(Request) string

type ReadlineMessagePlatform

type ReadlineMessagePlatform struct {
	Instance *readline.Instance
	Signal   chan os.Signal
}

Implements MessagePlatform

func NewMessagePlatformFromReadline

func NewMessagePlatformFromReadline(historyfile string, signal chan os.Signal) (*ReadlineMessagePlatform, error)

func (*ReadlineMessagePlatform) ChannelMessageSend

func (s *ReadlineMessagePlatform) ChannelMessageSend(channelId, message string) error

func (*ReadlineMessagePlatform) Close

func (s *ReadlineMessagePlatform) Close()

func (*ReadlineMessagePlatform) ProcessMessages

func (s *ReadlineMessagePlatform) ProcessMessages()

func (*ReadlineMessagePlatform) Send

func (s *ReadlineMessagePlatform) Send(text string)

func (*ReadlineMessagePlatform) SendWithOptions

func (s *ReadlineMessagePlatform) SendWithOptions(text string, options SendOptions)

type Request

type Request struct {
	Content  string
	Platform string
	// ClientId string
	Channel string
	From    string
}

type SendOptions

type SendOptions struct {
	Silent bool
}

type SlackMessagePlatform

type SlackMessagePlatform struct {
	Client           *slack.Client
	SocketModeClient *socketmode.Client
	ChannelId        map[string]string
	Me               *slack.AuthTestResponse
	DefaultChannel   string
	// contains filtered or unexported fields
}

Implements MessagePlatform New way, using Slack Socket Mode

func NewMessagePlatformFromSlack

func NewMessagePlatformFromSlack(slackbottoken, slackapptoken string) (*SlackMessagePlatform, error)

func (*SlackMessagePlatform) ChannelMessageSend

func (s *SlackMessagePlatform) ChannelMessageSend(channel, message string) error

func (*SlackMessagePlatform) Close

func (s *SlackMessagePlatform) Close()

func (*SlackMessagePlatform) ProcessMessages

func (s *SlackMessagePlatform) ProcessMessages()

func (*SlackMessagePlatform) Send

func (s *SlackMessagePlatform) Send(text string)

func (*SlackMessagePlatform) SendWithOptions

func (s *SlackMessagePlatform) SendWithOptions(text string, options SendOptions)

type TelegramMessagePlatform

type TelegramMessagePlatform struct {
	Client         *tgbotapi.BotAPI
	ChannelId      map[string]string
	KnownUsers     map[string]tgbotapi.User
	KnownUsersLock sync.RWMutex
	DefaultChannel string
}

Implements MessagePlatform

func NewMessagePlatformFromTelegram

func NewMessagePlatformFromTelegram(telegrambottoken string) (*TelegramMessagePlatform, error)

func (*TelegramMessagePlatform) ChannelMessageSend

func (s *TelegramMessagePlatform) ChannelMessageSend(channel, message string) error

func (*TelegramMessagePlatform) ChannelMessageSilentSend

func (s *TelegramMessagePlatform) ChannelMessageSilentSend(channel, message string) error

ChannelMessageSilentSend is FIXME: dupe of ChannelMessageSend with DisableNotification

func (*TelegramMessagePlatform) Close

func (s *TelegramMessagePlatform) Close()

func (*TelegramMessagePlatform) ProcessMessages

func (s *TelegramMessagePlatform) ProcessMessages()

func (*TelegramMessagePlatform) Send

func (s *TelegramMessagePlatform) Send(text string)

func (*TelegramMessagePlatform) SendWithOptions

func (s *TelegramMessagePlatform) SendWithOptions(text string, options SendOptions)

Jump to

Keyboard shortcuts

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