def _inforole(self, msg):
"""
provides an infodump of a role, including permissions and position
"""
try:
args = shlex.split(msg.content)
except ValueError as e:
self.logger.warning("Unable to split {data.content}. {e}")
raise CommandSyntaxError(e)
if len(args) > 1:
name = capwords(args[1])
role = find_role(msg.guild, args[1])
if role:
t_dict = {
"name": role.name,
"permissions": role.permissions,
"colour": role.colour,
"hoist": role.hoist,
"mentionable": role.mentionable,
"position": role.position,
"created_at": role.created_at,
"id": role.id
}
t_string = ""
for k, v in t_dict.items():
if k != "permissions":
t_string = f"{t_string}{k}: {v!s}\n"
else:
t_string += k + ": " + ", ".join({x.upper() for x, y in v if y}) + "\n"
await respond(msg, f"**ANALYSIS: role {role.name} has parameters :**\n ```{t_string}```")
else:
await respond(msg, f"**NEGATIVE. ANALYSIS: no role {name} found.**")
else:
raise CommandSyntaxError
评论列表
文章目录