Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
Expand All @@ -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))
}
Expand Down Expand Up @@ -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))
Expand All @@ -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},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/httpserver/auth_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"crypto/ed25519"
"encoding/hex"
"io/ioutil"
"io"

"github.com/gin-gonic/gin"
"github.com/pkg/errors"
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/httpserver/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 0 additions & 2 deletions internal/utils/utils.go

This file was deleted.

Loading