[][src]Struct ksoft::bans::Bans

pub struct Bans {
    pub http: Arc<HttpClient>,
}

Fields

http: Arc<HttpClient>

Implementations

impl Bans[src]

pub fn new(http_client: Arc<HttpClient>) -> Self[src]

pub async fn advanced_paginate<'_>(
    &'_ self,
    page: u8,
    per_page: u8
) -> HttpResult<BanList, BanError>
[src]

Get a list of X number of bans from X page

Example

This example is not tested
if let Ok(res) = client.bans.advanced_paginate(2, 20).await {
    match res {
        Ok(bans) => {
            //do something with ban list
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}

pub async fn paginate<'_>(&'_ self) -> HttpResult<BanList, BanError>[src]

Shortcut to advanced_paginate() but with default parameters

Example

This example is not tested
if let Ok(res) = client.bans.paginate().await {
    match res {
        Ok(bans) => {
            //do something with ban list
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}

pub async fn add<S: ToString, '_>(
    &'_ self,
    user_id: u64,
    reason: S,
    proof: S,
    moderator: Option<u64>,
    user_name: Option<String>,
    user_discriminator: Option<u16>,
    appeal_possible: Option<bool>
) -> HttpResult<BanAdditionResponse, BanError>
[src]

Reports an user

Example

This example is not tested
if let Ok(res) = client.bans.add(23123123, "some reason", "some proof", None, None, None, Some(true)).await {
    match res {
        Ok(response) => {
            //Do something with the response
        },
        Err(why) => {
            //Domething with <BanError>
        }
    }
}

pub async fn check_ban<'_>(&'_ self, user_id: u64) -> Result<BanCheckResponse>[src]

Check if user is banned ny its id

Example

This example is not tested
if let Ok(ban) = client.bans.check_ban(12335454).await {
    //do something with the ban
}

pub async fn ban_info<'_>(
    &'_ self,
    user_id: u64
) -> HttpResult<BanInfoResponse, BanError>
[src]

Retrieve info about a ban

Example

This example is not tested
if let Ok(res) = client.bans.ban_info(1231231234124).await {
    match res {
        Ok(ban) => {
            //do something with ban info
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}

pub async fn delete_forcing<'_>(
    &'_ self,
    user_id: u64
) -> HttpResult<BanDeletionResponse, BanError>
[src]

Forces the deletion of an user ban. Must have BAN_MANAGER permission on ksoft to use it

Example

This example is not tested
if let Ok(res) = client.bans.delete_forcing(1231231234124).await {
    match res {
        Ok(ban) => {
            //do something with ban info
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}

pub async fn delete<'_>(
    &'_ self,
    user_id: u64
) -> HttpResult<BanDeletionResponse, BanError>
[src]

Deletes an user ban. Must have BAN_MANAGER permission on ksoft to use it

Example

This example is not tested
if let Ok(res) = client.bans.delete(1231231234124).await {
    match res {
        Ok(ban) => {
            //do something with ban info
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.