fix: get_self_vc_id throws an error

The problem was that `ctx.cache.current_user()` uses an Arc and needs to get the value first before passing it to as a parameter. Assigning it to a variable first and referencing it, fixes the issue
This commit is contained in:
Miguel da Mota 2024-03-06 09:13:23 +01:00
parent cfd051be3f
commit af50d54729

View file

@ -93,6 +93,7 @@ pub fn get_self_vc_id_cached(ctx: &Context, guild_id: &GuildId) -> Option<Channe
} }
pub async fn get_self_vc_id(ctx: &Context, guild_id: &GuildId) -> Result<ChannelId, Error> { pub async fn get_self_vc_id(ctx: &Context, guild_id: &GuildId) -> Result<ChannelId, Error> {
let channel_id = get_vc_id(ctx, guild_id, &ctx.cache.current_user().id).await; let user_id = ctx.cache.current_user().id;
channel_id // This throws errors in main.rs for some reason
get_vc_id(ctx, guild_id, &user_id).await
} }