Struct ksoft::bans::Bans [−][src]
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]
&self,
page: u8,
per_page: u8
) -> HttpResult<BanList, BanError>
Get a list of X number of bans from X page
Example
ⓘ
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
ⓘ
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]
&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>
Reports an user
Example
ⓘ
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
ⓘ
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]
&self,
user_id: u64
) -> HttpResult<BanInfoResponse, BanError>
Retrieve info about a ban
Example
ⓘ
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]
&self,
user_id: u64
) -> HttpResult<BanDeletionResponse, BanError>
Forces the deletion of an user ban. Must have BAN_MANAGER permission on ksoft to use it
Example
ⓘ
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]
&self,
user_id: u64
) -> HttpResult<BanDeletionResponse, BanError>
Deletes an user ban. Must have BAN_MANAGER permission on ksoft to use it
Example
ⓘ
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
impl !RefUnwindSafe for Bans
impl Send for Bans
impl Sync for Bans
impl Unpin for Bans
impl !UnwindSafe for Bans
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,