Cray-cogs

Discord Name: crayyy_zee#2900

GitHub Repository (Must be V3): GitHub - i-am-zaidali/cray-cogs

Description: These are just a bunch of utility cogs that could be useful to some people.
These include:

  1. giveaways: To host embedded giveaways in your server with alot of flexibility

  2. notes: To keep moderator notes on users.

  3. votetracker: To track votes recieved for your bot on top.gg and give them a temprole for 12 hours accordingly.

  4. donationlogging: To track user made donations of discord bot currencies and give them roles accordingly.

  5. hitormiss: a fun economy cog that allows users to throw imaginary items at others.

Added tickchanger, a monkeypatching cog that changes the default emoji that await ctx.tick() reacts with.

Added joinping which simply ghost pings recently joined members in multiple channels of thed user’s choice to alert them about the existence/purpose of that channel (for example a react role channel to get react role etc)

With the release of 3.5, we are returning to reviewing Cog Creator applications.

Since 3.5 will break every cog that was not specifically coded with it in mind, you need to ensure your repo is updated to be compatible with 3.5 prior to a review being possible. The relevant documentation you will need to update your repo is the following:
-discord.py 2.0 migration: https://discordpy.readthedocs.io/en/v2.2.3/migrating.html
-Red 3.5 breakages: https://docs.discord.red/en/stable/incompatible_changes/3.5.html#incompatible-changes-3-5

Once your repo is updated to support 3.5 on the default branch, please make a comment in this thread to confirm you are once again ready for review. We will only be reviewing repos which comment to confirm 3.5 support, but we will prioritize repos that have been in the queue for a longer period of time first.

If you wish to revoke your application, please comment accordingly so we can clean up the thread. If you need time to make changes, but are actively working on making updates, please also comment accordingly. Applications which do not see any activity within 1 month from today will be closed.

Hey. Thanks for the update. My cogs are ready for review now!

Commit at time of review: 9aefcb55c7bd47993d311ccd400abca8686b6460

General Notes:

  • May want to update author field in cogs due to Pomelo.
  • Some places make reference to the User/Member object which includes #0 discriminator if they have opted-in to Pomelo (Take a look at dpy2.3 changes, most of these will fix with that. Just a heads-up).

hitormiss:

  • You might want to replace fuzzywuzzy, as it is no longer maintained. I would suggest rapidfuzz.
    • fuzzywuzzy is not listed in requirements for this cog, but is imported.
  • hitormiss createitem create errors on all usages:
[21:00:22] ERROR    [red] Exception in command 'hitormiss createitem'
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\ext\commands\core.py:229 in wrapped    │
│ ❱  229             ret = await coro(*args, **kwargs)                                                                 │
│ Red-DiscordBot\data\flare\cogs\CogManager\cogs\hitormiss\main.py:456 in  │
│ hom_create                                                                                                           │
│ ❱ 456         if functools.reduce(lambda x: x.lower() == name.lower(), self.items.keys()):                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: <lambda>() takes 1 positional argument but 2 were given
  • throw has two default None args. The command just shows help with no helpful message indicating usage. Passing just one will also just show help.
  • hitormiss shop fails with the following error:
