Conversation
… roll again with button. | database commands | Schema re-org | formatting |
…stants outside of command files. prettier roll.ts code.
ewang2002
requested changes
Sep 15, 2023
Member
ewang2002
left a comment
There was a problem hiding this comment.
Few changes, but looks good!
ewang2002
requested changes
Sep 24, 2023
| * @param {number} max - the highest possible number | ||
| * @returns - returns the random number | ||
| */ | ||
| export async function rng(min: number, max: number): Promise<number> { |
Member
There was a problem hiding this comment.
This function does not need to be async
| rarity = 'uncommon'; | ||
| } else if (rndm > 90 && rndm <= 99) { | ||
| rarity = 'rare'; | ||
| } else if (rndm >= 100) { |
Member
There was a problem hiding this comment.
Suggested change
| } else if (rndm >= 100) { | |
| } else { |
| } else if (rndm >= 100) { | ||
| rarity = 'legendary'; | ||
| } | ||
| const randomGacha = await getRandomGachaOfRarity(rarity!); |
Member
There was a problem hiding this comment.
Suggested change
| 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.)`); | ||
| } |
|
|
||
| if (i.customId === BUTTONS.ROLL_AGAIN_ID) { | ||
| if (rollAgainInUse) { | ||
| await i.update({}) |
Member
There was a problem hiding this comment.
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); |
Member
There was a problem hiding this comment.
Try not to recursively call the run function. You can do this in some other function, but not here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: