From 1cf4108a44da29f0a1a23f8e497a2f8a67c4aeb8 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Fri, 4 Feb 2022 11:41:47 -0700 Subject: [PATCH] Fix starboard --- jarvis/cogs/starboard.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jarvis/cogs/starboard.py b/jarvis/cogs/starboard.py index af9d425..79442e6 100644 --- a/jarvis/cogs/starboard.py +++ b/jarvis/cogs/starboard.py @@ -95,13 +95,14 @@ class StarboardCog(Scale): deleted = Starboard.objects(channel=channel.id, guild=ctx.guild.id).delete() if deleted: _ = Star.objects(starboard=channel.id).delete() - await ctx.send(f"Starboard deleted from {channel.mention}.", ephemeral=True) + await ctx.send(f"Starboard deleted from {channel.mention}.") else: await ctx.send(f"Starboard not found in {channel.mention}.", ephemeral=True) @context_menu(name="Star Message", context_type=CommandTypes.MESSAGE) async def _star_message(self, ctx: InteractionContext) -> None: - await self._star_add.invoke(ctx, ctx.target_message) + await self._star_add._can_run(ctx) + await self._star_add.callback(ctx, message=str(ctx.target_id)) @slash_command(name="star", sub_cmd_name="add", description="Star a message") @slash_option( @@ -159,10 +160,10 @@ class StarboardCog(Scale): com_ctx = await self.bot.wait_for_component( messages=msg, components=components, - check=lambda x: x.author.id == ctx.author.id, + check=lambda x: ctx.author.id == x.context.author.id, ) - starboard = channel_list[int(com_ctx.selected_options[0])] + starboard = channel_list[int(com_ctx.context.values[0])] exists = Star.objects( message=message.id, @@ -220,16 +221,16 @@ class StarboardCog(Scale): active=True, ).save() - components[0]["components"][0]["disabled"] = True + components[0].components[0].disabled = True - await com_ctx.edit_origin( + await com_ctx.context.edit_origin( content=f"Message saved to Starboard.\nSee it in {starboard.mention}", components=components, ) @slash_command(name="star", sub_cmd_name="delete", description="Delete a starred message") @slash_option( - name="message", description="Star to delete", opt_type=OptionTypes.INTEGER, required=True + name="id", description="Star ID to delete", opt_type=OptionTypes.INTEGER, required=True ) @slash_option( name="starboard", @@ -265,14 +266,14 @@ class StarboardCog(Scale): await ctx.send(f"No star exists with id {id}", ephemeral=True) return - message = await starboard.fetch_message(star.star) + message = await starboard.get_message(star.star) if message: await message.delete() star.active = False star.save() - await ctx.send(f"Star {id} deleted") + await ctx.send(f"Star {id} deleted from {starboard.mention}") def setup(bot: Snake) -> None: