@@ -33,7 +33,7 @@ struct CreatePollMedia {
3333pub struct CreatePoll < Stage : Sealed > {
3434 question : CreatePollMedia ,
3535 answers : Vec < CreatePollAnswer > ,
36- duration : u8 ,
36+ duration : u16 ,
3737 allow_multiselect : bool ,
3838 layout_type : Option < PollLayoutType > ,
3939
@@ -51,7 +51,7 @@ impl Default for CreatePoll<NeedsQuestion> {
5151 text : String :: default ( ) ,
5252 } ,
5353 answers : Vec :: default ( ) ,
54- duration : u8 :: default ( ) ,
54+ duration : u16 :: default ( ) ,
5555 allow_multiselect : false ,
5656 layout_type : None ,
5757
@@ -115,14 +115,16 @@ impl CreatePoll<NeedsAnswers> {
115115impl CreatePoll < NeedsDuration > {
116116 /// Sets the duration for the Poll to run for.
117117 ///
118- /// This must be less than a week , and will be rounded to hours towards zero.
118+ /// This must be at most 32 days , and will be rounded to hours towards zero.
119119 pub fn duration ( self , duration : std:: time:: Duration ) -> CreatePoll < Ready > {
120+ const DAYS_32 : u16 = 768 ;
121+
120122 let hours = duration. as_secs ( ) / 3600 ;
121123
122124 CreatePoll {
123125 question : self . question ,
124126 answers : self . answers ,
125- duration : hours. try_into ( ) . unwrap_or ( 168 ) ,
127+ duration : hours. try_into ( ) . unwrap_or ( DAYS_32 ) ,
126128 allow_multiselect : self . allow_multiselect ,
127129 layout_type : self . layout_type ,
128130 _stage : Ready ,
0 commit comments