[][src]Function discord_api::http::get_invite

pub async fn get_invite<T: Display>(code: T) -> Result<Invite, Error>

Fetches an invite from the Discord API.

Examples

use discord_api::get_invite;

let guild_invite = get_invite("python").await.expect("Could not get invite, request error");

println!("Guild invite for: {}", guild_invite.guild.expect("No guild found!").name);

Errors

In the event that the Discord API returns an non-200 response a reqwest error will be returned.