[][src]Struct panda::HttpClient

pub struct HttpClient { /* fields omitted */ }

It's the http client of panda, it have methods to make requests to all routes

Implementations

impl HttpClient[src]

pub fn new(token: impl Into<String>) -> HttpClient[src]

Creates a new http client

pub async fn get_channel<'_>(
    &'_ self,
    channel_id: impl AsRef<str>
) -> StdResult<Channel, PandaError>
[src]

Get a channel by ID. Returns a Channel object, it will fail if the ID it's invalid

pub async fn edit_channel<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    body: impl Serialize
) -> StdResult<Channel, PandaError>
[src]

Update a channel's settings. Requires the MANAGE_CHANNELS permission for the guild. Returns a Channel on success. It's recommended to use MessageEdit builder. Fires a ChannelUpdate event.

pub async fn delete_channel<'_>(
    &'_ self,
    channel_id: impl AsRef<str>
) -> StdResult<Channel, PandaError>
[src]

Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild. Returns a Channel on success. Fires a ChannelDelete event.

pub async fn get_messages_around<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    limit: u8
) -> StdResult<Vec<Message>, PandaError>
[src]

Returns a Vec<Message> of a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user.

pub async fn get_messages_before<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    limit: u8
) -> StdResult<Vec<Message>, PandaError>
[src]

Returns a Vec<Message> of a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user.

pub async fn get_messages_after<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    limit: u8
) -> StdResult<Vec<Message>, PandaError>
[src]

Returns a Vec<Message> of a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user.

pub async fn get_message<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    msg_id: impl AsRef<str>
) -> StdResult<Message, PandaError>
[src]

Returns a specific Message in the channel. If operating on a guild channel, this endpoint requires the READ_MESSAGE_HISTORY permission to be present on the current user.

pub async fn send_message<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    content: impl AsRef<str>
) -> StdResult<Message, PandaError>
[src]

Creates a new message, and returns the Message. This will also trigger MessageCreate event

pub async fn send_embed<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    embed: Embed
) -> StdResult<Message, PandaError>
[src]

Creates a new message, and returns the Message. This will also trigger MessageCreate event

pub async fn add_reaction<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    emoji: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Add a reaction to a Message, it needs the Channel ID, and Message ID

pub async fn remove_own_reaction<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    emoji: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Remove a own reaction to a Message, it needs the Channel ID, and Message ID

pub async fn remove_user_reaction<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    user_id: impl AsRef<str>,
    emoji: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Remove an User reaction to a Message, it needs the Channel ID, Message ID and User ID.

pub async fn get_reactions<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    emoji: impl AsRef<str>
) -> StdResult<Vec<User>, PandaError>
[src]

Get all Users that reacted with given emoji to a Message, it needs the Channel ID, Message ID

pub async fn remove_all_reactions<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Deletes all reactions on a Message. This endpoint requires the MANAGE_MESSAGES permission to be present on the current user. Fires a MessageReactionRemoveAll.

pub async fn remove_all_emoji_reactions<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    emoji: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Deletes all reactions on a Message. This endpoint requires the MANAGE_MESSAGES permission to be present on the current user. Fires a MessageReactionRemoveEmoji.

pub async fn edit_message<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>,
    body: impl Serialize
) -> StdResult<Message, PandaError>
[src]

Edits message, and returns the Message. This will also trigger MessageUpdate event

pub async fn delete_message<'_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    message_id: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Delete a Message, This will also trigger MessageDelete event

pub async fn delete_many_messages<'_, '_, '_>(
    &'_ self,
    channel_id: impl AsRef<str>,
    messages: &'_ [&'_ str]
) -> StdResult<(), PandaError>
[src]

Delete a a bulk of Message (2 - 100), This will also trigger [MessageDeleteBulk] event.

pub async fn edit_channel_permissions<'_>(
    &'_ self,
    _channel_id: impl AsRef<str>
) -> StdResult<(), PandaError>
[src]

Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission.

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]