discord.py icon indicating copy to clipboard operation
discord.py copied to clipboard

Improving examples

Open Rapptz opened this issue 4 years ago • 8 comments

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.

Rapptz avatar Jan 23 '20 06:01 Rapptz

Custom context example done at #2526

XuaTheGrate avatar Jan 23 '20 06:01 XuaTheGrate

Error handler example done at #2529

PendragonLore avatar Jan 23 '20 22:01 PendragonLore

Subcommands example done at #2530

Snaptraks avatar Jan 24 '20 01:01 Snaptraks

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.

Rapptz avatar Jan 24 '20 01:01 Rapptz

How to make a secret channel example done at #6448

NCPlayz avatar Feb 21 '21 14:02 NCPlayz

#7963 Cogs + Extensions

nmsturcke avatar Apr 30 '22 15:04 nmsturcke

I want to contribute to the Cogs (not extensions) and Extensions (using cogs). make examples of dependency injection in cogs and so on.

ddjerqq avatar Oct 14 '22 09:10 ddjerqq

I maked Cogs (not extensions) example in this pull - #9157

bleudev avatar Dec 26 '22 19:12 bleudev