Skip to content

Update commands examples - #22

Merged
chrisdedman merged 14 commits into
mainfrom
examples
Dec 16, 2025
Merged

chrisdedman merged 14 commits into
mainfrom
examples

Conversation

@chrisdedman

@chrisdedman chrisdedman commented Dec 11, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR refactors, updates, and adds new examples for the currently available commands.

done:

  • shutdown refactor
  • check
  • add README

@chrisdedman chrisdedman self-assigned this Dec 11, 2025
@chrisdedman chrisdedman added documentation Improvements or additions to documentation enhancement labels Dec 11, 2025

@PenguinBoi12 PenguinBoi12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are good improvements but I think there's a few thing we could adjust.

I think this is a good PR to also add a README in the example folder explaining how to run the examples. It doesn't have to be something super complex.

Comment thread examples/error.py Outdated
Comment thread examples/checks.py
Comment thread examples/cooldown_error.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this example is a bit all over the place and command names aren't super descriptive. Also, I know we discussed separating the cooldown example and cooldown with error handling but I think I changed my mind and that in does make sense to have one cooldown example that shows how to catch error at the same time.

Comment thread examples/cooldown_error.py Outdated


# Invoke by using !cooldown_command
@bot.command(cooldown=(1, 10))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need two command for this example. Just having the first one above should be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two command for the reason that both are different ways to invoke the cooldown.

Comment thread examples/cooldown_error.py Outdated
Comment thread examples/cooldown_error.py Outdated
Comment thread examples/error_handling.py
Comment thread examples/error.py Outdated
Comment thread examples/error.py Outdated
@chrisdedman chrisdedman changed the title WIP: Update commands examples Update commands examples Dec 12, 2025
Comment thread examples/cooldown.py Outdated
Comment thread examples/cooldown.py Outdated
PenguinBoi12
PenguinBoi12 previously approved these changes Dec 16, 2025

@PenguinBoi12 PenguinBoi12 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks pretty good. My only nit that I have is that we don't need print information when we ctx.reply. It's a repeated pattern and I don't think it adds much to the example:

print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.")
await ctx.reply("Pong!")

...

print(f"Operation Not Allowed: {error}")
await ctx.reply(f"Operation not allowed: {error}")

...

print(f"ValueError: {error}")
await ctx.reply(f"ValueError: {error}")

That's said, it's not a big deal either.

@PenguinBoi12 PenguinBoi12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chrisdedman
chrisdedman merged commit e73e42d into main Dec 16, 2025
4 checks passed
@chrisdedman
chrisdedman deleted the examples branch December 16, 2025 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants