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
8 changes: 4 additions & 4 deletions app/http/endpoints/api/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ func ChannelsHandler(ctx *gin.Context) {
filtered := make([]channel.Channel, 0, len(channels))
for _, ch := range channels {
// Filter out threads
if ch.Type == channel.ChannelTypeGuildNewsThread ||
ch.Type == channel.ChannelTypeGuildPrivateThread ||
ch.Type == channel.ChannelTypeGuildPublicThread {
if ch.Type == channel.ChannelTypeAnnouncementThread ||
ch.Type == channel.ChannelTypePrivateThread ||
ch.Type == channel.ChannelTypePublicThread {
continue
}

filtered = append(filtered, ch)
}

sort.Slice(filtered, func(i, j int) bool {
return filtered[i].Position < filtered[j].Position
return *filtered[i].Position < *filtered[j].Position
})

ctx.JSON(200, filtered)
Expand Down
2 changes: 1 addition & 1 deletion app/http/endpoints/api/guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ func GuildHandler(ctx *gin.Context) {
ctx.JSON(200, gin.H{
"id": guild.Id,
"name": guild.Name,
"icon": guild.Icon,
"icon": guild.IconUrl(),
})
}
2 changes: 1 addition & 1 deletion app/http/endpoints/api/panel/multipanelcreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (d *multiPanelCreateData) validateChannel(guildId uint64) func() error {

var valid bool
for _, ch := range channels {
if ch.Id == d.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildNews) {
if ch.Id == d.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildAnnouncement) {
valid = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion app/http/endpoints/api/panel/panelcreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func CreatePanel(c *gin.Context) {
{
emoji := data.getEmoji()
if emoji != nil {
emojiName = &emoji.Name
emojiName = emoji.Name

if emoji.Id.Value != 0 {
emojiId = &emoji.Id.Value
Expand Down
4 changes: 2 additions & 2 deletions app/http/endpoints/api/panel/panelmessagedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ func panelIntoMessageData(panel database.Panel, isPremium bool) panelMessageData
if panel.EmojiName != nil { // No emoji = nil
if panel.EmojiId == nil { // Unicode emoji
emote = &emoji.Emoji{
Name: *panel.EmojiName,
Name: panel.EmojiName,
}
} else { // Custom emoji
emote = &emoji.Emoji{
Id: objects.NewNullableSnowflake(*panel.EmojiId),
Name: *panel.EmojiName,
Name: panel.EmojiName,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/http/endpoints/api/panel/panelupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func UpdatePanel(c *gin.Context) {
{
emoji := data.getEmoji()
if emoji != nil {
emojiName = &emoji.Name
emojiName = emoji.Name

if emoji.Id.Value != 0 {
emojiId = &emoji.Id.Value
Expand Down
4 changes: 2 additions & 2 deletions app/http/endpoints/api/panel/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func validateContent(ctx PanelValidationContext) validation.ValidationFunc {
func validateChannelId(ctx PanelValidationContext) validation.ValidationFunc {
return func() error {
for _, ch := range ctx.Channels {
if ch.Id == ctx.Data.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildNews) {
if ch.Id == ctx.Data.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildAnnouncement) {
return nil
}
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func validateEmoji(c PanelValidationContext) validation.ValidationFunc {
return validation.NewInvalidInputError("Emoji not found")
}

if resolvedEmoji.Name != emoji.Name {
if resolvedEmoji.Name == nil || *resolvedEmoji.Name != emoji.Name {
return validation.NewInvalidInputError("Emoji name mismatch")
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/http/endpoints/api/settings/updatesettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (s *Settings) Validate(ctx context.Context, guildId uint64, premiumTier pre
return fmt.Errorf("Invalid overflow category")
}

if ch.GuildId != guildId {
if *ch.GuildId != guildId {
return fmt.Errorf("Overflow category guild ID does not match")
}

Expand All @@ -284,7 +284,7 @@ func (s *Settings) Validate(ctx context.Context, guildId uint64, premiumTier pre
return fmt.Errorf("Invalid ticket notification channel")
}

if ch.GuildId != guildId {
if *ch.GuildId != guildId {
return fmt.Errorf("Ticket notification channel guild ID does not match")
}

Expand Down
4 changes: 2 additions & 2 deletions app/http/endpoints/api/ticket/placeholders.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func replacePlaceholders(ctx context.Context, content string, ticket *database.T
}

if member, err := botCtx.GetGuildMember(ctx, ticket.GuildId, ticket.UserId); err == nil {
if member.Nick != "" {
content = strings.ReplaceAll(content, "%nickname%", member.Nick)
if member.Nick != nil {
content = strings.ReplaceAll(content, "%nickname%", *member.Nick)
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/http/endpoints/api/ticket/sendmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func SendMessage(ctx *gin.Context) {
Username: guild.Name,
AvatarUrl: guild.IconUrl(),
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeEveryone},
},
}
} else {
Expand All @@ -130,7 +130,7 @@ func SendMessage(ctx *gin.Context) {
Username: user.EffectiveName(),
AvatarUrl: user.AvatarUrl(256),
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeEveryone},
},
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func SendMessage(ctx *gin.Context) {
if _, err = rest.CreateMessage(ctx, botContext.Token, botContext.RateLimiter, *ticket.ChannelId, rest.CreateMessageData{
Content: message,
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeEveryone},
},
}); err != nil {
ctx.JSON(500, utils.ErrorStr("Failed to send message to ticket #%d in channel %d", ticketId, *ticket.ChannelId))
Expand Down
6 changes: 3 additions & 3 deletions app/http/endpoints/api/ticket/sendtag.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func SendTag(ctx *gin.Context) {
Username: guild.Name,
AvatarUrl: guild.IconUrl(),
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeEveryone},
},
}
} else {
Expand All @@ -158,7 +158,7 @@ func SendTag(ctx *gin.Context) {
Username: user.EffectiveName(),
AvatarUrl: user.AvatarUrl(256),
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeEveryone},
},
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ func SendTag(ctx *gin.Context) {
Content: message,
Embeds: embeds,
AllowedMentions: messagetypes.AllowedMention{
Parse: []messagetypes.AllowedMentionType{messagetypes.USERS, messagetypes.ROLES, messagetypes.EVERYONE},
Parse: []messagetypes.AllowedMentionType{messagetypes.AllowedMentionTypeUsers, messagetypes.AllowedMentionTypeRoles, messagetypes.AllowedMentionTypeEveryone},
},
}); err != nil {
ctx.JSON(500, utils.ErrorStr("Failed to send tag '%s' to ticket #%d in channel %d", body.TagId, ticketId, *ticket.ChannelId))
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ go 1.25.0

//replace github.com/TicketsBot-cloud/common => ../common

//replace github.com/TicketsBot-cloud/gdl => ../gdl
replace github.com/TicketsBot-cloud/gdl => ../gdl

//replace github.com/TicketsBot-cloud/logarchiver => ../logarchiver
replace github.com/TicketsBot-cloud/logarchiver => ../logarchiver

//replace github.com/TicketsBot-cloud/archiverclient => ../archiverclient

//replace github.com/TicketsBot-cloud/worker => ../worker
replace github.com/TicketsBot-cloud/worker => ../worker

replace github.com/go-playground/validator/v10 => github.com/go-playground/validator/v10 v10.14.0

require (
github.com/BurntSushi/toml v1.2.1
github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704
github.com/TicketsBot-cloud/common v0.0.0-20260210203202-54154661338e
github.com/TicketsBot-cloud/database v0.0.0-20260306193605-6370670408d6
github.com/TicketsBot-cloud/gdl v0.0.0-20260306134952-cccb0116fef6
github.com/TicketsBot-cloud/database v0.0.0-20260226214338-bf6af6ba954e
github.com/TicketsBot-cloud/gdl v0.0.0-20260213180045-11af01c262ca
github.com/TicketsBot-cloud/logarchiver v0.0.0-20251018211319-7a7df5cacbdc
github.com/TicketsBot-cloud/worker v0.0.0-20260301212853-f5f9e1ebbfc2
github.com/apex/log v1.1.2
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,8 @@ github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704 h1
github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704/go.mod h1:Mux1bEPpOHwRw1wo6Fa6qJLJH9Erk9qv1yAIfLi1Wmw=
github.com/TicketsBot-cloud/common v0.0.0-20260210203202-54154661338e h1:nFKV7yEm8MWbCP7dtsJ88+agcxDUD0YKIotVHMVvytw=
github.com/TicketsBot-cloud/common v0.0.0-20260210203202-54154661338e/go.mod h1:tGrTHFz09OM3eDWF+62hIi9ELpT4igCFi868FKSvKBg=
github.com/TicketsBot-cloud/database v0.0.0-20260306193605-6370670408d6 h1:uj6sFHKmM9DheqmCzs6pQzIdDMguZTdLd2URC7/UDAA=
github.com/TicketsBot-cloud/database v0.0.0-20260306193605-6370670408d6/go.mod h1:HQXAgmNSm7/FmBYwcsa6qpZqMrDhbLoEl+AyqFQ+RwY=
github.com/TicketsBot-cloud/gdl v0.0.0-20260306134952-cccb0116fef6 h1:ucG0xLPt7xixW7/LvL0hXDBDouDRS1Nf+77qP8iJ/X0=
github.com/TicketsBot-cloud/gdl v0.0.0-20260306134952-cccb0116fef6/go.mod h1:CdwBR2egPtxUXjD2CgC9ZwfuB8dz9HPePM8nuG6dt7Y=
github.com/TicketsBot-cloud/logarchiver v0.0.0-20251018211319-7a7df5cacbdc h1:qTLNpCvIqM7UwZ6MdWQ9EztcDsIJfHh+VJdG+ULLEaA=
github.com/TicketsBot-cloud/logarchiver v0.0.0-20251018211319-7a7df5cacbdc/go.mod h1:pZqkzPNNTqnwKZvCT8kCaTHxrG7HJbxZV83S0p7mmzM=
github.com/TicketsBot-cloud/worker v0.0.0-20260301212853-f5f9e1ebbfc2 h1:mFNFfu/blbdHDvlG4b/gtEMDx+7RufpTARAOjzwcxEs=
github.com/TicketsBot-cloud/worker v0.0.0-20260301212853-f5f9e1ebbfc2/go.mod h1:XwwzC6kkENskFCEM+X8F2PSQmMqfqocaFrJBVynFz1I=
github.com/TicketsBot-cloud/database v0.0.0-20260226214338-bf6af6ba954e h1:BWHHGDDxhZmsGl6KP4xXmvrTyvUbO9nCgUAgAunAxEI=
github.com/TicketsBot-cloud/database v0.0.0-20260226214338-bf6af6ba954e/go.mod h1:HQXAgmNSm7/FmBYwcsa6qpZqMrDhbLoEl+AyqFQ+RwY=
github.com/TicketsBot/common v0.0.0-20241117150316-ff54c97b45c1 h1:FqC1KGOsmB+ikvbmDkyNQU6bGUWyfYq8Ip9r4KxTveY=
github.com/TicketsBot/common v0.0.0-20241117150316-ff54c97b45c1/go.mod h1:N7zwetwx8B3RK/ZajWwMroJSyv2ZJ+bIOZWv/z8DhaM=
github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261 h1:NHD5GB6cjlkpZFjC76Yli2S63/J2nhr8MuE6KlYJpQM=
Expand Down
4 changes: 2 additions & 2 deletions utils/guildutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func LoadGuilds(ctx context.Context, accessToken string, userId uint64) ([]Guild
dtos = append(dtos, GuildDto{
Id: guild.Id,
Name: guild.Name,
Icon: guild.Icon,
Icon: guild.IconUrl(),
PermissionLevel: permLevel,
})
mu.Unlock()
Expand Down Expand Up @@ -106,7 +106,7 @@ func storeGuildsInDb(ctx context.Context, userId uint64, guilds []guild.Guild) e
Name: guild.Name,
Owner: guild.Owner,
UserPermissions: guild.Permissions,
Icon: guild.Icon,
Icon: guild.IconUrl(),
})
}

Expand Down
6 changes: 4 additions & 2 deletions utils/types/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ func NewEmoji(emojiName *string, emojiId *uint64) Emoji {

func (e Emoji) IntoGdl() *emoji.Emoji {
if e.IsCustomEmoji {
name := e.Name
return &emoji.Emoji{
Id: objects.NewNullableSnowflake(*e.Id),
Name: e.Name,
Name: &name,
}
} else {
if e.Name == "" {
return nil
} else {
name := e.Name
return &emoji.Emoji{
Name: e.Name,
Name: &name,
}
}
}
Expand Down