Merge branch 'rolegiver_patch' into 'main'

Fix rolegiver

See merge request stark-industries/j.a.r.v.i.s.!39
This commit is contained in:
Zeva Rose 2022-02-02 21:32:05 +00:00
commit 2288ef3c10

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",