This repository was archived by the owner on Jan 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] Dan's Cogs; higherlower and randomnum #1
Open
TheGoatInTheBoat
wants to merge
2
commits into
main
Choose a base branch
from
onboarding-dan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+102
−0
Conversation
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
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
|
Member
|
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.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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: