MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / askQuestion

Function askQuestion

src/commands/Core/configWizard.js:193–224  ·  view source on GitHub ↗
(dmChannel, userId, prompt, stepNumber, totalSteps)

Source from the content-addressed store, hash-verified

191}
192
193async 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
226function formatSavedAck(key, value, guild) {
227 if (key === 'prefix') {

Callers 1

runSetupWizardFunction · 0.85

Calls 3

createEmbedFunction · 0.90
buildUserErrorEmbedFunction · 0.90
infoEmbedFunction · 0.90

Tested by

no test coverage detected