Add support for running Discord bot commands. Fixes #35

This commit is contained in:
Tulir Asokan
2023-01-29 13:45:00 +02:00
parent 10d26a7baa
commit 98f45991a4
6 changed files with 352 additions and 6 deletions

View File

@@ -60,6 +60,9 @@ type Portal struct {
recentMessages *util.RingBuffer[string, *discordgo.Message]
commands map[string]*discordgo.ApplicationCommand
commandsLock sync.RWMutex
currentlyTyping []id.UserID
currentlyTypingLock sync.Mutex
}
@@ -232,6 +235,8 @@ func (br *DiscordBridge) NewPortal(dbPortal *database.Portal) *Portal {
matrixMessages: make(chan portalMatrixMessage, br.Config.Bridge.PortalMessageBuffer),
recentMessages: util.NewRingBuffer[string, *discordgo.Message](recentMessageBufferSize),
commands: make(map[string]*discordgo.ApplicationCommand),
}
go portal.messageLoop()