diff options
| author | Zeyla Hellyer <[email protected]> | 2017-03-04 20:23:25 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-03-04 20:23:25 -0800 |
| commit | e4b484f1c823ccb0aa2be7c54e0def07e5a01806 (patch) | |
| tree | 4ed1e33ae233c5f7583b4c0941ee8e5e19778ff3 /src/client | |
| parent | Fix client::rest::get_guilds doctest (diff) | |
| download | serenity-e4b484f1c823ccb0aa2be7c54e0def07e5a01806.tar.xz serenity-e4b484f1c823ccb0aa2be7c54e0def07e5a01806.zip | |
Remove invite accepting
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/rest/mod.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs index 68606ec..12a9a39 100644 --- a/src/client/rest/mod.rs +++ b/src/client/rest/mod.rs @@ -82,51 +82,6 @@ pub fn set_token(token: &str) { TOKEN.lock().unwrap().clone_from(&token.to_owned()); } -/// Accepts the [`Invite`] given its code, placing the current user in the -/// [`Guild`] that the invite was for. -/// -/// Use [`utils::parse_invite`] to retrieve codes from URLs. -/// -/// Refer to the documentation for [`Context::accept_invite`] for restrictions on -/// accepting an invite. -/// -/// This will fire the [`Client::on_guild_create`] handler once the associated -/// event is received. -/// -/// **Note**: This will fail if you are already in the guild, or are banned. A -/// ban is equivalent to an IP ban. -/// -/// **Note**: Requires that the current user be a user account. Bots can not -/// accept invites. Instead, they must be accepted via OAuth2 authorization -/// links. These are in the format of: -/// -/// `https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot` -/// -/// # Examples -/// -/// Accept an invite given a code from a URL: -/// -/// ```rust,no_run -/// use serenity::client::rest; -/// use serenity::utils; -/// -/// let url = "https://discord.gg/0cDvIgU2voY8RSYL"; -/// let code = utils::parse_invite(url); -/// -/// let _result = rest::accept_invite(code); -/// ``` -/// -/// [`Client::on_guild_create`]: ../struct.Client.html#method.on_guild_create -/// [`Context::accept_invite`]: ../struct.Context.html#method.accept_invite -/// [`Guild`]: ../../model/struct.Guild.html -/// [`Invite`]: ../../model/struct.Invite.html -/// [`utils::parse_invite`]: ../../utils/fn.parse_invite.html -pub fn accept_invite(code: &str) -> Result<Invite> { - let response = request!(Route::InvitesCode, post, "/invites/{}", code); - - Invite::decode(serde_json::from_reader(response)?) -} - /// Marks a [`Channel`] as being "read" up to a certain [`Message`]. Any /// message past the given one will not be marked as read. /// |