#[repr(packed(1))]pub struct ChannelId(/* private fields */);
Expand description
An identifier for a Channel
Implementations§
source§impl ChannelId
impl ChannelId
sourcepub async fn broadcast_typing(self, http: impl AsRef<Http>) -> Result<()>
Available on crate feature model
only.
pub async fn broadcast_typing(self, http: impl AsRef<Http>) -> Result<()>
model
only.Broadcasts that the current user is typing to a channel for the next 5 seconds.
After 5 seconds, another request must be made to continue broadcasting that the current user is typing.
This should rarely be used for bots, and should likely only be used for signifying that a long-running command is still being executed.
Note: Requires the Send Messages permission.
§Examples
use serenity::model::id::ChannelId;
let _successful = ChannelId::new(7).broadcast_typing(&http).await;
§Errors
Returns Error::Http
if the current user lacks permission to send messages to this
channel.
sourcepub async fn create_invite(
self,
cache_http: impl CacheHttp,
builder: CreateInvite<'_>
) -> Result<RichInvite>
Available on crate feature model
only.
pub async fn create_invite( self, cache_http: impl CacheHttp, builder: CreateInvite<'_> ) -> Result<RichInvite>
model
only.Creates an invite for the given channel.
Note: Requires the Create Instant Invite permission.
§Errors
If the cache
is enabled, returns ModelError::InvalidPermissions
if the current user
lacks permission. Otherwise returns Error::Http
, as well as if invalid data is given.
sourcepub async fn create_permission(
self,
http: impl AsRef<Http>,
target: PermissionOverwrite
) -> Result<()>
Available on crate feature model
only.
pub async fn create_permission( self, http: impl AsRef<Http>, target: PermissionOverwrite ) -> Result<()>
model
only.Creates a permission overwrite for either a single Member
or
Role
within the channel.
Refer to the documentation for GuildChannel::create_permission
for more information.
Requires the Manage Channels permission.
§Errors
Returns Error::Http
if the current user lacks permission, or if an invalid value is
set.
sourcepub async fn create_reaction(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
reaction_type: impl Into<ReactionType>
) -> Result<()>
Available on crate feature model
only.
pub async fn create_reaction( self, http: impl AsRef<Http>, message_id: impl Into<MessageId>, reaction_type: impl Into<ReactionType> ) -> Result<()>
model
only.React to a Message
with a custom Emoji
or unicode character.
Message::react
may be a more suited method of reacting in most cases.
Requires the Add Reactions permission, if the current user is the first user to perform a react with a certain emoji.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn delete(self, http: impl AsRef<Http>) -> Result<Channel>
Available on crate feature model
only.
pub async fn delete(self, http: impl AsRef<Http>) -> Result<Channel>
model
only.Deletes this channel, returning the channel on a successful deletion.
Note: Requires the Manage Channels permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn delete_message(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_message( self, http: impl AsRef<Http>, message_id: impl Into<MessageId> ) -> Result<()>
model
only.Deletes a Message
given its Id.
Refer to Message::delete
for more information.
Requires the Manage Messages permission, if the current user is not the author of the message.
§Errors
Returns Error::Http
if the current user lacks permission to delete the message.
sourcepub async fn delete_messages<T: AsRef<MessageId>>(
self,
http: impl AsRef<Http>,
message_ids: impl IntoIterator<Item = T>
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_messages<T: AsRef<MessageId>>( self, http: impl AsRef<Http>, message_ids: impl IntoIterator<Item = T> ) -> Result<()>
model
only.Deletes all messages by Ids from the given vector in the given channel.
The minimum amount of messages is 2 and the maximum amount is 100.
Requires the Manage Messages permission.
Note: Messages that are older than 2 weeks can’t be deleted using this method.
§Errors
Returns ModelError::BulkDeleteAmount
if an attempt was made to delete either 0 or more
than 100 messages.
Also will return Error::Http
if the current user lacks permission to delete messages.
sourcepub async fn delete_permission(
self,
http: impl AsRef<Http>,
permission_type: PermissionOverwriteType
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_permission( self, http: impl AsRef<Http>, permission_type: PermissionOverwriteType ) -> Result<()>
model
only.Deletes all permission overrides in the channel from a member or role.
Note: Requires the Manage Channel permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn delete_reaction(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
user_id: Option<UserId>,
reaction_type: impl Into<ReactionType>
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_reaction( self, http: impl AsRef<Http>, message_id: impl Into<MessageId>, user_id: Option<UserId>, reaction_type: impl Into<ReactionType> ) -> Result<()>
model
only.Deletes the given Reaction
from the channel.
Note: Requires the Manage Messages permission, if the current user did not perform the reaction.
§Errors
Returns Error::Http
if the current user did not perform the reaction, and lacks
permission.
sourcepub async fn delete_reactions(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_reactions( self, http: impl AsRef<Http>, message_id: impl Into<MessageId> ) -> Result<()>
model
only.Deletes all of the Reaction
s associated with the provided message id.
Note: Requires the Manage Messages permission.
§Errors
Returns Error::Http
if the current user lacks permission
sourcepub async fn delete_reaction_emoji(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
reaction_type: impl Into<ReactionType>
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_reaction_emoji( self, http: impl AsRef<Http>, message_id: impl Into<MessageId>, reaction_type: impl Into<ReactionType> ) -> Result<()>
model
only.Deletes all Reaction
s of the given emoji to a message within the channel.
Note: Requires the Manage Messages permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn edit(
self,
cache_http: impl CacheHttp,
builder: EditChannel<'_>
) -> Result<GuildChannel>
Available on crate feature model
only.
pub async fn edit( self, cache_http: impl CacheHttp, builder: EditChannel<'_> ) -> Result<GuildChannel>
model
only.Edits a channel’s settings.
Refer to the documentation for EditChannel
for a full list of methods.
Note: Requires the Manage Channels permission. Modifying permissions via
EditChannel::permissions
also requires the Manage Roles permission.
§Examples
Change a voice channel’s name and bitrate:
let builder = EditChannel::new().name("test").bitrate(64000);
channel_id.edit(&http, builder).await;
§Errors
If the cache
is enabled, returns a ModelError::InvalidPermissions
if the current user
lacks permission. Otherwise returns Error::Http
, as well as if invalid data is given.
sourcepub async fn edit_message(
self,
cache_http: impl CacheHttp,
message_id: impl Into<MessageId>,
builder: EditMessage
) -> Result<Message>
Available on crate feature model
only.
pub async fn edit_message( self, cache_http: impl CacheHttp, message_id: impl Into<MessageId>, builder: EditMessage ) -> Result<Message>
model
only.Edits a Message
in the channel given its Id.
Message editing preserves all unchanged message data, with some exceptions for embeds and attachments.
Note: In most cases requires that the current user be the author of the message.
Refer to the documentation for EditMessage
for information regarding content
restrictions and requirements.
§Errors
See EditMessage::execute
for a list of possible errors, and their corresponding
reasons.
sourcepub async fn follow(
self,
http: impl AsRef<Http>,
target_channel_id: impl Into<ChannelId>
) -> Result<FollowedChannel>
Available on crate feature model
only.
pub async fn follow( self, http: impl AsRef<Http>, target_channel_id: impl Into<ChannelId> ) -> Result<FollowedChannel>
model
only.Follows the News Channel
Requires [Manage Webhook] permissions on the target channel.
Note: Only available on news channels.
§Errors
Returns Error::Http
if the current user lacks permission. [Manage Webhook]:
Permissions::MANAGE_WEBHOOKS
sourcepub fn to_channel_cached(self, cache: &Cache) -> Option<GuildChannelRef<'_>>
👎Deprecated: Use Cache::guild and Guild::channels insteadAvailable on crate features model
and cache
only.
pub fn to_channel_cached(self, cache: &Cache) -> Option<GuildChannelRef<'_>>
model
and cache
only.Attempts to find a GuildChannel
by its Id in the cache.
sourcepub async fn to_channel(self, cache_http: impl CacheHttp) -> Result<Channel>
Available on crate feature model
only.
pub async fn to_channel(self, cache_http: impl CacheHttp) -> Result<Channel>
model
only.First attempts to retrieve the channel from the temp_cache
if enabled, otherwise performs
a HTTP request.
It is recommended to first check if the channel is accessible via Cache::guild
and
Guild::members
, although this requires a GuildId
.
§Errors
Returns Error::Http
if the channel retrieval request failed.
sourcepub async fn invites(self, http: impl AsRef<Http>) -> Result<Vec<RichInvite>>
Available on crate feature model
only.
pub async fn invites(self, http: impl AsRef<Http>) -> Result<Vec<RichInvite>>
model
only.Gets all of the channel’s invites.
Requires the Manage Channels permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn message(
self,
cache_http: impl CacheHttp,
message_id: impl Into<MessageId>
) -> Result<Message>
Available on crate feature model
only.
pub async fn message( self, cache_http: impl CacheHttp, message_id: impl Into<MessageId> ) -> Result<Message>
model
only.Gets a message from the channel.
If the cache feature is enabled the cache will be checked first. If not found it will resort to an http request.
Requires the Read Message History permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn messages(
self,
cache_http: impl CacheHttp,
builder: GetMessages
) -> Result<Vec<Message>>
Available on crate feature model
only.
pub async fn messages( self, cache_http: impl CacheHttp, builder: GetMessages ) -> Result<Vec<Message>>
model
only.Gets messages from the channel.
Note: If the user does not have the Read Message History permission, returns an empty
Vec
.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub fn messages_iter<H: AsRef<Http>>(
self,
http: H
) -> impl Stream<Item = Result<Message>>
Available on crate feature model
only.
pub fn messages_iter<H: AsRef<Http>>( self, http: H ) -> impl Stream<Item = Result<Message>>
model
only.Streams over all the messages in a channel.
This is accomplished and equivalent to repeated calls to Self::messages
. A buffer of at
most 100 messages is used to reduce the number of calls. necessary.
The stream returns the newest message first, followed by older messages.
§Examples
use serenity::futures::StreamExt;
use serenity::model::channel::MessagesIter;
let mut messages = channel_id.messages_iter(&ctx).boxed();
while let Some(message_result) = messages.next().await {
match message_result {
Ok(message) => println!("{} said \"{}\".", message.author.name, message.content,),
Err(error) => eprintln!("Uh oh! Error: {}", error),
}
}
sourcepub async fn name(self, cache_http: impl CacheHttp) -> Result<String>
Available on crate feature model
only.
pub async fn name(self, cache_http: impl CacheHttp) -> Result<String>
model
only.Returns the name of whatever channel this id holds.
DM channels don’t have a name, so a name is generated according to
PrivateChannel::name()
.
§Errors
Same as Self::to_channel()
.
sourcepub async fn pin(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<()>
Available on crate feature model
only.
pub async fn pin( self, http: impl AsRef<Http>, message_id: impl Into<MessageId> ) -> Result<()>
model
only.Pins a Message
to the channel.
Note: Requires the Manage Messages permission.
§Errors
Returns Error::Http
if the current user lacks permission, or if the channel has too
many pinned messages.
sourcepub async fn crosspost(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<Message>
Available on crate feature model
only.
pub async fn crosspost( self, http: impl AsRef<Http>, message_id: impl Into<MessageId> ) -> Result<Message>
model
only.Crossposts a Message
.
Requires either to be the message author or to have manage Manage Messages permissions on this channel.
Note: Only available on news channels.
§Errors
Returns Error::Http
if the current user lacks permission, and if the user is not the
author of the message.
sourcepub async fn pins(self, http: impl AsRef<Http>) -> Result<Vec<Message>>
Available on crate feature model
only.
pub async fn pins(self, http: impl AsRef<Http>) -> Result<Vec<Message>>
model
only.Gets the list of Message
s which are pinned to the channel.
Note: Returns an empty Vec
if the current user does not have the Read Message
History permission.
§Errors
Returns Error::Http
if the current user lacks permission to view the channel.
sourcepub async fn reaction_users(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
reaction_type: impl Into<ReactionType>,
limit: Option<u8>,
after: impl Into<Option<UserId>>
) -> Result<Vec<User>>
Available on crate feature model
only.
pub async fn reaction_users( self, http: impl AsRef<Http>, message_id: impl Into<MessageId>, reaction_type: impl Into<ReactionType>, limit: Option<u8>, after: impl Into<Option<UserId>> ) -> Result<Vec<User>>
model
only.Gets the list of User
s who have reacted to a Message
with a certain Emoji
.
The default limit
is 50
- specify otherwise to receive a different maximum number of
users. The maximum that may be retrieve at a time is 100
, if a greater number is provided
then it is automatically reduced.
The optional after
attribute is to retrieve the users after a certain user. This is
useful for pagination.
Note: Requires the Read Message History permission.
Note: If the passed reaction_type is a custom guild emoji, it must contain the name.
So, Emoji
or EmojiIdentifier
will always work, ReactionType
only if
ReactionType::Custom::name
is Some, and EmojiId
will never work.
§Errors
Returns Error::Http
if the current user lacks permission to read messages in the
channel.
sourcepub async fn say(
self,
cache_http: impl CacheHttp,
content: impl Into<String>
) -> Result<Message>
Available on crate feature model
only.
pub async fn say( self, cache_http: impl CacheHttp, content: impl Into<String> ) -> Result<Message>
model
only.Sends a message with just the given message content in the channel.
Note: Message content must be under 2000 unicode code points.
§Errors
Returns a ModelError::MessageTooLong
if the content length is over the above limit. See
CreateMessage::execute
for more details.
sourcepub async fn send_files(
self,
cache_http: impl CacheHttp,
files: impl IntoIterator<Item = CreateAttachment>,
builder: CreateMessage
) -> Result<Message>
Available on crate feature model
only.
pub async fn send_files( self, cache_http: impl CacheHttp, files: impl IntoIterator<Item = CreateAttachment>, builder: CreateMessage ) -> Result<Message>
model
only.Sends file(s) along with optional message contents. The filename must be specified.
Message contents may be passed using the builder
argument.
Refer to the documentation for CreateMessage
for information regarding content
restrictions and requirements.
§Examples
Send files with the paths /path/to/file.jpg
and /path/to/file2.jpg
:
use serenity::builder::{CreateAttachment, CreateMessage};
use serenity::model::id::ChannelId;
let channel_id = ChannelId::new(7);
let paths = [
CreateAttachment::path("/path/to/file.jpg").await?,
CreateAttachment::path("path/to/file2.jpg").await?,
];
let builder = CreateMessage::new().content("some files");
channel_id.send_files(&http, paths, builder).await?;
Send files using File
:
use serenity::builder::{CreateAttachment, CreateMessage};
use serenity::model::id::ChannelId;
use tokio::fs::File;
let channel_id = ChannelId::new(7);
let f1 = File::open("my_file.jpg").await?;
let f2 = File::open("my_file2.jpg").await?;
let files = [
CreateAttachment::file(&f1, "my_file.jpg").await?,
CreateAttachment::file(&f2, "my_file2.jpg").await?,
];
let builder = CreateMessage::new().content("some files");
let _ = channel_id.send_files(&http, files, builder).await;
§Errors
See CreateMessage::execute
for a list of possible errors, and their corresponding
reasons.
sourcepub async fn send_message(
self,
cache_http: impl CacheHttp,
builder: CreateMessage
) -> Result<Message>
Available on crate feature model
only.
pub async fn send_message( self, cache_http: impl CacheHttp, builder: CreateMessage ) -> Result<Message>
model
only.Sends a message to the channel.
Refer to the documentation for CreateMessage
for information regarding content
restrictions and requirements.
§Errors
See CreateMessage::execute
for a list of possible errors, and their corresponding
reasons.
sourcepub fn start_typing(self, http: &Arc<Http>) -> Typing
Available on crate feature model
only.
pub fn start_typing(self, http: &Arc<Http>) -> Typing
model
only.Starts typing in the channel for an indefinite period of time.
Returns Typing
that is used to trigger the typing. Typing::stop
must be called on
the returned struct to stop typing. Note that on some clients, typing may persist for a few
seconds after Typing::stop
is called. Typing is also stopped when the struct is
dropped.
If a message is sent while typing is triggered, the user will stop typing for a brief
period of time and then resume again until either Typing::stop
is called or the struct
is dropped.
This should rarely be used for bots, although it is a good indicator that a long-running command is still being processed.
§Examples
// Initiate typing (assuming http is `Arc<Http>`)
let typing = ChannelId::new(7).start_typing(&http);
// Run some long-running process
long_process();
// Stop typing
typing.stop();
§Errors
Returns Error::Http
if the current user lacks permission
to send messages in this channel.
sourcepub async fn unpin(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<()>
Available on crate feature model
only.
pub async fn unpin( self, http: impl AsRef<Http>, message_id: impl Into<MessageId> ) -> Result<()>
model
only.Unpins a Message
in the channel given by its Id.
Requires the Manage Messages permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn webhooks(self, http: impl AsRef<Http>) -> Result<Vec<Webhook>>
Available on crate feature model
only.
pub async fn webhooks(self, http: impl AsRef<Http>) -> Result<Vec<Webhook>>
model
only.Retrieves the channel’s webhooks.
Note: Requires the Manage Webhooks permission.
§Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn create_webhook(
self,
cache_http: impl CacheHttp,
builder: CreateWebhook<'_>
) -> Result<Webhook>
Available on crate feature model
only.
pub async fn create_webhook( self, cache_http: impl CacheHttp, builder: CreateWebhook<'_> ) -> Result<Webhook>
model
only.Creates a webhook in the channel.
§Errors
See CreateWebhook::execute
for a detailed list of possible errors.
sourcepub fn await_reply(
self,
shard_messenger: impl AsRef<ShardMessenger>
) -> MessageCollector
Available on crate features model
and collector
only.
pub fn await_reply( self, shard_messenger: impl AsRef<ShardMessenger> ) -> MessageCollector
model
and collector
only.Returns a builder which can be awaited to obtain a message or stream of messages in this channel.
sourcepub fn await_replies(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> MessageCollector
Available on crate features model
and collector
only.
pub fn await_replies( &self, shard_messenger: impl AsRef<ShardMessenger> ) -> MessageCollector
model
and collector
only.Same as Self::await_reply
.
sourcepub fn await_reaction(
self,
shard_messenger: impl AsRef<ShardMessenger>
) -> ReactionCollector
Available on crate features model
and collector
only.
pub fn await_reaction( self, shard_messenger: impl AsRef<ShardMessenger> ) -> ReactionCollector
model
and collector
only.Returns a builder which can be awaited to obtain a reaction or stream of reactions sent in this channel.
sourcepub fn await_reactions(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> ReactionCollector
Available on crate features model
and collector
only.
pub fn await_reactions( &self, shard_messenger: impl AsRef<ShardMessenger> ) -> ReactionCollector
model
and collector
only.Same as Self::await_reaction
.
sourcepub async fn get_stage_instance(
self,
http: impl AsRef<Http>
) -> Result<StageInstance>
Available on crate feature model
only.
pub async fn get_stage_instance( self, http: impl AsRef<Http> ) -> Result<StageInstance>
model
only.Gets a stage instance.
§Errors
Returns Error::Http
if the channel is not a stage channel, or if there is no stage
instance currently.
sourcepub async fn create_stage_instance(
self,
cache_http: impl CacheHttp,
builder: CreateStageInstance<'_>
) -> Result<StageInstance>
Available on crate feature model
only.
pub async fn create_stage_instance( self, cache_http: impl CacheHttp, builder: CreateStageInstance<'_> ) -> Result<StageInstance>
model
only.Creates a stage instance.
§Errors
Returns Error::Http
if there is already a stage instance currently.
sourcepub async fn edit_stage_instance(
self,
cache_http: impl CacheHttp,
builder: EditStageInstance<'_>
) -> Result<StageInstance>
Available on crate feature model
only.
pub async fn edit_stage_instance( self, cache_http: impl CacheHttp, builder: EditStageInstance<'_> ) -> Result<StageInstance>
model
only.Edits the stage instance
§Errors
Returns ModelError::InvalidChannelType
if the channel is not a stage channel.
Returns Error::Http
if the channel is not a stage channel, or there is no stage
instance currently.
sourcepub async fn edit_thread(
self,
cache_http: impl CacheHttp,
builder: EditThread<'_>
) -> Result<GuildChannel>
Available on crate feature model
only.
pub async fn edit_thread( self, cache_http: impl CacheHttp, builder: EditThread<'_> ) -> Result<GuildChannel>
model
only.sourcepub async fn delete_stage_instance(self, http: impl AsRef<Http>) -> Result<()>
Available on crate feature model
only.
pub async fn delete_stage_instance(self, http: impl AsRef<Http>) -> Result<()>
model
only.Deletes a stage instance.
§Errors
Returns Error::Http
if the channel is not a stage channel, or if there is no stage
instance currently.
sourcepub async fn create_thread_from_message(
self,
cache_http: impl CacheHttp,
message_id: impl Into<MessageId>,
builder: CreateThread<'_>
) -> Result<GuildChannel>
Available on crate feature model
only.
pub async fn create_thread_from_message( self, cache_http: impl CacheHttp, message_id: impl Into<MessageId>, builder: CreateThread<'_> ) -> Result<GuildChannel>
model
only.Creates a public thread that is connected to a message.
§Errors
Returns Error::Http
if the current user lacks permission, or if invalid data is given.
sourcepub async fn create_thread(
self,
cache_http: impl CacheHttp,
builder: CreateThread<'_>
) -> Result<GuildChannel>
Available on crate feature model
only.
pub async fn create_thread( self, cache_http: impl CacheHttp, builder: CreateThread<'_> ) -> Result<GuildChannel>
model
only.Creates a thread that is not connected to a message.
§Errors
Returns Error::Http
if the current user lacks permission, or if invalid data is given.
sourcepub async fn create_forum_post(
self,
cache_http: impl CacheHttp,
builder: CreateForumPost<'_>
) -> Result<GuildChannel>
Available on crate feature model
only.
pub async fn create_forum_post( self, cache_http: impl CacheHttp, builder: CreateForumPost<'_> ) -> Result<GuildChannel>
model
only.Creates a post in a forum channel.
§Errors
Returns Error::Http
if the current user lacks permission, or if invalid data is given.
sourcepub async fn get_thread_members(
self,
http: impl AsRef<Http>
) -> Result<Vec<ThreadMember>>
Available on crate feature model
only.
pub async fn get_thread_members( self, http: impl AsRef<Http> ) -> Result<Vec<ThreadMember>>
model
only.Gets the thread members, if this channel is a thread.
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn join_thread(self, http: impl AsRef<Http>) -> Result<()>
Available on crate feature model
only.
pub async fn join_thread(self, http: impl AsRef<Http>) -> Result<()>
model
only.Joins the thread, if this channel is a thread.
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn leave_thread(self, http: impl AsRef<Http>) -> Result<()>
Available on crate feature model
only.
pub async fn leave_thread(self, http: impl AsRef<Http>) -> Result<()>
model
only.Leaves the thread, if this channel is a thread.
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn add_thread_member(
self,
http: impl AsRef<Http>,
user_id: UserId
) -> Result<()>
Available on crate feature model
only.
pub async fn add_thread_member( self, http: impl AsRef<Http>, user_id: UserId ) -> Result<()>
model
only.Adds a thread member, if this channel is a thread.
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn remove_thread_member(
self,
http: impl AsRef<Http>,
user_id: UserId
) -> Result<()>
Available on crate feature model
only.
pub async fn remove_thread_member( self, http: impl AsRef<Http>, user_id: UserId ) -> Result<()>
model
only.Removes a thread member, if this channel is a thread.
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn get_thread_member(
self,
http: impl AsRef<Http>,
user_id: UserId,
with_member: bool
) -> Result<ThreadMember>
Available on crate feature model
only.
pub async fn get_thread_member( self, http: impl AsRef<Http>, user_id: UserId, with_member: bool ) -> Result<ThreadMember>
model
only.Gets a thread member, if this channel is a thread.
with_member
controls if ThreadMember::member should be Some
§Errors
It may return an Error::Http
if the channel is not a thread channel
sourcepub async fn get_archived_private_threads(
self,
http: impl AsRef<Http>,
before: Option<u64>,
limit: Option<u64>
) -> Result<ThreadsData>
Available on crate feature model
only.
pub async fn get_archived_private_threads( self, http: impl AsRef<Http>, before: Option<u64>, limit: Option<u64> ) -> Result<ThreadsData>
model
only.Gets private archived threads of a channel.
§Errors
It may return an Error::Http
if the bot doesn’t have the permission to get it.
sourcepub async fn get_archived_public_threads(
self,
http: impl AsRef<Http>,
before: Option<u64>,
limit: Option<u64>
) -> Result<ThreadsData>
Available on crate feature model
only.
pub async fn get_archived_public_threads( self, http: impl AsRef<Http>, before: Option<u64>, limit: Option<u64> ) -> Result<ThreadsData>
model
only.Gets public archived threads of a channel.
§Errors
It may return an Error::Http
if the bot doesn’t have the permission to get it.
sourcepub async fn get_joined_archived_private_threads(
self,
http: impl AsRef<Http>,
before: Option<u64>,
limit: Option<u64>
) -> Result<ThreadsData>
Available on crate feature model
only.
pub async fn get_joined_archived_private_threads( self, http: impl AsRef<Http>, before: Option<u64>, limit: Option<u64> ) -> Result<ThreadsData>
model
only.Gets private archived threads joined by the current user of a channel.
§Errors
It may return an Error::Http
if the bot doesn’t have the permission to get it.
sourcepub async fn get_poll_answer_voters(
self,
http: impl AsRef<Http>,
message_id: MessageId,
answer_id: AnswerId,
after: Option<UserId>,
limit: Option<u8>
) -> Result<Vec<User>>
Available on crate feature model
only.
pub async fn get_poll_answer_voters( self, http: impl AsRef<Http>, message_id: MessageId, answer_id: AnswerId, after: Option<UserId>, limit: Option<u8> ) -> Result<Vec<User>>
model
only.Get a list of users that voted for this specific answer.
§Errors
If the message does not have a poll.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ChannelId
impl<'de> Deserialize<'de> for ChannelId
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<'a> From<&'a GuildChannel> for ChannelId
impl<'a> From<&'a GuildChannel> for ChannelId
source§fn from(public_channel: &GuildChannel) -> ChannelId
fn from(public_channel: &GuildChannel) -> ChannelId
Gets the Id of a guild channel.
source§impl<'a> From<&'a PrivateChannel> for ChannelId
impl<'a> From<&'a PrivateChannel> for ChannelId
source§fn from(private_channel: &PrivateChannel) -> ChannelId
fn from(private_channel: &PrivateChannel) -> ChannelId
Gets the Id of a private channel.
source§impl<'a> From<&'a WebhookChannel> for ChannelId
impl<'a> From<&'a WebhookChannel> for ChannelId
source§fn from(webhook_channel: &WebhookChannel) -> ChannelId
fn from(webhook_channel: &WebhookChannel) -> ChannelId
Gets the Id of a webhook channel.
source§impl From<ChannelId> for NonZeroI64
impl From<ChannelId> for NonZeroI64
source§fn from(id: ChannelId) -> NonZeroI64
fn from(id: ChannelId) -> NonZeroI64
source§impl From<ChannelId> for NonZeroU64
impl From<ChannelId> for NonZeroU64
source§fn from(id: ChannelId) -> NonZeroU64
fn from(id: ChannelId) -> NonZeroU64
source§impl From<GuildChannel> for ChannelId
impl From<GuildChannel> for ChannelId
source§fn from(public_channel: GuildChannel) -> ChannelId
fn from(public_channel: GuildChannel) -> ChannelId
Gets the Id of a guild channel.
source§impl From<NonZero<u64>> for ChannelId
impl From<NonZero<u64>> for ChannelId
source§fn from(id: NonZeroU64) -> ChannelId
fn from(id: NonZeroU64) -> ChannelId
source§impl From<PrivateChannel> for ChannelId
impl From<PrivateChannel> for ChannelId
source§fn from(private_channel: PrivateChannel) -> ChannelId
fn from(private_channel: PrivateChannel) -> ChannelId
Gets the Id of a private channel.
source§impl From<WebhookChannel> for ChannelId
impl From<WebhookChannel> for ChannelId
source§fn from(webhook_channel: WebhookChannel) -> ChannelId
fn from(webhook_channel: WebhookChannel) -> ChannelId
Gets the Id of a webhook channel.
source§impl Ord for ChannelId
impl Ord for ChannelId
source§impl PartialEq for ChannelId
impl PartialEq for ChannelId
source§impl PartialOrd for ChannelId
impl PartialOrd for ChannelId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ChannelId
impl Eq for ChannelId
impl StructuralPartialEq for ChannelId
Auto Trait Implementations§
impl Freeze for ChannelId
impl RefUnwindSafe for ChannelId
impl Send for ChannelId
impl Sync for ChannelId
impl Unpin for ChannelId
impl UnwindSafe for ChannelId
Blanket Implementations§
source§impl<T> ArgumentConvert for Twhere
T: FromStr,
impl<T> ArgumentConvert for Twhere
T: FromStr,
§type Err = <T as FromStr>::Err
type Err = <T as FromStr>::Err
utils
and client
only.source§fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
utils
and client
only.s
as a command parameter of this type.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.