include champions in binary

This commit is contained in:
soruh 2023-11-29 23:10:16 +01:00
parent 66c0ea1aa3
commit ea928cb5c3

View File

@ -205,12 +205,12 @@ fn _dispatch_error_no_macro<'fut>(
async fn main() {
let _ = dotenv::from_filename(".env");
let champions = std::fs::File::open("champions.json").expect("failed to open champions.json");
let champions: Vec<Champion> = serde_json::from_reader::<_, HashMap<String, String>>(champions)
.expect("failed to parse champions")
.into_iter()
.map(|(name, url)| Champion { name, url })
.collect();
let champions: Vec<Champion> =
serde_json::from_str::<HashMap<String, String>>(include_str!("../champions.json"))
.expect("failed to parse champions")
.into_iter()
.map(|(name, url)| Champion { name, url })
.collect();
// Configure the client with your Discord bot token in the environment.
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");