mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Change the hierarchy issue messages (#3016)
* Change the hierarchy issue messages, because they are difficult to translate with the verb variable. * Fix typos * Add changelog entry * Reformatting with black
This commit is contained in:
parent
25614620db
commit
101e977939
1
changelog.d/admin/3016.enhance.rst
Normal file
1
changelog.d/admin/3016.enhance.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add custom issue messages for adding and removing roles, this makes it easier to create translations.
|
||||||
@ -19,20 +19,34 @@ GENERIC_FORBIDDEN = _(
|
|||||||
" Your command failed to successfully complete."
|
" Your command failed to successfully complete."
|
||||||
)
|
)
|
||||||
|
|
||||||
HIERARCHY_ISSUE = _(
|
HIERARCHY_ISSUE_ADD = _(
|
||||||
"I tried to {verb} {role.name} to {member.display_name} but that role"
|
"I tried to add {role.name} to {member.display_name} but that role"
|
||||||
" is higher than my highest role in the Discord hierarchy so I was"
|
" is higher than my highest role in the Discord hierarchy so I was"
|
||||||
" unable to successfully add it. Please give me a higher role and "
|
" unable to successfully add it. Please give me a higher role and "
|
||||||
"try again."
|
"try again."
|
||||||
)
|
)
|
||||||
|
|
||||||
USER_HIERARCHY_ISSUE = _(
|
HIERARCHY_ISSUE_REMOVE = _(
|
||||||
"I tried to {verb} {role.name} to {member.display_name} but that role"
|
"I tried to remove {role.name} from {member.display_name} but that role"
|
||||||
|
" is higher than my highest role in the Discord hierarchy so I was"
|
||||||
|
" unable to successfully remove it. Please give me a higher role and "
|
||||||
|
"try again."
|
||||||
|
)
|
||||||
|
|
||||||
|
USER_HIERARCHY_ISSUE_ADD = _(
|
||||||
|
"I tried to add {role.name} to {member.display_name} but that role"
|
||||||
" is higher than your highest role in the Discord hierarchy so I was"
|
" is higher than your highest role in the Discord hierarchy so I was"
|
||||||
" unable to successfully add it. Please get a higher role and "
|
" unable to successfully add it. Please get a higher role and "
|
||||||
"try again."
|
"try again."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
USER_HIERARCHY_ISSUE_REMOVE = _(
|
||||||
|
"I tried to remove {role.name} from {member.display_name} but that role"
|
||||||
|
" is higher than your highest role in the Discord hierarchy so I was"
|
||||||
|
" unable to successfully remove it. Please get a higher role and "
|
||||||
|
"try again."
|
||||||
|
)
|
||||||
|
|
||||||
ROLE_USER_HIERARCHY_ISSUE = _(
|
ROLE_USER_HIERARCHY_ISSUE = _(
|
||||||
"I tried to edit {role.name} but that role"
|
"I tried to edit {role.name} but that role"
|
||||||
" is higher than your highest role in the Discord hierarchy so I was"
|
" is higher than your highest role in the Discord hierarchy so I was"
|
||||||
@ -111,9 +125,7 @@ class Admin(commands.Cog):
|
|||||||
await member.add_roles(role)
|
await member.add_roles(role)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
if not self.pass_hierarchy_check(ctx, role):
|
if not self.pass_hierarchy_check(ctx, role):
|
||||||
await self.complain(
|
await self.complain(ctx, T_(HIERARCHY_ISSUE_ADD), role=role, member=member)
|
||||||
ctx, T_(HIERARCHY_ISSUE), role=role, member=member, verb=_("add")
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
await self.complain(ctx, T_(GENERIC_FORBIDDEN))
|
await self.complain(ctx, T_(GENERIC_FORBIDDEN))
|
||||||
else:
|
else:
|
||||||
@ -128,9 +140,7 @@ class Admin(commands.Cog):
|
|||||||
await member.remove_roles(role)
|
await member.remove_roles(role)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
if not self.pass_hierarchy_check(ctx, role):
|
if not self.pass_hierarchy_check(ctx, role):
|
||||||
await self.complain(
|
await self.complain(ctx, T_(HIERARCHY_ISSUE_REMOVE), role=role, member=member)
|
||||||
ctx, T_(HIERARCHY_ISSUE), role=role, member=member, verb=_("remove")
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
await self.complain(ctx, T_(GENERIC_FORBIDDEN))
|
await self.complain(ctx, T_(GENERIC_FORBIDDEN))
|
||||||
else:
|
else:
|
||||||
@ -156,9 +166,7 @@ class Admin(commands.Cog):
|
|||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
await self._addrole(ctx, user, rolename)
|
await self._addrole(ctx, user, rolename)
|
||||||
else:
|
else:
|
||||||
await self.complain(
|
await self.complain(ctx, T_(USER_HIERARCHY_ISSUE_ADD), member=user, role=rolename)
|
||||||
ctx, T_(USER_HIERARCHY_ISSUE), member=user, role=rolename, verb=_("add")
|
|
||||||
)
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@ -176,9 +184,7 @@ class Admin(commands.Cog):
|
|||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
await self._removerole(ctx, user, rolename)
|
await self._removerole(ctx, user, rolename)
|
||||||
else:
|
else:
|
||||||
await self.complain(
|
await self.complain(ctx, T_(USER_HIERARCHY_ISSUE_REMOVE), member=user, role=rolename)
|
||||||
ctx, T_(USER_HIERARCHY_ISSUE), member=user, role=rolename, verb=_("remove")
|
|
||||||
)
|
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user