shuttle-poise 0.37.0

Service implementation to run a poise discord bot on shuttle
Documentation
#![doc = include_str!("../README.md")]
use std::net::SocketAddr;
use std::sync::Arc;

/// A wrapper type for [poise::Framework] so we can implement [shuttle_runtime::Service] for it.
#[deprecated = "shuttle-poise for poise 0.5 is deprecated. To use poise 0.6 and Shuttle, check https://docs.rs/shuttle-serenity/latest/shuttle_serenity/"]
pub struct PoiseService<T, E>(pub Arc<poise::Framework<T, E>>);

#[shuttle_runtime::async_trait]
impl<T, E> shuttle_runtime::Service for PoiseService<T, E>
where
    T: Send + Sync + 'static,
    E: Send + Sync + 'static,
{
    async fn bind(mut self, _addr: SocketAddr) -> Result<(), shuttle_runtime::Error> {
        self.0
            .start_autosharded()
            .await
            .map_err(shuttle_runtime::CustomError::new)?;

        Ok(())
    }
}

impl<T, E> From<Arc<poise::Framework<T, E>>> for PoiseService<T, E> {
    fn from(framework: Arc<poise::Framework<T, E>>) -> Self {
        Self(framework)
    }
}

#[doc = include_str!("../README.md")]
pub type ShuttlePoise<T, E> = Result<PoiseService<T, E>, shuttle_runtime::Error>;