pub struct ComponentInteractionCollector { /* private fields */ }Expand description
A ComponentInteractionCollector receives ComponentInteraction’s match the given filters for a set duration.
Implementations§
Source§impl ComponentInteractionCollector
 
impl ComponentInteractionCollector
Sourcepub fn new(shard: impl AsRef<ShardMessenger>) -> Self
 
pub fn new(shard: impl AsRef<ShardMessenger>) -> Self
Creates a new collector without any filters configured.
Sourcepub fn timeout(self, duration: Duration) -> Self
 
pub fn timeout(self, duration: Duration) -> Self
Sets a duration for how long the collector shall receive interactions.
Sourcepub fn filter(
    self,
    filter: impl Fn(&ComponentInteraction) -> bool + Send + Sync + 'static,
) -> Self
 
pub fn filter( self, filter: impl Fn(&ComponentInteraction) -> bool + Send + Sync + 'static, ) -> Self
Sets a generic filter function.
Filters ComponentInteraction’s by a specific UserId.
Sourcepub fn channel_id(self, channel_id: ChannelId) -> Self
 
pub fn channel_id(self, channel_id: ChannelId) -> Self
Filters ComponentInteraction’s by a specific ChannelId.
Sourcepub fn guild_id(self, guild_id: GuildId) -> Self
 
pub fn guild_id(self, guild_id: GuildId) -> Self
Filters ComponentInteraction’s by a specific GuildId.
Sourcepub fn message_id(self, message_id: MessageId) -> Self
 
pub fn message_id(self, message_id: MessageId) -> Self
Filters ComponentInteraction’s by a specific MessageId.
Sourcepub fn custom_ids(self, custom_ids: Vec<String>) -> Self
 
pub fn custom_ids(self, custom_ids: Vec<String>) -> Self
Filters ComponentInteraction’s by a specific Vec<String>.
Sourcepub fn stream(self) -> impl Stream<Item = ComponentInteraction>
 
pub fn stream(self) -> impl Stream<Item = ComponentInteraction>
Returns a Stream over all collected ComponentInteraction.
Sourcepub fn build(self) -> impl Stream<Item = ComponentInteraction>
 👎Deprecated: use .stream() instead
pub fn build(self) -> impl Stream<Item = ComponentInteraction>
.stream() insteadDeprecated, use Self::stream() instead.
Sourcepub async fn next(self) -> Option<ComponentInteraction>
 
pub async fn next(self) -> Option<ComponentInteraction>
Returns the next ComponentInteraction which passes the filters.
You can also call .await on the ComponentInteractionCollector directly.