Skip to content

Commit 75ec6b6

Browse files
committed
change reflection upon review
1 parent fef2b99 commit 75ec6b6

File tree

1 file changed

+67
-16
lines changed

1 file changed

+67
-16
lines changed

cogs/utility.py

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

14431443
async def _bulk_override_flow(self, ctx):
1444-
await ctx.send(
1445-
"Please list the commands you want to override. "
1446-
"You can list multiple commands separated by spaces or newlines.\n"
1447-
"Example: `ban, kick, mod`."
1444+
embed = discord.Embed(
1445+
title="Bulk Override",
1446+
description=(
1447+
"Please list the commands you want to override. "
1448+
"You can list multiple commands separated by spaces or newlines.\n"
1449+
"Example: `reply, block, unblock`."
1450+
),
1451+
color=self.bot.main_color,
14481452
)
1453+
await ctx.send(embed=embed)
14491454

14501455
try:
14511456
msg = await self.bot.wait_for(
14521457
"message",
14531458
check=lambda m: m.author == ctx.author and m.channel == ctx.channel,
14541459
timeout=120.0,
14551460
)
1461+
14561462
except asyncio.TimeoutError:
1457-
return await ctx.send("Timed out.")
1463+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
14581464

14591465
raw_commands = msg.content.replace(",", " ").replace("\n", " ").split(" ")
14601466
# Filter empty strings from split
14611467
raw_commands = [c for c in raw_commands if c.strip()]
14621468

1469+
if self.bot.prefix:
1470+
# Strip prefix from commands if present
1471+
raw_commands = [
1472+
c[len(self.bot.prefix) :] if c.startswith(self.bot.prefix) else c
1473+
for c in raw_commands
1474+
]
1475+
14631476
found_commands = []
14641477
invalid_commands = []
14651478

@@ -1485,12 +1498,22 @@ async def _bulk_override_flow(self, ctx):
14851498
timeout=60.0,
14861499
)
14871500
if msg.content.lower() not in ("y", "yes"):
1488-
return await ctx.send("Aborted.")
1501+
return await ctx.send(
1502+
embed=discord.Embed(
1503+
title="Operation Aborted",
1504+
description="No changes have been applied.",
1505+
color=self.bot.error_color,
1506+
)
1507+
)
14891508
except asyncio.TimeoutError:
1490-
return await ctx.send("Timed out.")
1509+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
14911510

14921511
if not found_commands:
1493-
return await ctx.send("No valid commands provided. Aborting.")
1512+
return await ctx.send(
1513+
embed=discord.Embed(
1514+
title="Error", description="No valid commands provided. Aborting.", color=self.bot.error_color
1515+
)
1516+
)
14941517

14951518
# Expand subcommands
14961519
final_commands = set()
@@ -1504,24 +1527,36 @@ def add_command_recursive(cmd):
15041527
for cmd in found_commands:
15051528
add_command_recursive(cmd)
15061529

1507-
await ctx.send(
1508-
f"Found {len(final_commands)} commands (including subcommands).\n"
1509-
"What permission level should these commands be set to? (e.g. `Owner`, `Admin`, `Moderator`, `Supporter`, `User`)"
1530+
embed = discord.Embed(
1531+
title="Select Permission Level",
1532+
description=(
1533+
f"Found {len(final_commands)} commands (including subcommands).\n"
1534+
"What permission level should these commands be set to? (e.g. `Owner`, `Admin`, `Moderator`, `Supporter`, `User`)"
1535+
),
1536+
color=self.bot.main_color,
15101537
)
1538+
await ctx.send(embed=embed)
15111539

15121540
try:
15131541
msg = await self.bot.wait_for(
15141542
"message",
15151543
check=lambda m: m.author == ctx.author and m.channel == ctx.channel,
15161544
timeout=60.0,
15171545
)
1546+
15181547
except asyncio.TimeoutError:
1519-
return await ctx.send("Timed out.")
1548+
return await ctx.send(embed=discord.Embed(title="Error", description="Timed out.", color=self.bot.error_color))
15201549

15211550
level_name = msg.content
15221551
level = self._parse_level(level_name)
15231552
if level == PermissionLevel.INVALID:
1524-
return await ctx.send(f"Invalid permission level: `{level_name}`. Aborting.")
1553+
return await ctx.send(
1554+
embed=discord.Embed(
1555+
title="Error",
1556+
description=f"Invalid permission level: `{level_name}`. Aborting.",
1557+
color=self.bot.error_color,
1558+
)
1559+
)
15251560

15261561
# Confirmation
15271562
command_list_str = ", ".join(
@@ -1549,10 +1584,20 @@ def add_command_recursive(cmd):
15491584
timeout=30.0,
15501585
)
15511586
except asyncio.TimeoutError:
1552-
return await ctx.send("Timed out. No changes applied.")
1587+
return await ctx.send(
1588+
embed=discord.Embed(
1589+
title="Error", description="Timed out. No changes applied.", color=self.bot.error_color
1590+
)
1591+
)
15531592

15541593
if msg.content.lower() == "cancel":
1555-
return await ctx.send("Aborted.")
1594+
return await ctx.send(
1595+
embed=discord.Embed(
1596+
title="Operation Aborted",
1597+
description="No changes have been applied.",
1598+
color=self.bot.error_color,
1599+
)
1600+
)
15561601

15571602
# Apply changes
15581603
count = 0
@@ -1562,7 +1607,13 @@ def add_command_recursive(cmd):
15621607

15631608
await self.bot.config.update()
15641609

1565-
await ctx.send(f"Successfully updated permissions for {count} commands.")
1610+
await ctx.send(
1611+
embed=discord.Embed(
1612+
title="Success",
1613+
description=f"Successfully updated permissions for {count} commands.",
1614+
color=self.bot.main_color,
1615+
)
1616+
)
15661617

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

0 commit comments

Comments
 (0)