diff --git a/app/http/endpoints/api/channels.go b/app/http/endpoints/api/channels.go index 18e6d23..4907fdc 100644 --- a/app/http/endpoints/api/channels.go +++ b/app/http/endpoints/api/channels.go @@ -10,11 +10,22 @@ import ( func ChannelsHandler(ctx *gin.Context) { guildId := ctx.Keys["guildid"].(uint64) - channels := cache.Instance.GetGuildChannels(guildId) + var channels []channel.Channel + for _, ch := range cache.Instance.GetGuildChannels(guildId) { + // Filter out threads + if ch.Type == channel.ChannelTypeGuildNewsThread || + ch.Type == channel.ChannelTypeGuildPrivateThread || + ch.Type == channel.ChannelTypeGuildPublicThread { + continue + } + + channels = append(channels, ch) + } + if channels == nil { channels = make([]channel.Channel, 0) // don't serve null } else { - sort.Slice(channels, func(i,j int) bool { + sort.Slice(channels, func(i, j int) bool { return channels[i].Position < channels[j].Position }) }