Kraigie / nostrum

Elixir Discord Library
https://kraigie.github.io/nostrum/
MIT License
620 stars 129 forks source link

MatchError in guild_cache #293

Closed Th3-M4jor closed 3 years ago

Th3-M4jor commented 3 years ago
(MatchError) no match of right hand side value: []
(nostrum 0.4.7) lib/nostrum/cache/guild_cache.ex:283: Nostrum.Cache.GuildCache.member_update/2
(nostrum 0.4.7) lib/nostrum/shard/dispatch.ex:182: Nostrum.Shard.Dispatch.handle_event/3
(nostrum 0.4.7) lib/nostrum/shard/dispatch.ex:42: Nostrum.Shard.Dispatch.handle/1
(elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
(nostrum 0.4.7) lib/nostrum/shard/stage/cache.ex:23: Nostrum.Shard.Stage.Cache.handle_events/3
(gen_stage 1.1.0) lib/gen_stage.ex:2462: GenStage.consumer_dispatch/6
(gen_stage 1.1.0) lib/gen_stage.ex:2641: GenStage.take_pc_events/3
(stdlib 3.15.2) gen_server.erl:695: :gen_server.try_dispatch/4

To reproduce the error, set gateway_intents: [] in config.exs and modify the nickname of the bot in any server

jchristgit commented 3 years ago

Thanks for reporting this! My update code was a bit very optimistic...

jchristgit commented 3 years ago

Are there other cases than MEMBER_UPDATE that we get sent even if the intent is disabled? It seems we do not cache the guild at all in that case.

Th3-M4jor commented 3 years ago

None that I know of, but I'll poke around and see what else I can cause a match error with

jchristgit commented 3 years ago

Thank you for testing 😄

I've opened a PR to fix this issue. Feel free to open a new one if you catch anything new!