External Chat Linking (!4)
This PR adds the functionality for plugins to send and recieve messages linked to a specific channel. Co-authored-by: Layla <layla@layla.gg> Reviewed-on: https://gitea.sumulayla.synology.me/layla/birdbot/pulls/4
This commit was merged in pull request #4.
This commit is contained in:
26
app/external_chat_manager.go
Normal file
26
app/external_chat_manager.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/yeslayla/birdbot/common"
|
||||
"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)
|
||||
}
|
||||
Reference in New Issue
Block a user