refactor(examples): general cleanup + improvements
Summary
Followup to #562. Slightly refactors and generally cleans up all examples, adding module docstrings to every file, and clarifying/improving comments. Also fixes two examples not working at all due to missing message content intent.
The one thing that's still inconsistent is that some examples print a Logged in as {bot.user} (ID: {bot.user.id}) on startup, while others don't - not sure if those should just be removed altogether, or if every example should show it.
Checklist
- [x] If code changes were made, then they have been tested
- [ ] I have updated the documentation to reflect the changes
- [x] I have formatted the code properly by running
task lint - [x] I have type-checked the code by running
task pyright
- [ ] This PR fixes an issue
- [ ] This PR adds something new (e.g. new method or parameters)
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)
Merge is blocked by a needed snakebot update
Merge is blocked by a needed snakebot update
Should be fixed as of https://github.com/onerandomusername/snakebot/pull/69.
This is still partially blocked; that snakebot pr only fixed the instant issue but doesn't solve the underlying issue.
@shiftinv just to clarify, is this pr otherwise done, just waiting on snakebot?
@shiftinv just to clarify, is this pr otherwise done, just waiting on snakebot?
Yup, other than that it's done, except for the logging inconsistency mentioned in the description which I'm undecided about.
Snakebot update has been made and deployed as of commit https://github.com/onerandomusername/snakebot/commit/628ec2e1941895a8ee9b285ac80afa49dac6c2fd
Thoughts on gating every run() method with an
if __name__ == "__main__":?
Fair, but I'd rather keep examples without boilerplate code as much as possible. Gating with __name__ == "__main__" is definitely good practice, I don't think it's needed in these examples though.
Thoughts on gating every run() method with an
if __name__ == "__main__":?Fair, but I'd rather keep examples without boilerplate code as much as possible. Gating with
__name__ == "__main__"is definitely good practice, I don't think it's needed in these examples though.
I think it should be done, as these examples are supposed to be the best practices