-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] Dan's Cogs; higherlower and randomnum #1
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
Reviewer's GuideThis PR introduces two new slash-command cogs for random number generation and an interactive number-guessing game, along with a main entrypoint script to initialize and run the bot. Sequence diagram for the randomnum commandsequenceDiagram
actor User
participant RandomCog
User->>RandomCog: /randomnum (lower_bound, upper_bound)
activate RandomCog
alt lower_bound > upper_bound
RandomCog->>RandomCog: message = "Lower bound must be <= Upper bound"
else
RandomCog->>RandomCog: message = f"{random.randint(lower_bound, upper_bound)} is your number"
end
RandomCog->>RandomCog: embed = discord.Embed(...)
RandomCog-->>User: Sends embed with message
deactivate RandomCog
Class diagram for new Cogs and BotclassDiagram
class higherlowercog{
+bot: commands.Bot
+logger: logging.Logger
+__init__(bot: commands.Bot)
+higherlower(interaction: discord.Interaction, lower_bound: int, upper_bound: int) async
+check(msg: discord.Message) bool
}
class RandomCog{
+bot: commands.Bot
+logger: logging.Logger
+__init__(bot: commands.Bot)
+randomnum(interaction: discord.Interaction, lower_bound: int, upper_bound: int) async
}
class Bot{
+run_bot()
}
higherlowercog --|> commands.Cog
RandomCog --|> commands.Cog
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
test: |
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.
Hey @TheGoatInTheBoat - I've reviewed your changes - here's some feedback:
- Use consistent PascalCase for your Cog class and file names (e.g. HigherLowerCog in higher_lower_cog.py) to match Python conventions and improve readability.
- The
checkfunction currently only allows purely digit content, so negative numbers or malformed input will be ignored—consider using try/except on int conversion instead ofisdigit(). - Both cogs perform similar bound-checking and random-number logic; consider extracting that into a shared helper or base class to avoid duplication.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| import random | ||
|
|
||
|
|
||
| class RandomCog(commands.Cog): |
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.
suggestion: File name doesn't reflect its purpose
Rename dan_onboarding_cog.py to random_cog.py for consistency with the class and command.
Summary by Sourcery
Initialize the Discord bot with two interactive onboarding cogs for random number utilities and set up the bot's main entrypoint
New Features: