Fix starboard
This commit is contained in:
parent
2595b87061
commit
1cf4108a44
1 changed files with 10 additions and 9 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue