discord.py
discord.py copied to clipboard
Improving examples
Right now, we don't have a lot of examples that show how to work with various parts of the library. I'm hoping in the near future to revamp examples to be a bit more useful. Part of the on-going work in doing so is to document the current examples (or maybe even rewrite them) significantly through commenting most parts of the code as if someone is explaining it to you over your shoulder.
Hopefully by commenting the code extensively the examples are more helpful for those who learn primarily through examples.
Likewise, I want to add examples that showcase certain things:
- [ ] Subcommands
- [ ] Various types of converters
- [x] Basic reaction roles
- [ ] HelpCommand overriding
- [ ] Cogs (not extensions)
- [ ] Extensions (using cogs)
- [x] Custom contexts
- [ ] Working with permissions (reading and writing, e.g. roles)
- [x] Working with permission overwrites (channel overwrites etc)
- [x] How to make a secret channel
- [ ] Error handling via ext.commands
- [ ] How to use AutoShardedBot/AutoShardedClient
- [ ] An example showcasing how to use the task extension
More example suggestions are welcome. I also would want the previous examples to be heavily commented as well. We can draw inspiration from serenity's examples.
One thing that remains is whether these examples should be linear, similar to a book with chapters where we build upon knowledge on the previous examples. That way we don't have to overly comment everything if it's been covered in a previous example.
Custom context example done at #2526
Error handler example done at #2529
Subcommands example done at #2530
I should mention, for any future person who wants to offer help that although I appreciate the help given I would really appreciate if the contents of the examples were discussed beforehand in the official discord.py server so we can iterate through it together.
How to make a secret channel example done at #6448
#7963 Cogs + Extensions
I want to contribute to the Cogs (not extensions)
and Extensions (using cogs)
. make examples of dependency injection in cogs and so on.
I maked Cogs (not extensions)
example in this pull - #9157