Gateway: Simplify return value of join/join_gateway (#157)
Replaces the annoying dual-return (i.e., created `Call` *and* `Result<x>`) with a single `Return<Call/ConnectionInfo>`. Users are now informed via that a `Call` is created -- thus, cleanup in event of connection failure is now their responsibility. Tested using `cargo make ready`. Closes #65.
This commit is contained in:
@@ -131,10 +131,8 @@ async fn join(msg: Message, state: State) -> Result<(), Box<dyn Error + Send + S
|
||||
let channel_id =
|
||||
NonZeroU64::new(channel_id).ok_or("Joined voice channel must have nonzero ID.")?;
|
||||
|
||||
let (_handle, success) = state.songbird.join(guild_id, channel_id).await;
|
||||
|
||||
let content = match success {
|
||||
Ok(()) => format!("Joined <#{}>!", channel_id),
|
||||
let content = match state.songbird.join(guild_id, channel_id).await {
|
||||
Ok(_handle) => format!("Joined <#{}>!", channel_id),
|
||||
Err(e) => format!("Failed to join <#{}>! Why: {:?}", channel_id, e),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user