Glas-cogs

Discord Name: Glas

GitHub Repository (Must be V3): GitHub - DJTOMATO/glas-cogs: dumb cogs for Red-DiscordBot

Description: A bunch of silly cogs that nobody would use, mostly memes and one than other useful cog, also some forks with updates and new content!

Been using Red for some years and want to give it back to the community somehow, thanks to everyone’s patience teaching me, I have been able to “create” these.

1 Like

Apologies for the long delay, I have assigned myself to this and looking to complete the review over the comings weeks.

1 Like

Hi, just wondering if there’s any progress with my cog creator application, if you have a draft at least it will be awesome so I can start fixing potential issues within my cogs :heart:

Thank you for your patience. Since you have been waiting for quite some time, and since I am seeing some of the same patterns of issues across your repo, I am providing a checkpoint review after going through about half of your cogs. Please make the required changes to the reviewed cogs, and review the remaining cogs for similar issues. This will hopefully allow an expedited review of the remaining cogs. You may also want to review the approved CC requirements while you apply your changes.

Please let me know when you have applied the requested changes. I may or may not have time to continue reviewing the remaining cogs prior to that point, but I will need to know when to re-review the cogs from this review either way.

Commit hash: d1efede5d9b345de69866eede602a232afbe0653
Red v3.5.20
Consider only bullets prefixed with :memo: to be required.

The following cogs have not yet been reviewed: Anime, Deals, HoloWiki, MakeSweet, Ogey, PFPImgen, Quoter, Rizz, Sekai, Umineko, Watamelon, WeeedCog, YGOCard

General

  • The repo takes an exceptionally long time to be added, likely due to the amount of bundled data it contains.
  • Your cogs frequently contain unused code. A large number of your cogs perform similar underlying logic, so it appears like left over logic when cloning a cog for a new idea.
  • When creating a docstring for your cog or command, everything before the first empty line is the short description, which appears in the command lists, and everything after the first empty line is part of the full description, which only appears in the [p]help commandname output as non-bold text. See the output of [p]help ban for a good example. Formatting your docstrings with this in mind makes them more readable.

Bubble

  • The cog class name is not intuitive. I would suggest renaming the class to Bubble.
  • :memo: The cog uses the lib pillow, but does not include it in the requirements.
  • The file functions.py is never used.
  • :memo: The cog is missing a docstring, so no help text is provided.
  • The command docstring is split across multiple strings, which results in only the first string actually being applied. It should be formatted as:
    """Make a Speech bubble...
    
    Example: !bubble @User/username
    Use it without mention to grab last image/attachment in a channel."""
    
    • It should probably state that an image can also be attached to the command message or a link.
  • The third check in get_last_image_attachment is a subset of the first check, and should never produce a valid answer.

Doro

  • The cog and command sharing the same casing results in it being impossible to run [p]help on the command. Consider renaming the cog class to Doro.
  • :memo: The cog uses the lib pillow, but does not include it in the requirements.
  • The cog docstring is not meaningful.
  • :memo: This cog does not check if the bot has attach_files permissions prior to attempting to send the image, which will lead to an error.

Fire

  • :memo: yt-dlp==2025.1.15 only supports python 3.9+. A confusing error will be presented if users attempt to install this cog using 3.8. You use the min_python_version info.json key to match this restriction.
    • The cog doesn’t even use this lib, so I don’t know why it is in the requirements…
  • The cog class name is not intuitive. I would suggest renaming the class to Fire.
  • :memo: The cog is missing a docstring, so no help text is provided.
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.

GoogleIt

  • The cog class name is not intuitive. I would suggest renaming the class to either GoogleIt or Googleit.
  • :memo: The cog and some commands are missing docstrings, so no help text is provided.
  • The commands for configuring the endpoint do not have syntax that implies they are from your cog
  • :memo: The commands for configuring the endpoint do so only in memory, which does not persist between loads.
  • The option to use [p]googleit endpoint to see/configure the endpoint is not documented.
  • :memo: [p]googleit endpoint does not have is_owner checks, and can be ran by any user.
  • I have no idea why the command signature has option, value, and args, then just pulls from clean_content.
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.

HowLongToBeat

  • :memo: The latest version of howlongtobeatpy depends on fake-useragent>=2.0.3, which only supports python 3.9+. A confusing error will be presented if users attempt to install this cog using 3.8. You use the min_python_version info.json key to match this restriction.
  • :memo: The cog uses the lib fuzzywuzzy, but does not include it in the requirements.
  • The cog class name and only command name are not intuitive, which makes it hard to figure out how to use this cog. I would suggest renaming the class to HowLongToBeat.
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.
  • Rather than having to strip and join, consider using the signature ctx: commands.Context, *, game_name: str to capture spaces in game_name.
  • Your fuzzywuzzy comparison is currently case sensitive. Consider either .casefolding the strings before passing them, or using the processor kwarg of ratio.

LetterDance

  • :memo: You should include ntoskrn in the authors key of the cog info.json.
  • The cog class name is not intuitive. I would suggest renaming the class to either LetterDance or Letterdance.
  • :memo: This cog does not check if the bot has attach_files permissions prior to attempting to send the gif, which will lead to an error.
  • Consider resetting the cooldown when an invalid input is passed using reset_cooldown.
  • I’m not sure why imageio is used instead of Pillow’s image logic, but it seems to never close the file for the letter gifs when it reads from them.

MovieTar

  • :memo: The latest version of moviepy depends on numpy>=1.25.0, which only supports python 3.9+. A confusing error will be presented if users attempt to install this cog using 3.8. You use the min_python_version info.json key to match this restriction.
  • :memo: At some point (v2.0.0?), all was removed as a valid import from moviepy.video.fx. I can’t find when, but the lack of a fixed version in your requirements means this cog will not work for new users.
    • Attempting to downgrade to v1.0.3 manually, I still can’t get the cog to actually function, with error AttributeError: 'ImageClip' object has no attribute 'with_duration'
  • You create both a cog-scoped and file-scopped logger, then use neither of them.
  • @app_commands.guild_only() on a hybrid command does not apply to the text version of that command. Use the version from the commands package instead.
    • The makevideo command does not have a docstring for its text command version.
    • If you want a slash only command, but do not want to break your logic due to the interaction, consider using Context.from_interaction.

PokeFuse

  • The cog class name is not intuitive. I would suggest renaming the class to either PokeFuse or Pokefuse.
  • :memo: Your data files should be located in the subfolder /data and accessed via the bundled_data_path method.
  • :memo: The names and ids lists grow in size every time the command is used, which is a (very minor) memory leak.
    • Either load them once on cog load and store them in memory then, or just read the file each time the command is used without trying to persistently store.
  • Your __init__ method in pokefusion.py isn’t in the class, so it is never called.
    • If it were called, it would not work, as datacheck is not awaited.
  • There is no reason for any of the functions in functions.py to be async, as they never do any asynchronous work.
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.

RedBus

  • The cog class name and only command name are not intuitive, which makes it hard to figure out how to use this cog. I would suggest renaming the class to either RedBus or Redbus.
  • :memo: The install_msg contains a hardcoded ! prefix.
  • :memo: The cog and command are missing docstrings, so no help text is provided.
    • It is completely unclear from the lack of help text and the error message what a “valid bus stop ID” would be, or what the number maps to.
  • :memo: The API seems to respond to all of the possible input stop IDs with 400 “Malformed Stop ID parameter”.
    • I can’t find the API docs to debug what it should be.
  • :memo: The default locale for cogs must be English, with alternate languages provided using the i18n framework.
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.

Shibe
N/A

Ship

  • :memo: The cog is missing a docstring, so no help text is provided.
  • The cog should use the i18n framework to provide translations, rather than lots of if statements.
  • The file functions.py is never used.
  • The hardcoded custom emoji will not be available to most bots.

Valentine

  • :memo: The cog is missing a docstring, so no help text is provided.
  • The cog should use the i18n framework to provide translations, rather than lots of if statements.