[21:04:51] ERROR    [red] Exception in command 'hitormiss shop'
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\ext\commands\core.py:229 in wrapped    │
│ ❱  229             ret = await coro(*args, **kwargs)                                                                 │
│ Red-DiscordBot\data\flare\cogs\CogManager\cogs\hitormiss\main.py:312 in  │
│ hom_shop                                                                                                             │
│ ❱ 312         await view.start()                                                                                     │
│ Red-DiscordBot\data\flare\cogs\CogManager\cogs\hitormiss\views.py:180 in │
│ start                                                                                                                │
│ ❱ 180         self.message = await self.ctx.send(content=content, embed=embed, view=self)                            │
│ datapath\Red-DiscordBot\redbot\core\commands\context.py:91 in send                             │
│ ❱  91         return await super().send(content=content, **kwargs)                                                   │
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\ext\commands\context.py:848 in send    │
│ ❱ 848             return await super().send(                                                                         │
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\abc.py:1561 in send                    │
│ ❱ 1561             data = await state.http.send_message(channel.id, params=params)                                   │
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\http.py:744 in request                 │
│ ❱  744                             raise HTTPException(response, data)                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.thumbnail: Only dictionaries may be used in a ModelType
  • With embed_links off, hom create only sends a ping and nothing else. It will then correctly timeout
    DiscordCanary_RqbUKX3kRm

  • With embed_links off, the following commands error: hom stats

  • Sending of the JoinPing message will also fail if embed_links are off and an embed block is present.

  • Due to the above errors, functionality couldn’t be fully tested and will be done in a future iteration.

JoinPing:

  • With embed_links off, the following commands error: jpset show

Notes:

  • delnote & removenotes both accept no input, which may confuse users. The help indicates this, but requires them to run help first
  • notes.py:L303 uses the discord.py 1.7.x avatar method. This is not compatible with 2.x. You should use User.display_avatar.url instead.
  • allnotes:
    • Multiple get_member calls within same block.
    • Field title shows None for all users.
    • When you select a page, the close button will not work. It will throw Interaction Failed with the following traceback in the console.
[11:58:48] ERROR    [discord.ui.view] Ignoring exception in view <PaginationView timeout=60 children=5> for item <CloseButton style=<ButtonStyle.danger: 4> url=None disabled=False label='Close' emoji=<PartialEmoji animated=False name='❌' id=None> row=None>
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\ui\view.py:427 in _scheduled_task      │
│ ❱ 427             await item.callback(interaction)                                                                   │
│ Red-DiscordBot\data\flare\cogs\CogManager\cogs\notes\views.py:28 in      │
│ callback                                                                                                             │
│ ❱  28         await self.view.message.delete()                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'NoneType' object has no attribute 'delete'
  • With embed_links off, the following commands error: allnotes, notes

timer:

  • When running timerset on a custom emoji it produces the following traceback:
[12:05:25] ERROR    [red] Exception in command 'timerset emoji'
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ datapath\Red-DiscordBot\.venv\lib\site-packages\discord\ext\commands\core.py:229 in wrapped    │
│ ❱  229             ret = await coro(*args, **kwargs)                                                                 │
│ Red-DiscordBot\data\flare\cogs\CogManager\cogs\timer\timers.py:191 in    │
│ tset_emoji                                                                                                           │
│ ❱ 191         await self.config.guild_from_id(ctx.guild.id).timer_settings.emoji.set(emoji)                          │
│ datapath\Red-DiscordBot\redbot\core\config.py:265 in set                                       │
│ ❱  265         await self._driver.set(self.identifier_data, value=value)                                             │
│ datapath\Red-DiscordBot\redbot\core\_drivers\json.py:146 in set                                │
│ ❱ 146         value_copy = json.loads(json.dumps(value))                                                             │
│ Python\Python38\lib\json\__init__.py:231 in dumps                              │
│ ❱ 231         return _default_encoder.encode(obj)                                                                    │
│ Python\Python38\lib\json\encoder.py:199 in encode                              │
│ ❱ 199         chunks = self.iterencode(o, _one_shot=True)                                                            │
│ Python\Python38\lib\json\encoder.py:257 in iterencode                          │
│ ❱ 257         return _iterencode(o, 0)                                                                               │
│ Python\Python38\lib\json\encoder.py:179 in default                             │
│ ❱ 179         raise TypeError(f'Object of type {o.__class__.__name__} '                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: Object of type Emoji is not JSON serializable
  • L166 uses the discord.py 1.7.x avatar method. This is not compatible with 2.x. You should use User.display_avatar.url instead.
  • timer end returns a tick for all uses, even if a timer is not present
  • timer start will error if embed_links is off.

KeywordPoints:

  • kwp lb will error if embed_links is off.

TickChanger:

N/a

Hey. Sorry for being so late but I have made all the changes necessary to fix the errors you faced. If any other errors are raised, please let me know again. Thanks!

Thanks for getting back, after re-testing I’ve encountered the following issues that need to be addressed:

HitOrMiss

  • hom create will always show the item as already created, even if it isn’t.
  • hom buy does not use consume all, meaning in the pre-existing data just putting PaintBall Gun will show as PaintBall
  • Similar issue with throw, it will require quotes as it’s the first argument.

Notes

  • allnotes does not pagify correctly

JoinPing

  • Issue of using embed block for join message will still error if embed_links is removed.

Timer

  • custom emoji does not seem to be used anywhere.

Hey flare, really sorry for taking so long with these fixes.
As suggested, the problems in notes, JoinPing, HitOrMiss and Timer have been fixed.
Let me know if there’s anything left. Thank you very much.

Great, marking as approved!