TarsOnlineCogs

Discord Name: nottherealtar

GitHub Repository (Must be V3): GitHub - nottherealtar/TarsOnlineCogs: Cogs for my Redbot v3 instances

Description: This is a collection of cogs that I have made over time, some of them are just fun little projects or things I’ve found. It also showcases the wide use cases of various red v3 functions. Some are duck-taped together but it’s fine, we have the community support xD

Hi nottherealtar, I will begin to review your repository in the coming weeks. Thanks for your patience :heart:

TarsOnlineCogs

  • Repository Review: nottherealtar/TarsOnlineCogs
  • Commit hash at time of review: f3d0963383383643bb0c924388cdf218007ddef6

Thank you for your patience whilst I reviewed your repository. You have shown that you have a strong foundation of knowledge for the discord.py library, and a moderate show of knowledge for Red’s library and internal API. Once you implement the necessary changes from this review, I am happy to mark this repository as approved and assign you as Cog Creator. If you have any queries about this review, please send me a message on Discord.

It seems that many of your cogs’ functionalities are tailored towards a specific bot. In some cases, this is completely breaking commands, or branding the cog for your bot, and not for the bots of the bot owners who are installing your cogs. Things to consider:

  • Is my cog tailored towards my bot? (in embed components, prefixes in command invocations)
  • Is the nomenclature of my cogs and commands suitable for a public repository? (for example, consider renaming some cogs prefixed with “coffee”, if you wish for them to be adapted for any redbot.)

There are also cases where you have cached the cog’s settings instead of using the Config framework. In this case, settings will reset every time the cog is unloaded/reloaded or when the bot is restarted or shut down. This is an inconvenience for users and should be changed.

Please ensure that you check permissions. This includes command decorators and inside commands, such as to delete messages. This is to prevent unpriviledged users exploit permission escalation and cause unwanted behaviour in your cog.

Root Files

Your repository is missing a required info.json file. This resides in the
root of your repository, and consists of keys used to give information to users
about your repository. It must contain author, short and description
keys. For more information, please read here.

Cogs

InfiniCount

Cog package names should typically use lower case by convention. I advise you
change the package name to infinicount or a reasonable alternative.

infinicount.py

  • L2 - The checks module has been deprecated for some time, all command check decorators are now available directly from redbot.core.commands.
  • L59-L84 - Listeners should run a series of checks to ensure they comply with Red’s internal API, and to prevent errors regarding permissions.
    Take a look at this pinned message in #coding.
  • L86 - The setup function must be asynchronous, and bot.add_cog must now be awaited, following the new format introduced in Red 3.5. Please make this amendment so I can test the functionality of the cog. The min_bot_version key in your info.json file says "3.5.0", but the cog is currently ineligible for this version.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

[WIP]coffeecommits

I understand this cog is a work in progress, but I still have taken a small look.

coffeecommits.py

  • L13 - This cog class is missing a required doc-string for the help menu.
  • L16 - This is not the correct way to initialize Config. Config is not a cog, it is an API. You should initialize Config by importing it from redbot.core, and then using the Config.get_conf classmethod. See the config framework for more information.
    As such, calls to Config for this cog do not work and I cannot test this cog’s functionality.
  • L74-L75 - This is not necessary as underlying functionality displays the help menu by default. A simple pass statement will work here.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

[WIP]count4u

This cog has clearly been archived, so I won’t take a look at this. You should remove it from your main branch.

[WIP]varyquote

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

assky

assky.py

  • L25 - This doc-string doesn’t quite capture what the command will do, and could be improved for clarity.
  • L28-L151 - Many of these backslashes are causing invalid escape sequence warnings in the console. To prevent this, convert the string into a raw string r"", or use the backslash twice each time, to escape the backslash itself.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

cafewelcome

I am really impressed by this cog, great work! Good use of bundled_data_path too.

cafewelcome.py

  • L20 - The checks module has been deprecated for some time, all command check decorators are now available directly from redbot.core.commands.

info.json

  • L4 - The name is the TitleCase name of your cog, not lower case.

coffeeinfo

coffeeinfo.py

  • L10 - The checks module has been deprecated for some time, all command check decorators are now available directly from redbot.core.commands.
  • L26-L27 - This is not necessary.
  • L34-L38 - You should check that the bot has sufficient permissions before creating categories.
  • L51-L53 - You should check that the bot has sufficient permissions before deleting channels and categories.
  • L70-L74 - You should check that the bot has sufficient permissions before editing channels.
  • L88-L92 - You should check that the bot has sufficient permissions before editing channels. Additionally, this code is also repeated in the update command, and could be moved to a separate method to avoid code repetition (optional).

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

coffeestatus

It appears the majority of code from this cog has been taken from aikaterna’s rndstatus, and no credit has been given. It is very important to respect the licenses of other repositories if you are using their code directly or with small modifications. You can credit others through the author key in your info.json file. You should check with aikaterna if you are able to use this code.

coffeestatus.py

  • L10 - The checks module has been deprecated for some time, all command check decorators are now available directly from redbot.core.commands.
  • L43-L44 - The cog_unload method needs to be asynchronous and the presence_task.cancel() needs to be awaited.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

