pub struct Client {}
Expand description
A client that connects to Discord via the WebSocket and API.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new<S, H>(token: S, _handler: H) -> Result<Client>
pub fn new<S, H>(token: S, _handler: H) -> Result<Client>
Creates a Client for a bot user.
Discord has a requirement of prefixing bot tokens with "Bot "
, which
this function will automatically add if not included.
§Examples
struct Handler;
impl EventHandler for Handler {}
use std::env;
use strife::client::Client;
let token = env::var("DISCORD_TOKEN")?;
let client = Client::new(&token, Handler)?;
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more