VWiki

  • :memo: The cog contains unidecode in the requirements, but does not use this library.
  • :memo: The cog uses the lib vtuberwiki-py, but does not include it in the requirements.
  • :memo: The command is missing a docstring, so no help text is provided.
  • :memo: I can’t get the command to do anything other than error, potentially due to a library bug:
    Traceback (most recent call last):
      File "datapath\cogs\CogManager\cogs\vwiki\vwiki.py", line 33, in vsearch
        sm, tr, qt, nm, img = await self.search(chuuba)
      File "datapath\cogs\CogManager\cogs\vwiki\vwiki.py", line 22, in search
        sm = await vwiki.summary(vtuber=f"{chuuba}")
      File "datapath\cogs\Downloader\lib\vtuberwiki\aiovwiki.py", line 118, in summary
        img = body.find("img",class_="pi-image-thumbnail")
    AttributeError: 'NoneType' object has no attribute 'find'
    
  • :memo: This cog does not check if the bot has embed_links permissions prior to attempting to send an embed, which will lead to an error.

YouWouldnt

  • :memo: The cog contains unidecode in the requirements, but does not use this library.
1 Like

Thanks @Flame442 for taking the time to check my cogs!
Certainly there were some common mistakes between them, and things that made no sense for sure lol. They’re gone now!

Aas requested I’ve have updated my repo with the fixes for all the cogs mentioned.
I’ve also offloaded some data in MakeSweet (Info on install + repo readme) so that saves around 70mb, also to save further more space I’ve some tweaked old pngs as well.

I am completely aware this is a giant task, so whoever continues my revision I’ll be super grateful for. No pressures at all!

Looking forward to hear more from you.
Thanks again!

The review below includes both a first time review of the previously unreviewed cogs, and a re-review of the previously reviewed cogs. Please comment when all required changes have been addressed for all cogs. If you need any additional assistance or clarification, feel free to let me know.


Commit hash: 2ff48f15c053cdff76c423b1003ea2c6dca337e1
Red v3.5.20
Consider only bullets prefixed with :memo: to be required.


First Review

General

  • Consider using the cooldown_after_parsing flag to avoid imposing a cooldown on users when they mess up the arguments and fail to actually invoke the command.

Anime

  • You should probably include your name at the end of the authors key, unless you have done absolutely no work on this cog
  • :memo: Various commands do not check if the bot has embed_links permissions prior to sending an embed.
  • :memo: Various commands do not check if the bot has add_reactions permissions prior to adding reactions.
    • Consider replacing reaction menus with button menus to avoid rate limits and the need to check for this permission.
  • The [p]crunchynews endpoint seems to no longer be valid, and returns a 404.
  • The commands [p]next, [p]last, and [p]random have very generic names that are likely to overlap with other cogs.
  • I can’t get the [p]random command to find a valid anime in any genre I try. This either means the endpoint changed and it is suppressing an error, or the command does not explain what the input needs to be well enough.
  • [p]theme and [p]themes have some kind of SSL certificate error happening trying to access the endpoint for me.

Deals

  • :memo: The cog is missing a docstring, so no help text is provided.
  • When an error occurs (such as a missing API key), it is sent both in an embed and as text.
  • Some API only appears to respond with a 400 bad request, and that is the only output that I get.
  • :memo: Various commands do not check if the bot has embed_links permissions prior to sending an embed.
  • :memo: The [p]risks command errors if the bot does not have add_reactions permissions.
    • :memo: The [p]risks command also errors if the bot is unable to react to the user because they are blocked. Consider using ctx.tick, which should handle this case.
  • Rather than sleeping and deleting manually, consider using the delete_after kwarg in send.
  • :memo: This cog uses pillow, but does not include it in the requirements.
  • The entire WebScraper class appears to be unused, but has several problems if it were to be used:
    • The cog_unload method in the WebScraper class is never called, so your session is never cleaned up.
    • There are self.session.close() calls after 200 success cases without considering future calls expecting that same class level session to be valid. If a WebScraper object were to be reused, that would cause issues.
    • There is a place where you create a new session with the context manager async with aiohttp.ClientSession() as session:, then call session.close() within the body of the context manager. The point of the context manager is that it handles opening/closing the session for you, so manually closing will cause it confusion.
      • There is a comment on this method that it causes a deadlock, this may be why.
    • This class is about 1000 lines of currently unused code. If the cog is broken without this working, the cog should be hidden. If this code is no longer needed since an API key is used instead of webscraping, you should delete the code and trust git history to preserve it if it is needed in the future.

