pub trait Poll: Send + Sync {
// Required methods
fn title(&self) -> String;
fn description(&self) -> String;
fn duration(&self) -> u64;
fn on_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
message_id: u64,
yes_votes: u32,
no_votes: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn yes_reaction(&self) -> ReactionType { ... }
fn no_reaction(&self) -> ReactionType { ... }
fn build_embed(&self) -> CreateEmbed { ... }
fn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
command: &'life2 CommandInteraction,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Trait for reaction-based polls.
Required Methods§
Sourcefn description(&self) -> String
fn description(&self) -> String
The poll description/question.
Sourcefn on_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
message_id: u64,
yes_votes: u32,
no_votes: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
message_id: u64,
yes_votes: u32,
no_votes: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when the poll ends with results. yes_votes and no_votes are counts excluding the bot.
Provided Methods§
Sourcefn yes_reaction(&self) -> ReactionType
fn yes_reaction(&self) -> ReactionType
The yes/positive reaction emoji.
Sourcefn no_reaction(&self) -> ReactionType
fn no_reaction(&self) -> ReactionType
The no/negative reaction emoji.
Sourcefn build_embed(&self) -> CreateEmbed
fn build_embed(&self) -> CreateEmbed
Build the embed shown for the poll.
Sourcefn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
command: &'life2 CommandInteraction,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
command: &'life2 CommandInteraction,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Start the poll by sending the embed and adding reactions. Returns the message ID of the created poll.