Gateway: Fix serenity breaking changes (#173)

Fix issues caused by serenity-rs/serenity#2372 and serenity-rs/serenity#2380.

Additionally, this Boxes the TrySendError from Serenity at Clippy's behest (causing a ~330B Result type).

---------

Co-authored-by: Kyle Simpson <kyleandrew.simpson@gmail.com>
This commit is contained in:
0/0
2023-04-12 20:21:25 +00:00
committed by Kyle Simpson
parent 7f519d0503
commit 4d0c1c030d
3 changed files with 18 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ use futures::channel::mpsc::TrySendError;
#[cfg(not(feature = "simd-json"))]
pub use serde_json::Error as JsonError;
#[cfg(feature = "serenity")]
use serenity::gateway::InterMessage;
use serenity::gateway::ShardRunnerMessage;
#[cfg(feature = "simd-json")]
pub use simd_json::Error as JsonError;
#[cfg(feature = "gateway")]
@@ -48,7 +48,7 @@ pub enum JoinError {
Driver(ConnectionError),
#[cfg(feature = "serenity")]
/// Serenity-specific WebSocket send error.
Serenity(TrySendError<InterMessage>),
Serenity(Box<TrySendError<ShardRunnerMessage>>),
#[cfg(feature = "twilight")]
/// Twilight-specific WebSocket send error when a message fails to send over websocket.
Twilight(SendError),
@@ -117,8 +117,8 @@ impl Error for JoinError {
}
#[cfg(all(feature = "serenity", feature = "gateway"))]
impl From<TrySendError<InterMessage>> for JoinError {
fn from(e: TrySendError<InterMessage>) -> Self {
impl From<Box<TrySendError<ShardRunnerMessage>>> for JoinError {
fn from(e: Box<TrySendError<ShardRunnerMessage>>) -> Self {
JoinError::Serenity(e)
}
}