(dmChannel, userId, prompt, stepNumber, totalSteps)
| 191 | } |
| 192 | |
| 193 | async function askQuestion(dmChannel, userId, prompt, stepNumber, totalSteps) { |
| 194 | await dmChannel.send({ |
| 195 | embeds: [createEmbed({ |
| 196 | title: `Setup Question ${stepNumber}/${totalSteps}`, |
| 197 | description: prompt, |
| 198 | color: 'primary', |
| 199 | })], |
| 200 | }); |
| 201 | |
| 202 | const collected = await dmChannel.awaitMessages({ |
| 203 | filter: (message) => message.author.id === userId && !message.author.bot, |
| 204 | max: 1, |
| 205 | time: 180_000, |
| 206 | }).catch(() => null); |
| 207 | |
| 208 | if (!collected || !collected.size) { |
| 209 | await dmChannel.send({ |
| 210 | embeds: [buildUserErrorEmbed(ErrorTypes.RATE_LIMIT, 'You did not answer in time. Run the setup wizard again when ready.')], |
| 211 | }); |
| 212 | return null; |
| 213 | } |
| 214 | |
| 215 | const answer = collected.first().content.trim(); |
| 216 | if (answer.toLowerCase() === 'cancel') { |
| 217 | await dmChannel.send({ |
| 218 | embeds: [infoEmbed('Setup Cancelled', 'Setup wizard stopped. Your saved answers are still applied.')], |
| 219 | }); |
| 220 | return { cancelled: true }; |
| 221 | } |
| 222 | |
| 223 | return { answer }; |
| 224 | } |
| 225 | |
| 226 | function formatSavedAck(key, value, guild) { |
| 227 | if (key === 'prefix') { |
no test coverage detected