8000 fix(bot): sync sticker cache on guild stickers update by dearlyzin · Pull Request #658 · disgoorg/disgo · GitHub
[go: up one dir, main page]

Skip to content

fix(bot): sync sticker cache on guild stickers update - #658

Closed
dearlyzin wants to merge 1 commit into
disgoorg:masterfrom
dearlyzin:fix/stickers-update-cache-sync
Closed

dearlyzin wants to merge 1 commit into
disgoorg:masterfrom
dearlyzin:fix/stickers-update-cache-sync

Conversation

@dearlyzin
Copy link
Copy Markdown

Problem

gatewayHandlerGuildStickersUpdate dispatches the sticker lifecycle events but never updates the sticker cache, so the cached stickers for a guild stay frozen at whatever GUILD_CREATE populated: stickers created afterwards are missing from the cache, edited ones keep stale values, and deleted ones remain cached until the next GUILD_CREATE.

The sibling gatewayHandlerGuildEmojisUpdate performs the same create/update/delete diff and calls AddEmoji / RemoveEmoji before dispatching each event; the stickers handler is a copy-paste of it with the cache calls dropped. It also kept the loop variable named emoji over sticker maps.

Changes

Mirror the emojis handler in bot/handlers/guild_stickers_update_handler.go:

  • AddSticker(sticker) before dispatching StickerCreate.
  • AddSticker(sticker.new) before dispatching StickerUpdate.
  • RemoveSticker(event.GuildID, sticker.ID) before dispatching StickerDelete.
  • Renamed the copy-pasted emoji loop variables to sticker.

No behaviour change for consumers who disable cache.FlagStickers, since the handler already returns before this block.

Verification

  • go build ./... passes.
  • go vet ./bot/... passes.
  • go test ./bot/...: the bot and bot/handlers packages contain no test files, so there is nothing to run there; the rest of the repository is unaffected by this handler-only change.

@topi314 topi314 closed this Nov 11, 2026
@dearlyzin
dearlyzin deleted the fix/stickers-update-cache-sync branch November 11, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants

0