-
Notifications
You must be signed in to change notification settings - Fork 626
Open
Labels
breaking changeThe public API is changed, resulting in miscompilations or unexpected new behaviour for usersThe public API is changed, resulting in miscompilations or unexpected new behaviour for usersbugSomething misbehaves or is not working.Something misbehaves or is not working.discord featureRelated to Discord's functionality.Related to Discord's functionality.good first issueAn easy problem suited for people new to Rust or Serenity.An easy problem suited for people new to Rust or Serenity.
Description
Official docs: https://discord.com/developers/docs/resources/poll#poll-create-request-object
serenity/src/builder/create_poll.rs
Lines 33 to 42 in d1ab1f1
pub struct CreatePoll<Stage: Sealed> { | |
question: CreatePollMedia, | |
answers: Vec<CreatePollAnswer>, | |
duration: u8, | |
allow_multiselect: bool, | |
layout_type: Option<PollLayoutType>, | |
#[serde(skip)] | |
_stage: Stage, | |
} |
Note that the docs also need to be changed to mention the new limit.
serenity/src/builder/create_poll.rs
Lines 115 to 131 in d1ab1f1
impl CreatePoll<NeedsDuration> { | |
/// Sets the duration for the Poll to run for. | |
/// | |
/// This must be less than a week, and will be rounded to hours towards zero. | |
pub fn duration(self, duration: std::time::Duration) -> CreatePoll<Ready> { | |
let hours = duration.as_secs() / 3600; | |
CreatePoll { | |
question: self.question, | |
answers: self.answers, | |
duration: hours.try_into().unwrap_or(168), | |
allow_multiselect: self.allow_multiselect, | |
layout_type: self.layout_type, | |
_stage: Ready, | |
} | |
} | |
} |
Metadata
Metadata
Assignees
Labels
breaking changeThe public API is changed, resulting in miscompilations or unexpected new behaviour for usersThe public API is changed, resulting in miscompilations or unexpected new behaviour for usersbugSomething misbehaves or is not working.Something misbehaves or is not working.discord featureRelated to Discord's functionality.Related to Discord's functionality.good first issueAn easy problem suited for people new to Rust or Serenity.An easy problem suited for people new to Rust or Serenity.