Skip to content

Commit 2f0c585

Browse files
lorenzo132sebkuip
authored andcommitted
change reflection upon review
1 parent 3ea1b5e commit 2f0c585

1 file changed

Lines changed: 67 additions & 16 deletions

File tree

cogs/utility.py

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,25 +1467,38 @@ async def permissions_override(self, ctx, command_name: str.lower, *, level_name
14671467
return await ctx.send(embed=embed)
14681468

14691469
async def _bulk_override_flow(self, ctx):
1470-
await ctx.send(
1471-
"Please list the commands you want to override. "
1472-
"You can list multiple commands separated by spaces or newlines.\n"
1473-
"Example: `ban, kick, mod`."
1470+
embed = discord.Embed(
1471+
title="Bulk Override",
1472+
description=(
1473+
"Please list the commands you want to override. "
1474+
"You can list multiple commands separated by spaces or newlines.\n"
1475+
"Example: `reply, block, unblock`."
1476+
),
1477+
color=self.bot.main_color,
14741478
)
1479+
await ctx.send(embed=embed)
14751480

14761481
try:
14771482
msg = await self.bot.wait_for(
14781483
"message",
14791484
check=lambda m: m.author == ctx.author and m.channel == ctx.channel,
14801485
timeout=120.0,
14811486
)
1487+
14821488
except asyncio.TimeoutError:
1483-
return await ctx.send("Timed out.")
1489+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
14841490

14851491
raw_commands = msg.content.replace(",", " ").replace("\n", " ").split(" ")
14861492
# Filter empty strings from split
14871493
raw_commands = [c for c in raw_commands if c.strip()]
14881494

1495+
if self.bot.prefix:
1496+
# Strip prefix from commands if present
1497+
raw_commands = [
1498+
c[len(self.bot.prefix) :] if c.startswith(self.bot.prefix) else c
1499+
for c in raw_commands
1500+
]
1501+
14891502
found_commands = []
14901503
invalid_commands = []
14911504

@@ -1511,12 +1524,22 @@ async def _bulk_override_flow(self, ctx):
15111524
timeout=60.0,
15121525
)
15131526
if msg.content.lower() not in ("y", "yes"):
1514-
return await ctx.send("Aborted.")
1527+
return await ctx.send(
1528+
embed=discord.Embed(
1529+
title="Operation Aborted",
1530+
description="No changes have been applied.",
1531+
color=self.bot.error_color,
1532+
)
1533+
)
15151534
except asyncio.TimeoutError:
1516-
return await ctx.send("Timed out.")
1535+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
15171536

15181537
if not found_commands:
1519-
return await ctx.send("No valid commands provided. Aborting.")
1538+
return await ctx.send(
1539+
embed=discord.Embed(
1540+
title="Error", description="No valid commands provided. Aborting.", color=self.bot.error_color
1541+
)
1542+
)
15201543

15211544
# Expand subcommands
15221545
final_commands = set()
@@ -1530,24 +1553,36 @@ def add_command_recursive(cmd):
15301553
for cmd in found_commands:
15311554
add_command_recursive(cmd)
15321555

1533-
await ctx.send(
1534-
f"Found {len(final_commands)} commands (including subcommands).\n"
1535-
"What permission level should these commands be set to? (e.g. `Owner`, `Admin`, `Moderator`, `Supporter`, `User`)"
1556+
embed = discord.Embed(
1557+
title="Select Permission Level",
1558+
description=(
1559+
f"Found {len(final_commands)} commands (including subcommands).\n"
1560+
"What permission level should these commands be set to? (e.g. `Owner`, `Admin`, `Moderator`, `Supporter`, `User`)"
1561+
),
1562+
color=self.bot.main_color,
15361563
)
1564+
await ctx.send(embed=embed)
15371565

15381566
try:
15391567
msg = await self.bot.wait_for(
15401568
"message",
15411569
check=lambda m: m.author == ctx.author and m.channel == ctx.channel,
15421570
timeout=60.0,
15431571
)
1572+
15441573
except asyncio.TimeoutError:
1545-
return await ctx.send("Timed out.")
1574+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
15461575

15471576
level_name = msg.content
15481577
level = self._parse_level(level_name)
15491578
if level == PermissionLevel.INVALID:
1550-
return await ctx.send(f"Invalid permission level: `{level_name}`. Aborting.")
1579+
return await ctx.send(
1580+
embed=discord.Embed(
1581+
title="Error",
1582+
description=f"Invalid permission level: `{level_name}`. Aborting.",
1583+
color=self.bot.error_color,
1584+
)
1585+
)
15511586

15521587
# Confirmation
15531588
command_list_str = ", ".join(
@@ -1575,10 +1610,20 @@ def add_command_recursive(cmd):
15751610
timeout=30.0,
15761611
)
15771612
except asyncio.TimeoutError:
1578-
return await ctx.send("Timed out. No changes applied.")
1613+
return await ctx.send(
1614+
embed=discord.Embed(
1615+
title="Error", description="Timed out. No changes applied.", color=self.bot.error_color
1616+
)
1617+
)
15791618

15801619
if msg.content.lower() == "cancel":
1581-
return await ctx.send("Aborted.")
1620+
return await ctx.send(
1621+
embed=discord.Embed(
1622+
title="Operation Aborted",
1623+
description="No changes have been applied.",
1624+
color=self.bot.error_color,
1625+
)
1626+
)
15821627

15831628
# Apply changes
15841629
count = 0
@@ -1588,7 +1633,13 @@ def add_command_recursive(cmd):
15881633

15891634
await self.bot.config.update()
15901635

1591-
await ctx.send(f"Successfully updated permissions for {count} commands.")
1636+
await ctx.send(
1637+
embed=discord.Embed(
1638+
title="Success",
1639+
description=f"Successfully updated permissions for {count} commands.",
1640+
color=self.bot.main_color,
1641+
)
1642+
)
15921643

15931644
@permissions.command(name="add", usage="[command/level] [name] [user/role]")
15941645
@checks.has_permissions(PermissionLevel.OWNER)

0 commit comments

Comments
 (0)