HoloWiki

  • :memo: This cog uses beautifulsoup4, but does not include it in the requirements.
  • The cog docstring is split across multiple strings, which results in only the first string actually being applied.
  • :memo: The [p]hollowlist command is missing a docstring.
  • :memo: Various commands do not check if the bot has embed_links permissions prior to sending an embed.
  • :memo: For any valid name, [p]holo appears to produce the following error:
      Traceback (most recent call last):
        File "datapath\cogs\CogManager\cogs\holowiki\holowiki.py", line 312, in holo
          await self.parse(ctx, entry, url, iurl)
        File "datapath\cogs\CogManager\cogs\holowiki\holowiki.py", line 54, in parse
          official_bio_greet_text = official_bio_greet.text.strip()
      AttributeError: 'NoneType' object has no attribute 'text'
    
  • You should only show the “Fanart (NSFW)” section if the command is invoked from an NSFW channel. I think that is the case currently, but I cannot confirm with the command not working.
  • There is a hardcoded ! prefix in the “too many options” failure case of [p]holo.
  • There is a hardcoded ! prefix in the footer of [p]hololist.
  • Consider using the already loaded data from self.chuubas in [p]hololist.

MakeSweet

  • :memo: This cog uses pillow and rapidfuzz, but does not include them in the requirements.
  • :memo: Various commands do not check if the bot has attach_files permissions prior to sending a file.
  • Rather than using self.__class__.__name__ for cog_data_path in cleanup_cog_data, you should be able to just pass self as you do elsewhere in the cog.

Ogey

  • :memo: Various commands do not check if the bot has embed_links permissions prior to sending an embed.
  • You create a session that is never used.
  • You may want to add yourself to the __author__ attribute of the cog.

PFPImgen

  • :memo: numpy is imported but never used. It also is not included in the requirements for the cogs, if it were to be used.
  • This cog has a staggering number of top level commands. Consider putting all of them under a group command.
  • Some of the commands are a little risque, you may want to lock them behind NSFW channels.

Quoter

  • :memo: This cog uses pillow, but does not include it in the requirements.
    • An unimported file also uses rapidfuzz, unidecode, and regex.
  • Consider naming the cog class Quoter instead to avoid confusion.
  • :memo: Your cog and command are both missing a docstring.
  • The error messages are unprofessional
    • They also include emojis other bots will not have
    • They also include hardcoded prefixes
  • :memo: This cog seems to have some kind of memory or other resource leak that slows the bot to a crawl after repeated use.
    • I don’t think the fonts are being closed after opening, and they are looped over opening many times for the same call.
    • I don’t know if it’s possible to close the fonts, I just know that I can’t uninstall the cog after using the command because the fonts are still “open” on Windows.

Rizz

  • N/A

Sekai

  • :memo: This cog uses regex (not the stdlib re), but does not include it in the requirements.
    • An unimported file uses rapidfuzz and unidecode. They also are not included in the requirements for the cogs, if they were to be used.
  • :memo: [p]characters does not check if the bot has embed_links permissions prior to sending an embed.
  • Consider replacing the [p] with the contextual ctx.prefix in the footer of the [p]characters embed.
  • :memo: The way you are currently passing the message to your view object will always cause unexpected behavior and console errors. It is impossible to pass the message into the view when the view is instantiated, since the view has to be instantiated prior to sending the message. The traditional way to do what you are trying to do looks something like:
    view = MyView(...)
    my_message = await ctx.send(view=view)
    view.message = my_message
    
    • Your error handling in the select callback currently errors because the error happens after the interaction.response.edit_message, during the self.message.edit call. As a result, when your exception handling tries to call interaction.response.edit_message, it does so on an already responded to interaction and errors. You could fix this by checking if interaction.response.is_done() is set if you want a more robust error handler.
    • The discord.errors.InteractionResponded catch will never run, since that error is a subclass of Exception, which is listed earlier.
  • :memo: The font seems to remain open after unloading the cog.

Umineko

  • :memo: This cog uses regex (not the stdlib re), but does not include it in the requirements.
    • The only place where regex logic is actually used uses the stdlib re, since re is imported after regex in that file.
    • rapidfuzz and unidecode are imported but never used, and not listed in requirements.
  • :memo: The install_msg should explain how to get the not-quite bundled data.
    • I would be careful using the bundled_data_path in any way other than by including the files on git, since it may get overridden when the cog updates.
  • :memo: This cog is slash only, which breaks typical user expectation. This should be mentioned in the install_msg.
  • This cog has a lot of overly verbose logging. It should probably be logging at a debug level.

