SpaceManiac / discord-rs

Rust library for the Discord chat client API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Got Err Decode("Expected string", Null) when trying to call connect()

JavaDerg opened this issue · comments

When I try to run this code I get this error:
thread 'main' panicked at 'called Result::unwrap()on anErr value: Decode("Expected string", Null)', src/main.rs:3:34

fn main() {
    let dc = discord::Discord::from_user_token(&std::env::var("DC_TOKEN").expect("Set env var DC_TOKEN to discord user token")).unwrap();
    let (con, re) = dc.connect().unwrap();
    for rel in &re.relationships {
        println!("{} > {}", rel.user.name, rel.id.0);
    }
}

(I'm using the git version)
Not sure what's wrong.