@@ -99,13 +99,11 @@ export default class ExtendCommand implements MessageCommand {
9999 return "Bruder das ist keine Umfrage ಠ╭╮ಠ" ;
100100 }
101101
102- const { poll, options : oldOptions } = dbPoll ;
103-
104- if ( ! poll . extendable ) {
102+ if ( ! dbPoll . extendable ) {
105103 return "Bruder die Umfrage ist nicht erweiterbar (ง'̀-'́)ง" ;
106104 }
107105
108- if ( oldOptions . length === pollEmbedService . OPTION_LIMIT ) {
106+ if ( dbPoll . options . length === pollEmbedService . OPTION_LIMIT ) {
109107 return "Bruder die Umfrage ist leider schon voll (⚆ ͜ʖ⚆)" ;
110108 }
111109
@@ -114,7 +112,7 @@ export default class ExtendCommand implements MessageCommand {
114112 return "Bruder da sind keine Antwortmöglichkeiten :c" ;
115113 }
116114
117- if ( additionalPollOptions . length + oldOptions . length > pollEmbedService . OPTION_LIMIT ) {
115+ if ( additionalPollOptions . length + dbPoll . options . length > pollEmbedService . OPTION_LIMIT ) {
118116 return `Bruder mit deinen Antwortmöglichkeiten wird das Limit von ${ pollEmbedService . OPTION_LIMIT } überschritten!` ;
119117 }
120118
@@ -125,28 +123,28 @@ export default class ExtendCommand implements MessageCommand {
125123 }
126124
127125 for ( const option of additionalPollOptions ) {
128- await pollService . addPollOption ( message . author , poll , option ) ;
126+ await pollService . addPollOption ( message . author , dbPoll , option ) ;
129127 }
130128
131- const newPoll = await pollService . findPoll ( poll . id ) ;
129+ const newPoll = await pollService . findPoll ( dbPoll . id ) ;
132130 if ( newPoll === undefined ) {
133131 throw new Error ( "Could not find poll that should have been there." ) ;
134132 }
135133
136- const pollAuthor = ( await message . guild . members . fetch ( newPoll . poll . authorId ) ) ?. user ?? {
134+ const pollAuthor = ( await message . guild . members . fetch ( newPoll . authorId ) ) ?. user ?? {
137135 username : "<unbekannt>" ,
138136 iconURL : undefined ,
139137 } ;
140138
141139 const embed = pollEmbedService . buildPollEmbed (
142140 message . channel ,
143141 {
144- question : newPoll . poll . question ,
145- anonymous : newPoll . poll . anonymous ,
146- extendable : newPoll . poll . extendable ,
147- ended : newPoll . poll . ended ,
148- endsAt : newPoll . poll . endsAt ? new Date ( newPoll . poll . endsAt ) : null ,
149- multipleChoices : newPoll . poll . multipleChoices ,
142+ question : newPoll . question ,
143+ anonymous : newPoll . anonymous ,
144+ extendable : newPoll . extendable ,
145+ ended : newPoll . ended ,
146+ endsAt : newPoll . endsAt ? new Date ( newPoll . endsAt ) : null ,
147+ multipleChoices : newPoll . multipleChoices ,
150148 author : pollAuthor ,
151149 } ,
152150 newPoll . options . map ( o => ( {
@@ -164,7 +162,7 @@ export default class ExtendCommand implements MessageCommand {
164162 } ) ;
165163
166164 for ( const i in additionalPollOptions ) {
167- await msg . react ( pollEmbedService . EMOJI [ oldOptions . length + Number ( i ) ] ) ;
165+ await msg . react ( pollEmbedService . EMOJI [ dbPoll . options . length + Number ( i ) ] ) ;
168166 }
169167 await message . delete ( ) ;
170168 }
0 commit comments