2023-06-18 01:38:47 +02:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
2023-06-19 09:08:24 +02:00
|
|
|
"github.com/yeslayla/birdbot-common/common"
|
2023-06-18 01:38:47 +02:00
|
|
|
"github.com/yeslayla/birdbot/core"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ExternalChatManager struct {
|
|
|
|
chat common.ExternalChatModule
|
|
|
|
channel *core.Channel
|
|
|
|
bot *Bot
|
|
|
|
}
|
|
|
|
|
|
|
|
func (manager *ExternalChatManager) SendMessage(user string, message string) {
|
|
|
|
manager.bot.Session.WebhookSendMessage(manager.channel, user, message)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (app *Bot) InitalizeExternalChat(channel *core.Channel, chat common.ExternalChatModule) {
|
|
|
|
manager := &ExternalChatManager{
|
|
|
|
channel: channel,
|
|
|
|
chat: chat,
|
|
|
|
bot: app,
|
|
|
|
}
|
|
|
|
|
|
|
|
manager.chat.Initialize(manager)
|
|
|
|
}
|