# DNS Wrapper ## What does it do? DNS Wrapper is an API wrapper for the brower nation simulation game Diplomacy and Strife. It has several easy to use functions you can use in your Discord bot. ## How do I use it? ### Step 1: Set your Diplomacy and Strife API key, this can be found [here](https://diplomacyandstrife.com/account). ```Rust use dns_wrapper::api::ApiKey; ApiKey::set_apikey("APIKEY"); ``` ### Step 2: Use one of the fetch functions. ```Rust use dns_wrapper::api::output::fetch_output; //... // Fetch nation data let nation_data = match fetch_output(nation_id).await { Ok(data) => data, Err(e) => { println!("{:?}", e); return Ok(()); } }; // Create an embed let embed = serenity::CreateEmbed::default() .title(format!("{}'s Output", nation_data.nation)) .description(format!( "**Money**: ${}\n**Production**: {}\n**Minerals**: {}\n**Uranium**: {}\n**Rare Metals**: {}\n**Fuel**: {}\n**Political Power**: {}", nation_data.money.round().separate_with_commas(), nation_data.production.round().separate_with_commas(), nation_data.minerals.round().separate_with_commas(), nation_data.uranium.round().separate_with_commas(), nation_data.rare_metals.round().separate_with_commas(), nation_data.fuel.round().separate_with_commas(), nation_data.political_power.round().separate_with_commas() )) .colour(Colour::DARK_GREEN); let message = poise::CreateReply::default().embed(embed); ctx.send(message).await?; Ok(()) //... ``` The example above shows a code snippet of my Discord bot using the fetch_output() function. This Discord bot is made with the Poise library.