You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Command}from'discord-akairo';import{Message}from'discord.js';exportdefaultclassBruhCommandextendsCommand{constructor(){super('bruh',{aliases: ['bruh'],description: {content: 'Get the mean of a set of numbers.'},category: 'utility',args: [{id: 'numbers',match: 'separate',type: 'number',prompt: {start: 'What numbers should be averaged?',retry: 'Invalid numbers provided, please try again',optional: false}}]});}asyncexec(message: Message,{numbers}: {numbers: number[]}): Promise<Message|undefined>{console.debug(numbers);if(numbers.length>0){returnmessage.util?.send((numbers.reduce((a,b)=>a+b)/numbers.length).toLocaleString());}}}
This simply collects an array of numbers and returns the mean of them.
When the command is run with valid numbers, it works as expected.
When the command is run with invalid input (ex. a b c) it does the following
Prompts for valid input several times (sometimes once, sometimes 3 times)
Runs the command anyway, except the number array is an array of Flags
// Sample log output of `args`[Flag{type: 'cancel'}]
The number of Flags passed to args is equal to the number of times correct input was prompted from a retry.
The text was updated successfully, but these errors were encountered:
I made a simple command shown below
This simply collects an array of numbers and returns the mean of them.
When the command is run with valid numbers, it works as expected.
When the command is run with invalid input (ex.
a b c
) it does the followingFlag
sThe number of
Flag
s passed to args is equal to the number of times correct input was prompted from a retry.The text was updated successfully, but these errors were encountered: