-
Notifications
You must be signed in to change notification settings - Fork 0
Schema rework | Update to roll command | DB functions updated #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… roll again with button. | database commands | Schema re-org | formatting |
…stants outside of command files. prettier roll.ts code.
ewang2002
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few changes, but looks good!
| * @param {number} max - the highest possible number | ||
| * @returns - returns the random number | ||
| */ | ||
| export async function rng(min: number, max: number): Promise<number> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function does not need to be async
| rarity = 'uncommon'; | ||
| } else if (rndm > 90 && rndm <= 99) { | ||
| rarity = 'rare'; | ||
| } else if (rndm >= 100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } else if (rndm >= 100) { | |
| } else { |
| } else if (rndm >= 100) { | ||
| rarity = 'legendary'; | ||
| } | ||
| const randomGacha = await getRandomGachaOfRarity(rarity!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const randomGacha = await getRandomGachaOfRarity(rarity!); | |
| const randomGacha = await getRandomGachaOfRarity(rarity); |
| if (questionString.length > 256) { | ||
| interaction.reply(`Question is too long. (max 256 char.)`); | ||
| await interaction.reply(`Question is too long. (max 256 char.)`); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to return here?
|
|
||
| if (i.customId === BUTTONS.ROLL_AGAIN_ID) { | ||
| if (rollAgainInUse) { | ||
| await i.update({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try something like deferReply or deferUpdate
Also, be consistent w/ the semicolon usage
| if (!isNaN(parsedNumber)) { | ||
| msgCollector.stop(); | ||
| rollAgainInUse = false; | ||
| await Roll.run(interaction, parsedNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to recursively call the run function. You can do this in some other function, but not here.
Roll command updates:
Optional 'number' option for /roll, which allows you to roll for multiple Gachas at once.
- When rolling multiple times, you can cycle through the Gachas you got using the 'Previous' and 'Next' buttons.
- Only interaction user can use the buttons
'Roll Again!' button which prompts you to choose a number of rolls
- User must send a message containing ONLY a number
Each roll cost 10 coins/balance.
Database functions updated:
New Database Schema: