disnake icon indicating copy to clipboard operation
disnake copied to clipboard

refactor(examples): general cleanup + improvements

Open shiftinv opened this issue 3 years ago • 5 comments

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, ...)

shiftinv avatar Aug 24 '22 15:08 shiftinv

Merge is blocked by a needed snakebot update

onerandomusername avatar Aug 24 '22 15:08 onerandomusername

Merge is blocked by a needed snakebot update

Should be fixed as of https://github.com/onerandomusername/snakebot/pull/69.

shiftinv avatar Aug 27 '22 21:08 shiftinv

This is still partially blocked; that snakebot pr only fixed the instant issue but doesn't solve the underlying issue.

onerandomusername avatar Aug 28 '22 03:08 onerandomusername

@shiftinv just to clarify, is this pr otherwise done, just waiting on snakebot?

onerandomusername avatar Sep 22 '22 09:09 onerandomusername

@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.

shiftinv avatar Sep 22 '22 13:09 shiftinv

Snakebot update has been made and deployed as of commit https://github.com/onerandomusername/snakebot/commit/628ec2e1941895a8ee9b285ac80afa49dac6c2fd

onerandomusername avatar Sep 24 '22 05:09 onerandomusername

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.

shiftinv avatar Sep 24 '22 11:09 shiftinv

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

onerandomusername avatar Sep 26 '22 19:09 onerandomusername