[APPROVED] CBD-Cogs

Discord Name: Nestor10#7163

GitHub Repository (Must be V3): https://gitlab.com/CrunchBangDev/cbd-cogs

Description: A few modest cogs that I couldn’t find anywhere so I wrote myself

Hi Nestor10, thank you for your patience while I review your repo. I have three small issues to be addressed and everything else is optional or things to look at and consider.

Commit hash at time of review - b07b0deaa0a31ad8b499890c8cbb478c8837acfc

Bio

bio.py

  • Line 18: You should have a docstring for all cog class declarations. This is actually used when someone does [p]help Bio to see all the cogs commands.
  • Line 38: The backslash is redundant when inside brackets and can be removed safely (Optional).

Fun tip you can concatenate strings in python automatically if they’re inside brackets like so:

>>>my_string = (
   "This is line 1 "
   "and this is line 2."
)
>>>my_string
>>>This is line 1 and this is line 2.

This also works inside function brackets.

  • Line 46-49, 61: You should consider using an alternative consume-rest here. async def add_field(self, ctx: commands.Context, *, argFields: str) will take everything after the base command as a single string eliminating the need to join each item in the tuple. (Optional)

Scrub

scrub.py

  • Some general thoughts, you might consider caching the regex patterns you’re using to improve efficiency and reducer overall “cost” of checking messages for specific patterns. For example you can compile your pattern to find links inside a message by having LINK_PATTERN = re.compile(r"https?://(\S+)") at the beginning of the cog and then when you want to search on a message do LINK_PATTERN.findall(message.content). This is a good habit to get into as now the cog isn’t trying to compile the regex pattern on every single message it sees causing unnecessary overhead. This can be applied to any regex pattern you plan on utilizing a lot. (Optional)

Tube

tube.py

  • Line 25-27: Your cog docstrings should be below the class definition not under the __init__
  • Line 218: timeout is defined but never used. (Optional)
  • Line 127, 149, and 202: You should still have some docstrings here to explain what the function of the commands are even though they’re hidden people can still find the commands by reading the code (which happens quite a bit) and then pull up the usage by doing [p]help setinterval It would be very useful for people to be able to see what exactly that command does even if you don’t intend for people to use it you can state so in the help description.

Hey Trusty, thanks so much for taking the time to review my code and write such thoughtful feedback! I believe you will find that commit a2243a1efde30f6160d89e8190e31fd1a5c8be89 addresses each of the action items (plus some other docstring updates because I’m a bad git user).

Thanks for making the changes, marking this as approved.