howcracked

howcracked.py

  • L181 - This function is not used and can be removed.
  • L185 - This setup function should be removed, as it is defined asynchronously in __init__.py.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

howgay

howgay.py

  • L56-L59 - This try block is not necessary.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

passgen

advpassgen.py

This file is unused and should probably removed until it is implemented for production.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

projectpost

projectpost.py

  • L28-L30 - These messages may be deleted before this function is called, which would result in a discord.NotFound exception. You should use a try/except block here.
  • L47 - See comment above.
  • L53 - See comment above.
  • L73 - See comment above.
  • L56-L59 - bot.wait_for will raise asyncio.TimeoutError is a response is not given within the given or default timeout. You should wrap this operation in a try/except block, and cancel or assume the part if asyncio.TimeoutError is raised.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

scanner

scanner.py

  • L12 - This cog class is missing a required doc-string for the help menu.
  • L15-L16 - In case you were unaware, these cached variables will reset every time the cog is unloaded or the bot is shutdown. This may be an inconvenience for users, you could instead use the Config framework.
  • L18 - Redundant (optional)
  • L36 - This command string seems to be tailored for a specific bot. Cogs for Red must work in all cases.
  • L40 - This is unrecommended and poorly handled for various reasons:
    • The command altcheck does not belong to this cog. If you wish to interact with external cogs, you should add the external cog to the required_cogs key inside your info.json file.
    • Using bot.get_context with invoke seems illogical. Instead, you could define a separate function that generates the results you want, so you can pass it to target_channel.send without the need for external functionality and the need to get context from the member object.
  • L44 - You should use the logging module to log errors to the console.
  • L47 - Why not use a boolean annotation for the status argument?
    @commands.command(name="autoscan")
    async def toggle_check(self, ctx, status: bool):
        """Toggle autoscan."""
        self.auto_check = status
        await ctx.send(f"Auto-Scan {'enabled' if status else 'disabled'}.")
    
  • L61-L62 - This should probably reset the channel to None instead of calling the channel invalid.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

serverassistant

info.json

  • L11 - The repository for this dependency is invalid and returns 404.

serverassistant.py

  • L57 - You need to check whether the bot, and the author, has sufficient permissions to create roles. You should limit this command to moderators or those who have permissions to create roles by using the permission decorators from redbot.core.commands. You should check permissions (location.permissions_for) for the bot so that they can create the role.
  • L90 - You need to check whether the bot, and the author, has sufficient permissions to remove roles. You should limit this command to moderators or those who have permissions to create roles by using the permission decorators from redbot.core.commands. You should check permissions (location.permissions_for) for the bot so that they can create the role.
  • L143-L148 - You should use pagify and box utilities from redbot.core.utils.chat_formatting here.

suggestme

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

suggestme.py

  • L14 - This cog class is missing a required doc-string for the help menu.
  • L16-L17 - In case you were unaware, these cached variables will reset every time the cog is unloaded or the bot is shutdown. This may be an inconvenience for users, you could instead use the Config framework.
  • L25 - You should indicate to cog users that this channel is obligatory for suggestions.
  • L30 - I understand this cog appears to be in conjunction with verifyall, a separate cog on your repository. However, as a public cog, it may be better if this cog facilitated a command to figure the role they’d like, and then store the role ID in the guild’s Config.
  • L85 - You need to check whether the bot has sufficient permissions to send messages here.
  • L86 - You need to check whether the bot has sufficient permissions to delete messages here.
  • L96 - You need to check whether the bot has sufficient permissions to send messages here.
  • L97 - You need to check whether the bot has sufficient permissions to delete messages here.
  • L101 - You need to check whether the bot has sufficient permissions to delete messages here.

teachme

This cog uses requests, which is blocking. This means that other processes cannot run concurrently until the requests operation is finished. Instead, you should use aiohttp. Initialise aiohttp.ClientSession() in your cog’s __init__, and use asynchronous context managers to retrieve information. Don’t forget to close the session in your cog’s cog_unload method. There are plenty of examples of aiohttp usage within the community if you need some assistance.

info.json

  • L6 - The name is the TitleCase name of your cog, not lower case.

teachme.py

  • L14 - This cog class is missing a required doc-string for the help menu.

thankyou

info.json

The data in this file appears to reflect information about 2 different cogs, but not the ThankYou cog.

thankyou.py

  • L12 - This cog class is missing a required doc-string for the help menu.
  • L17 - This command is missing a required doc-string for the help menu.
  • L34-L37 - This is redundant as the global exception handler already accounts for this when commands.UserFeedbackCheckFailure and its subclasses are raised.

verifyall

info.json

  • L6 - The name is VerifyAll, not teachme.

verifyall.py

  • L13 - This cog class is missing a required doc-string for the help menu.
  • L17 - This command needs appropriate command permission decorators so that only users who have permissions to create roles may allow the bot to do it.
  • L25 - You need to check whether the bot has sufficient permissions to add roles here.
  • L33 - You need to check whether the bot has sufficient permissions to add roles here.