diff --git a/go.mod b/go.mod index 313909b..fc27e25 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/TicketsBot-cloud/status-updates go 1.24.2 +replace github.com/TicketsBot-cloud/gdl => ../gdl + require ( github.com/BurntSushi/toml v1.5.0 github.com/TicketsBot-cloud/gdl v0.0.0-20251007163257-7e59b92d02dd diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index fd62a2a..a9ff173 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -89,7 +89,7 @@ func (d *Daemon) runOnce(ctx context.Context) error { d.logger.Info("New incident detected. Sending Discord message...", zap.String("incident_id", incident.ID), zap.String("status", incident.Status)) msg, err := rest.CreateMessage(ctx, d.config.Discord.Token, nil, d.config.Discord.ChannelId, rest.CreateMessageData{ Components: msgComponents, - Flags: message.SumFlags(message.FlagComponentsV2), + Flags: message.SumFlags(message.FlagIsComponentsV2), AllowedMentions: message.AllowedMention{ Roles: []uint64{d.config.Discord.UpdateRoleId}, }, @@ -105,7 +105,7 @@ func (d *Daemon) runOnce(ctx context.Context) error { continue } - if channelInfo.Type == channel.ChannelTypeGuildNews && config.Conf.Discord.ShouldCrosspost { + if channelInfo.Type == channel.ChannelTypeGuildAnnouncement && config.Conf.Discord.ShouldCrosspost { if err := rest.CrosspostMessage(ctx, d.config.Discord.Token, nil, d.config.Discord.ChannelId, msg.Id); err != nil { d.logger.Error("Error crossposting message", zap.Error(err)) } @@ -161,7 +161,7 @@ func (d *Daemon) runOnce(ctx context.Context) error { // Update the message if the last update is newer _, err := rest.EditMessage(ctx, d.config.Discord.Token, nil, d.config.Discord.ChannelId, incidentInfo.MessageId, rest.EditMessageData{ Components: msgComponents, - Flags: message.SumFlags(message.FlagComponentsV2), + Flags: message.SumFlags(message.FlagIsComponentsV2), }) if err != nil { d.logger.Error("Error editing message", zap.Error(err)) @@ -180,7 +180,7 @@ func (d *Daemon) runOnce(ctx context.Context) error { }), updateContainer, }, - Flags: message.SumFlags(message.FlagComponentsV2), + Flags: message.SumFlags(message.FlagIsComponentsV2), AllowedMentions: message.AllowedMention{ Roles: []uint64{incidentInfo.RoleId}, }, diff --git a/internal/httpserver/auth_middleware.go b/internal/httpserver/auth_middleware.go index 836b06b..aa16d82 100644 --- a/internal/httpserver/auth_middleware.go +++ b/internal/httpserver/auth_middleware.go @@ -4,7 +4,7 @@ import ( "bytes" "crypto/ed25519" "encoding/hex" - "io/ioutil" + "io" "github.com/gin-gonic/gin" "github.com/pkg/errors" @@ -24,13 +24,13 @@ func (s *Server) AuthMiddleware(ctx *gin.Context) { } // Read the body but make sure it can be consumed again - body, err := ioutil.ReadAll(ctx.Request.Body) + body, err := io.ReadAll(ctx.Request.Body) if err != nil { _ = ctx.AbortWithError(500, errors.Wrap(err, "Failed to read body")) return } - ctx.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) + ctx.Request.Body = io.NopCloser(bytes.NewBuffer(body)) // Verify signature pubKey, err := hex.DecodeString(s.config.Discord.PublicKey) diff --git a/internal/httpserver/handle.go b/internal/httpserver/handle.go index bcc15bc..6636849 100644 --- a/internal/httpserver/handle.go +++ b/internal/httpserver/handle.go @@ -61,7 +61,7 @@ func (s *Server) HandleInteraction(ctx *gin.Context) { } ctx.JSON(200, interaction.NewResponseChannelMessage(interaction.ApplicationCommandCallbackData{ - Flags: message.SumFlags(message.FlagEphemeral, message.FlagComponentsV2), + Flags: message.SumFlags(message.FlagEphemeral, message.FlagIsComponentsV2), Components: []component.Component{ component.BuildContainer(component.Container{ Components: []component.Component{ diff --git a/internal/utils/utils.go b/internal/utils/utils.go deleted file mode 100644 index e3e78e9..0000000 --- a/internal/utils/utils.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package utils provides utility functions for the application. -package utils