public static ValueTask HandleGatewayEvent(this IDiscordCache cache, IGatewayEvent evt) { switch (evt) { case GuildCreateEvent gc: return(cache.SaveGuildCreate(gc)); case GuildUpdateEvent gu: return(cache.SaveGuild(gu)); case GuildDeleteEvent gd: return(cache.RemoveGuild(gd.Id)); case ChannelCreateEvent cc: return(cache.SaveChannel(cc)); case ChannelUpdateEvent cu: return(cache.SaveChannel(cu)); case ChannelDeleteEvent cd: return(cache.RemoveChannel(cd.Id)); case GuildRoleCreateEvent grc: return(cache.SaveRole(grc.GuildId, grc.Role)); case GuildRoleUpdateEvent gru: return(cache.SaveRole(gru.GuildId, gru.Role)); case GuildRoleDeleteEvent grd: return(cache.RemoveRole(grd.GuildId, grd.RoleId)); case MessageReactionAddEvent mra: return(cache.TrySaveDmChannelStub(mra.GuildId, mra.ChannelId)); case MessageCreateEvent mc: return(cache.SaveMessageCreate(mc)); case MessageUpdateEvent mu: return(cache.TrySaveDmChannelStub(mu.GuildId.Value, mu.ChannelId)); case MessageDeleteEvent md: return(cache.TrySaveDmChannelStub(md.GuildId, md.ChannelId)); case MessageDeleteBulkEvent md: return(cache.TrySaveDmChannelStub(md.GuildId, md.ChannelId)); case ThreadCreateEvent tc: return(cache.SaveChannel(tc)); case ThreadUpdateEvent tu: return(cache.SaveChannel(tu)); case ThreadDeleteEvent td: return(cache.RemoveChannel(td.Id)); case ThreadListSyncEvent tls: return(cache.SaveThreadListSync(tls)); } return(default);