diff --git a/jarvis/cogs/rolegiver.py b/jarvis/cogs/rolegiver.py index 4047ac0..08daa8d 100644 --- a/jarvis/cogs/rolegiver.py +++ b/jarvis/cogs/rolegiver.py @@ -230,42 +230,58 @@ 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) - await ctx.author.add_roles(role, reason="Rolegiver") + try: - roles = ctx.author.roles - if roles: - roles.sort(key=lambda x: -x.position) - _ = roles.pop(-1) + context = await wait_for_component( + self.bot, + check=lambda x: ctx.author.id == x.author.id, + message=message, + timeout=60 * 5, + ) - value = "\n".join([r.mention for r in roles]) if roles else "None" - fields = [ - Field(name="Added Role", value=f"{role.mention}"), - Field(name="Prior Role(s)", value=value), - ] + role = ctx.guild.get_role(context.selected_options[0]) - embed = build_embed( - title="User Given Role", - description=f"{role.mention} given to {ctx.author.mention}", - fields=fields, - ) + await ctx.author.add_roles(role, reason="Rolegiver") - embed.set_thumbnail(url=ctx.guild.icon_url) - embed.set_author( - name=ctx.author.nick if ctx.author.nick else ctx.author.name, - icon_url=ctx.author.avatar_url, - ) + roles = ctx.author.roles + if roles: + roles.sort(key=lambda x: -x.position) + _ = roles.pop(-1) - embed.set_footer(text=f"{ctx.author.name}#{ctx.author.discriminator} | {ctx.author.id}") + value = "\n".join([r.mention for r in roles]) if roles else "None" + fields = [ + Field(name="Added Role", value=f"{role.mention}"), + Field(name="Prior Role(s)", value=value), + ] - await ctx.send(embed=embed) + embed = build_embed( + title="User Given Role", + description=f"{role.mention} given to {ctx.author.mention}", + fields=fields, + ) + + embed.set_thumbnail(url=ctx.guild.icon_url) + embed.set_author( + name=ctx.author.nick if ctx.author.nick else ctx.author.name, + icon_url=ctx.author.avatar_url, + ) + + 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",