future send error showcase
This commit is contained in:
parent
c3b3b84c46
commit
d5e6141339
1 changed files with 27 additions and 0 deletions
|
@ -56,6 +56,33 @@ pub async fn connect(ctx: Context<'_>,
|
||||||
|
|
||||||
let channel: ChannelId;
|
let channel: ChannelId;
|
||||||
if name.is_none() || name.clone().unwrap() == "" {
|
if name.is_none() || name.clone().unwrap() == "" {
|
||||||
|
// ERROR: <>
|
||||||
|
// !### This will work if you comment out one of the replies ###!
|
||||||
|
// let Some(guild) = ctx.guild() else {
|
||||||
|
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
|
||||||
|
// return Ok(())
|
||||||
|
// };
|
||||||
|
|
||||||
|
// let Some(voice_channel) = guild.voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) else {
|
||||||
|
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
|
||||||
|
// return Ok(())
|
||||||
|
// };
|
||||||
|
|
||||||
|
// channel = voice_channel;
|
||||||
|
// !### ###!
|
||||||
|
|
||||||
|
// This one liner works only if you comment out the reply
|
||||||
|
// channel = match ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) {
|
||||||
|
// Some(channel) => channel,
|
||||||
|
// None => {
|
||||||
|
// // ERROR: <>
|
||||||
|
// // Will work if you comment this out
|
||||||
|
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
|
||||||
|
// return Ok(())
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// This one works
|
||||||
// Ugly one liner since I don't know how to do this another way yet
|
// Ugly one liner since I don't know how to do this another way yet
|
||||||
// TODO fix please
|
// TODO fix please
|
||||||
let Some(voice_channel) = ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) else {
|
let Some(voice_channel) = ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) else {
|
||||||
|
|
Loading…
Reference in a new issue