pub struct ChannelId(pub u64);
Expand description
An identifier for a Channel
Tuple Fields
0: u64
Implementations
sourceimpl 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(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<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<RichInvite> where
F: FnOnce(&mut CreateInvite) -> &mut CreateInvite,
Available on crate feature model
only.
pub async fn create_invite<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<RichInvite> where
F: FnOnce(&mut CreateInvite) -> &mut CreateInvite,
model
only.Creates an invite leading to the given channel.
Note: Requires the Create Instant Invite permission.
Errors
Returns Error::Http
if the current user lacks permission.
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, It>(
self,
http: impl AsRef<Http>,
message_ids: It
) -> Result<()> where
T: AsRef<MessageId>,
It: IntoIterator<Item = T>,
Available on crate feature model
only.
pub async fn delete_messages<T, It>(
self,
http: impl AsRef<Http>,
message_ids: It
) -> Result<()> where
T: AsRef<MessageId>,
It: IntoIterator<Item = T>,
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_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<F>(self, http: impl AsRef<Http>, f: F) -> Result<GuildChannel> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
Available on crate feature model
only.
pub async fn edit<F>(self, http: impl AsRef<Http>, f: F) -> Result<GuildChannel> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
model
only.Edits the settings of a Channel
, optionally setting new values.
Refer to EditChannel
’s documentation for its methods.
Requires the Manage Channel permission.
Examples
Change a voice channel’s name and bitrate:
// assuming a `channel_id` has been bound
channel_id.edit(&http, |c| c.name("test").bitrate(64000)).await;
Errors
Returns Error::Http
if the current user lacks permission,
or if an invalid value is set.
sourcepub async fn edit_message<'a, F>(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
f: F
) -> Result<Message> where
F: for<'b> FnOnce(&'b mut EditMessage<'a>) -> &'b mut EditMessage<'a>,
Available on crate feature model
only.
pub async fn edit_message<'a, F>(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
f: F
) -> Result<Message> where
F: for<'b> FnOnce(&'b mut EditMessage<'a>) -> &'b mut EditMessage<'a>,
model
only.Edits a Message
in the channel given its Id.
Message editing preserves all unchanged message data.
Refer to the documentation for EditMessage
for more information
regarding message restrictions and requirements.
Note: Requires that the current user be the author of the message.
Errors
Returns a ModelError::MessageTooLong
if the content of the message
is over the the limit
, containing the number of unicode code points
over the limit.
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: impl AsRef<Cache>) -> Option<Channel>
Available on crate features model
and cache
only.
pub fn to_channel_cached(self, cache: impl AsRef<Cache>) -> Option<Channel>
model
and cache
only.Attempts to find a Channel
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 find a Channel
by its Id in the cache,
upon failure requests it via the REST API.
Note: If the cache
-feature is enabled permissions will be checked and upon owning the
required permissions the HTTP-request will be issued. Additionally, you might want to
enable the temp_cache
feature to cache channel data retrieved by this function for a
short duration.
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,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<Message>
Available on crate feature model
only.
pub async fn message(
self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>
) -> Result<Message>
model
only.Gets a message from the channel.
Requires the Read Message History permission.
Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn messages<F>(
self,
http: impl AsRef<Http>,
builder: F
) -> Result<Vec<Message>> where
F: FnOnce(&mut GetMessages) -> &mut GetMessages,
Available on crate feature model
only.
pub async fn messages<F>(
self,
http: impl AsRef<Http>,
builder: F
) -> Result<Vec<Message>> where
F: FnOnce(&mut GetMessages) -> &mut GetMessages,
model
only.Gets messages from the channel.
Refer to GetMessages
for more information on how to use builder
.
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 does not have
permission to view the channel.
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: impl AsRef<Cache>) -> Option<String>
Available on crate features model
and cache
only.
pub async fn name(self, cache: impl AsRef<Cache>) -> Option<String>
model
and cache
only.Returns the name of whatever channel this id holds.
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.
[Manage Messages]: Permissions::MANAGE_MESSAGES
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.
Errors
Returns Error::Http
if the current user lacks permission
to read messages in the channel.
sourcepub async fn say(
self,
http: impl AsRef<Http>,
content: impl Display
) -> Result<Message>
Available on crate feature model
only.
pub async fn say(
self,
http: impl AsRef<Http>,
content: impl Display
) -> Result<Message>
model
only.Sends a message with just the given message content in the channel.
Errors
Returns a ModelError::MessageTooLong
if the content of the message
is over the above limit, containing the number of unicode code points
over the limit.
sourcepub async fn send_files<'a, F, T, It>(
self,
http: impl AsRef<Http>,
files: It,
f: F
) -> Result<Message> where
for<'b> F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>,
T: Into<AttachmentType<'a>>,
It: IntoIterator<Item = T>,
Available on crate feature model
only.
pub async fn send_files<'a, F, T, It>(
self,
http: impl AsRef<Http>,
files: It,
f: F
) -> Result<Message> where
for<'b> F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>,
T: Into<AttachmentType<'a>>,
It: IntoIterator<Item = T>,
model
only.Sends file(s) along with optional message contents. The filename must be specified.
Message contents may be passed by using the CreateMessage::content
method.
The Attach Files and Send Messages permissions are required.
Note: Message contents must be under 2000 unicode code points, and embeds must be under 6000 unicode code points.
Examples
Send files with the paths /path/to/file.jpg
and /path/to/file2.jpg
:
use serenity::model::id::ChannelId;
let channel_id = ChannelId(7);
let paths = vec!["/path/to/file.jpg", "path/to/file2.jpg"];
let _ = channel_id.send_files(&http, paths, |m| m.content("a file")).await;
Send files using File
:
use serenity::model::id::ChannelId;
use tokio::fs::File;
let channel_id = ChannelId(7);
let f1 = File::open("my_file.jpg").await?;
let f2 = File::open("my_file2.jpg").await?;
let files = vec![(&f1, "my_file.jpg"), (&f2, "my_file2.jpg")];
let _ = channel_id.send_files(&http, files, |m| m.content("a file")).await;
Errors
If the content of the message is over the above limit, then a
ModelError::MessageTooLong
will be returned, containing the number
of unicode code points over the limit.
Returns an
HttpError::UnsuccessfulRequest(ErrorResponse)
if the file(s) are too large to send.
sourcepub async fn send_message<'a, F>(
self,
http: impl AsRef<Http>,
f: F
) -> Result<Message> where
for<'b> F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>,
Available on crate feature model
only.
pub async fn send_message<'a, F>(
self,
http: impl AsRef<Http>,
f: F
) -> Result<Message> where
for<'b> F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>,
model
only.Sends a message to the channel.
Refer to the documentation for CreateMessage
for more information
regarding message restrictions and requirements.
Requires the Send Messages permission.
Note: Message contents must be under 2000 unicode code points.
Errors
Returns a ModelError::MessageTooLong
if the content of the message
is over the above limit, containing the number of unicode code points
over the limit.
Returns Error::Http
if the current user lacks permission to
send a message in this channel.
sourcepub fn start_typing(self, http: &Arc<Http>) -> Result<Typing>
Available on crate feature model
only.
pub fn start_typing(self, http: &Arc<Http>) -> Result<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(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,
http: impl AsRef<Http>,
name: impl Display
) -> Result<Webhook>
Available on crate feature model
only.
pub async fn create_webhook(
&self,
http: impl AsRef<Http>,
name: impl Display
) -> Result<Webhook>
model
only.Creates a webhook with only a name.
Errors
Returns a Error::Http
if the current user lacks permission.
sourcepub async fn create_webhook_with_avatar<'a>(
&self,
http: impl AsRef<Http>,
name: impl Display,
avatar: impl Into<AttachmentType<'a>>
) -> Result<Webhook>
Available on crate feature model
only.
pub async fn create_webhook_with_avatar<'a>(
&self,
http: impl AsRef<Http>,
name: impl Display,
avatar: impl Into<AttachmentType<'a>>
) -> Result<Webhook>
model
only.Creates a webhook with a name and an avatar.
Errors
In addition to the reasons Self::create_webhook
may return an Error::Http
,
if the image is too large.
sourcepub fn await_reply(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> CollectReplyⓘNotable traits for CollectReplyimpl Future for CollectReply type Output = Option<Arc<Message>>;
Available on crate features model
and collector
only.
pub fn await_reply(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> CollectReplyⓘNotable traits for CollectReplyimpl Future for CollectReply type Output = Option<Arc<Message>>;
model
and collector
only.Returns a future that will await one message sent in this channel.
sourcepub fn await_replies(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> MessageCollectorBuilder
Available on crate features model
and collector
only.
pub fn await_replies(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> MessageCollectorBuilder
model
and collector
only.Returns a stream builder which can be awaited to obtain a stream of messages in this channel.
sourcepub fn await_reaction(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> CollectReactionⓘNotable traits for CollectReactionimpl Future for CollectReaction type Output = Option<Arc<ReactionAction>>;
Available on crate features model
and collector
only.
pub fn await_reaction(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> CollectReactionⓘNotable traits for CollectReactionimpl Future for CollectReaction type Output = Option<Arc<ReactionAction>>;
model
and collector
only.Await a single reaction in this guild.
sourcepub fn await_reactions(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> ReactionCollectorBuilder
Available on crate features model
and collector
only.
pub fn await_reactions(
&self,
shard_messenger: impl AsRef<ShardMessenger>
) -> ReactionCollectorBuilder
model
and collector
only.Returns a stream builder which can be awaited to obtain a stream of reactions sent in this channel.
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<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<StageInstance> where
F: FnOnce(&mut CreateStageInstance) -> &mut CreateStageInstance,
Available on crate feature model
only.
pub async fn create_stage_instance<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<StageInstance> where
F: FnOnce(&mut CreateStageInstance) -> &mut CreateStageInstance,
model
only.Creates a stage instance.
Errors
Returns Error::Http
if the channel is not a stage channel,
or if there is already a stage instance currently.
sourcepub async fn edit_stage_instance<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<StageInstance> where
F: FnOnce(&mut EditStageInstance) -> &mut EditStageInstance,
Available on crate feature model
only.
pub async fn edit_stage_instance<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<StageInstance> where
F: FnOnce(&mut EditStageInstance) -> &mut EditStageInstance,
model
only.Edits a stage instance.
Errors
Returns Error::Http
if the channel is not a stage channel,
or if there is not stage instance currently.
sourcepub async fn edit_thread<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut EditThread) -> &mut EditThread,
Available on crate feature model
only.
pub async fn edit_thread<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut EditThread) -> &mut EditThread,
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_public_thread<F>(
&self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut CreateThread) -> &mut CreateThread,
Available on crate feature model
only.
pub async fn create_public_thread<F>(
&self,
http: impl AsRef<Http>,
message_id: impl Into<MessageId>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut CreateThread) -> &mut CreateThread,
model
only.Creates a public thread that is connected to a message.
Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn create_private_thread<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut CreateThread) -> &mut CreateThread,
Available on crate feature model
only.
pub async fn create_private_thread<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildChannel> where
F: FnOnce(&mut CreateThread) -> &mut CreateThread,
model
only.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_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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for ChannelId
impl<'de> Deserialize<'de> for ChannelId
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> From<&'a GuildChannel> for ChannelId
impl<'a> From<&'a GuildChannel> for ChannelId
sourcefn from(public_channel: &GuildChannel) -> ChannelId
fn from(public_channel: &GuildChannel) -> ChannelId
Gets the Id of a guild channel.
sourceimpl<'a> From<&'a PrivateChannel> for ChannelId
impl<'a> From<&'a PrivateChannel> for ChannelId
sourcefn from(private_channel: &PrivateChannel) -> ChannelId
fn from(private_channel: &PrivateChannel) -> ChannelId
Gets the Id of a private channel.
sourceimpl From<GuildChannel> for ChannelId
impl From<GuildChannel> for ChannelId
sourcefn from(public_channel: GuildChannel) -> ChannelId
fn from(public_channel: GuildChannel) -> ChannelId
Gets the Id of a guild channel.
sourceimpl From<PrivateChannel> for ChannelId
impl From<PrivateChannel> for ChannelId
sourcefn from(private_channel: PrivateChannel) -> ChannelId
fn from(private_channel: PrivateChannel) -> ChannelId
Gets the Id of a private channel.
sourceimpl Ord for ChannelId
impl Ord for ChannelId
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<ChannelId> for ChannelId
impl PartialOrd<ChannelId> for ChannelId
sourcefn partial_cmp(&self, other: &ChannelId) -> Option<Ordering>
fn partial_cmp(&self, other: &ChannelId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for ChannelId
impl Eq for ChannelId
impl StructuralEq for ChannelId
impl StructuralPartialEq for ChannelId
Auto Trait Implementations
impl RefUnwindSafe for ChannelId
impl Send for ChannelId
impl Sync for ChannelId
impl Unpin for ChannelId
impl UnwindSafe for ChannelId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<F> FromStrAndCache for F where
F: FromStr,
impl<F> FromStrAndCache for F where
F: FromStr,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Mentionable for T where
T: Into<Mention> + Copy,
impl<T> Mentionable for T where
T: Into<Mention> + Copy,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more