-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
4,397 additions
and
817 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: Juici |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Rust/Cargo | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
|
||
# Discord Token | ||
examples/.token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "strife" | ||
version = "0.0.1" | ||
version = "0.2.0" | ||
authors = ["James Whaley <[email protected]>"] | ||
description = "A lightweight library for the Discord API." | ||
license = "MIT" | ||
|
@@ -15,6 +15,10 @@ keywords = ["discord", "api", "async"] | |
|
||
edition = "2018" | ||
|
||
[features] | ||
default = [] | ||
systime_ratelimits = [] | ||
|
||
[dependencies] | ||
async-std = "1.3" | ||
bitflags = "1.2" | ||
|
@@ -25,11 +29,12 @@ hyper = "0.13" | |
hyper-tls = "0.4" | ||
int-enum = { version = "0.3", features = ["serialize", "convert"] } | ||
log = "0.4" | ||
num-traits = "0.2" | ||
remain = "0.2" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
thiserror = "1.0" | ||
|
||
[features] | ||
default = [] | ||
systime_ratelimits = [] | ||
[dev-dependencies] | ||
pretty_env_logger = "0.3" | ||
tokio = { version = "0.2", features = ["full"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::env; | ||
use std::fs; | ||
|
||
use strife::http::unstable::{Request, Route}; | ||
use strife::model::user::ClientUser; | ||
use strife::{Error, Http}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Error> { | ||
// Initialize pretty logging. | ||
pretty_env_logger::init(); | ||
|
||
// Get token from `DISCORD_TOKEN` environment variable or `.token` file. | ||
let token = env::var("DISCORD_TOKEN") | ||
.or_else(|_| fs::read_to_string(".token")) | ||
.expect("missing discord token"); | ||
|
||
// Create an http client using our token. | ||
let http = Http::new(token); | ||
|
||
// Request information on the current user. | ||
let user: ClientUser = http.request(Request::new(Route::GetCurrentUser)).await?; | ||
|
||
println!( | ||
"Client User: {name}#{discriminator} ({id})", | ||
name = user.name, | ||
discriminator = user.discriminator, | ||
id = user.id | ||
); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.