Fix rolegiver

This commit is contained in:
Zeva Rose 2022-02-02 14:31:29 -07:00
parent dd3cc69394
commit 98cea4a4e6

View file

@ -230,13 +230,24 @@ class RolegiverCog(commands.Cog):
select = create_select(
options=options,
custom_id="to_delete",
placeholder="Select roles to remove",
placeholder="Select roles to add",
min_values=1,
max_values=len(options),
)
components = [create_actionrow(select)]
_ = await ctx.send(content="\u200b", components=components)
message = await ctx.send(content="\u200b", components=components)
try:
context = await wait_for_component(
self.bot,
check=lambda x: ctx.author.id == x.author.id,
message=message,
timeout=60 * 5,
)
role = ctx.guild.get_role(context.selected_options[0])
await ctx.author.add_roles(role, reason="Rolegiver")
@ -266,6 +277,11 @@ class RolegiverCog(commands.Cog):
embed.set_footer(text=f"{ctx.author.name}#{ctx.author.discriminator} | {ctx.author.id}")
await ctx.send(embed=embed)
except asyncio.TimeoutError:
for row in components:
for component in row["components"]:
component["disabled"] = True
await message.edit(components=components)
@cog_ext.cog_subcommand(
base="role",