mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Utils] Better error handling for humanize_list (#2597)
This commit is contained in:
parent
2c8a425f87
commit
012d99c05c
@ -360,7 +360,10 @@ def humanize_list(items: Sequence[str]) -> str:
|
|||||||
"""
|
"""
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
return items[0]
|
return items[0]
|
||||||
|
try:
|
||||||
return ", ".join(items[:-1]) + _(", and ") + items[-1]
|
return ", ".join(items[:-1]) + _(", and ") + items[-1]
|
||||||
|
except IndexError:
|
||||||
|
raise IndexError("Cannot humanize empty sequence") from None
|
||||||
|
|
||||||
|
|
||||||
def format_perms_list(perms: discord.Permissions) -> str:
|
def format_perms_list(perms: discord.Permissions) -> str:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user