This commit is contained in:
insert 2024-08-10 16:17:33 -04:00
parent 4ad76e1439
commit a1b82d4a79
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -55,14 +55,13 @@ class rolebutton(commands.Cog):
self.bot.roleguild = interaction.guild
await interaction.response.send_message(view=RoleView(self.bot))
@rolebuttons.subcommand(
@nextcord.message_command(
name="refresh",
description="refresh a role selection message",
)
async def rolerefresh(self, interaction: nextcord.Interaction, msgid):
msgid = int(msgid)
msg = await nextcord.abc.Messageable.fetch_message(self.bot, msgid)
if msg.author.id != self.bot.application_id:
@nextcord.ext.application_checks.has_permissions(manage_roles=True)
async def rolerefresh(self, interaction: nextcord.Interaction, message: nextcord.Message):
if message.author.id != self.bot.application_id:
await interaction.response.send_message("I can't edit that message", ephemeral=True)
return
res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}")
@ -71,7 +70,7 @@ class rolebutton(commands.Cog):
button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}")
button.callback = RoleView.buttoncallback
RoleView.add_item(button)
await msg.edit(view=RoleView(self.bot))
await message.edit(view=RoleView(self.bot))
await interaction.response.send_message("Edited!", ephemeral=True)
@rolebuttons.subcommand(