Plugins, Bugfixes & Cleanup

This commit is contained in:
2023-03-31 20:21:49 +00:00
parent 3d15d09dd7
commit 6e5450aa80
10 changed files with 113 additions and 59 deletions

View File

@ -24,6 +24,7 @@ func (c *AnnounceEventsComponent) Initialize(birdbot common.ComponentManager) er
c.bot = birdbot
_ = birdbot.OnEventCreate(c.OnEventCreate)
_ = birdbot.OnEventDelete(c.OnEventDelete)
return nil
}

View File

@ -9,14 +9,16 @@ import (
)
type ManageEventChannelsComponent struct {
session *discord.Discord
categoryID string
session *discord.Discord
categoryID string
archiveCategoryID string
}
func NewManageEventChannelsComponent(categoryID string, session *discord.Discord) *ManageEventChannelsComponent {
func NewManageEventChannelsComponent(categoryID string, archiveCategoryID string, session *discord.Discord) *ManageEventChannelsComponent {
return &ManageEventChannelsComponent{
session: session,
categoryID: categoryID,
session: session,
categoryID: categoryID,
archiveCategoryID: archiveCategoryID,
}
}
@ -54,9 +56,9 @@ func (c *ManageEventChannelsComponent) OnEventDelete(e common.Event) error {
func (c *ManageEventChannelsComponent) OnEventComplete(e common.Event) error {
channel := core.GenerateChannel(e)
if c.categoryID != "" {
if c.archiveCategoryID != "" {
if err := c.session.MoveChannelToCategory(channel, c.categoryID); err != nil {
if err := c.session.MoveChannelToCategory(channel, c.archiveCategoryID); err != nil {
log.Print("Failed to move channel to archive category: ", err)
}