From 31c1cdda0cf411f80dd48f542a910795b7c054dd Mon Sep 17 00:00:00 2001 From: Skip R Date: Tue, 25 Nov 2025 14:46:12 -0800 Subject: [PATCH] connector: sort recent private channels properly --- pkg/connector/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index 8bf5d97..f880702 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -17,7 +17,6 @@ package connector import ( - "cmp" "context" "errors" "fmt" @@ -181,7 +180,9 @@ func (d *DiscordClient) syncPrivateChannels(ctx context.Context) { dms := slices.Clone(d.Session.State.PrivateChannels) // Only sync the top n private channels with recent activity. slices.SortFunc(dms, func(a, b *discordgo.Channel) int { - return cmp.Compare(b.LastMessageID, a.LastMessageID) + ats, _ := discordgo.SnowflakeTimestamp(a.LastMessageID) + bts, _ := discordgo.SnowflakeTimestamp(b.LastMessageID) + return bts.Compare(ats) }) // TODO(skip): This is startup_private_channel_create_limit. Support this in the config. for _, dm := range dms[:10] {