Watamelon

  • :memo: Various commands do not check if the bot has embed_links permissions prior to sending an embed.
  • You create a session that is never used.
  • You may want to add yourself to the __author__ attribute of the cog.

WeeedCog

  • :memo: The install_msg should explain how to get the not-quite bundled data.
    • I would be careful using the bundled_data_path in any way other than by including the files on git, since it may get overridden when the cog updates.
  • The group command docstring appears unfinished
  • This cog has a lot of overly verbose logging/print statements. It should probably be logging at a debug level.
  • One of the edge case messages has a hard coded max of 10, instead of the actually configured max.
  • :memo: Various commands do not check if the bot has attach_files permissions prior to sending a file.

YGOCard

  • The prefix in the install_msg is hardcoded to !.
  • :memo: This cog uses pillow and regex (not the stdlib re), but does not include them in the requirements.
    • An unimported file uses rapidfuzz and unidecode. They also are not included in the requirements for the cogs, if they were to be used.
  • Your command docstring is split over multiple strings, so the example does not appear in the help text.

Re-Review

The following cogs have no further comments: HowLongToBeat, LetterDance, PokeFuse, Shibe, YouWouldnt

General

  • Consider using @commands.bot_has_permission instead of ctx.channel.permissions_for(ctx.me).XXXX to implement the permissions checks requested by the previous review. This generally results in a better UX, as it ties in to other systems such as hiding the command from [p]help and providing standardized error messages with translation support.

Bubble

  • The short info.json key was removed in the latest commits. This value is used in various places, including the [p]cog list output for your repo.
  • :memo: The cog is missing a docstring, so no help text is provided.
  • :memo: The prefix in the command docstring is hardcoded. Instead of !, [p] should be used so that Red can automatically enter the contextually correct prefix in the help text.
    • It seems like some of the logic for detecting the image is also searching for a message with !bubble, including the hardcoded prefix.
  • The docstring phrasing “Use it alone mention” should probably be “Use it without a mention”, or similar.
  • An unimported file is still in the cog folder, if it were to be used it uses rapidfuzz, unidecode, and regex.

Doro

  • The cog docstring is not meaningful.

Fire

  • :memo: The cog is missing a docstring, so no help text is provided.

GoogleIt

  • :memo: The endpoint is stored in config before confirming it is valid.

MovieTar

  • :memo: The cog still appears to be broken even on 3.11 with the updated requirements due to a mismatch between the code and the library version:
      File "datapath\cogs\CogManager\cogs\movietar\movietar.py", line 426, in akira
        image = self.gen_vid_akira(
      File "datapath\cogs\CogManager\cogs\movietar\movietar.py", line 750, in gen_vid_akira
        .with_start(2.83)
    AttributeError: 'ImageClip' object has no attribute 'with_start'
    
  • Responding to the text version of the [p]makevideo with just “Please use the slash command.” does not explain to the user how to do that.
    • There probably should not be a text version of the cog, if it isn’t intended to be used as a text command.
    • If you want a slash only command, but do not want to break your logic due to the interaction, consider using Context.from_interaction.

RedBus

  • :memo: The cog and command are missing docstrings, so no help text is provided.

Ship

  • :memo: The cog is missing a docstring, so no help text is provided.
  • I don’t believe your translations for the rate messages will work properly. The string being translated is the full english string, but the msgif in the .po files is ship_rate_##.

Valentine

  • :memo: The cog is missing a docstring, so no help text is provided.
  • An unimported file is still in the cog folder, if it were to be used it uses regex.
    • :memo: The requirements include rapidfuzz, unidecode, despite them not being used outside of this unused file

VWiki

  • :memo: The cog bundles the lib vtuberwiki-py, but still includes it in the requirements.
    • Bundling it should require following the license, but the project is unlicensed. Technically that means you have not been given permission to bundle it, but I doubt that was the intention of the author.
      • On PyPi, it is listed as being licenced under MIT, but there is no evidence of that in the lib repo.
    • Note that if you remove the requirement, you will need to explicitly include the dependencies of the bundled lib in your requirements key for them to be installed.
  • Consider using ctx.typing due to the long load time of this command.
  • There is a warning log of the raw API data, which is quite spammy. This should probably be a debug message.