mirror of
https://github.com/RGBCube/minearchy-bot
synced 2025-07-27 17:07:45 +00:00
a
This commit is contained in:
parent
8c954ed8d2
commit
a4d6277e72
1 changed files with 77 additions and 72 deletions
|
@ -56,9 +56,11 @@ class Utils(Cog):
|
|||
continue
|
||||
|
||||
if isinstance(channel, CategoryChannel):
|
||||
string.append(f"category {channel.name}:")
|
||||
string.append(f" id: {channel.id}")
|
||||
string.append(f"category `{channel.name}`: ")
|
||||
|
||||
# Category perms start.
|
||||
|
||||
# " permissions:"
|
||||
perms = []
|
||||
|
||||
for thing, overwrites in channel.overwrites.items():
|
||||
|
@ -72,9 +74,6 @@ class Utils(Cog):
|
|||
typ = repr(thing.type)
|
||||
name = "unknown"
|
||||
|
||||
perms.append(f" {typ} {name}:")
|
||||
perms.append(f" id: {thing.id}")
|
||||
|
||||
allow, deny = [], []
|
||||
|
||||
for perm, value in overwrites._values.items():
|
||||
|
@ -84,74 +83,79 @@ class Utils(Cog):
|
|||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
perms.append(f" {typ} {name}: {thing.id}")
|
||||
perms.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
perms.append(f" {a}: ✅")
|
||||
for d in deny:
|
||||
perms.append(f" {d}: ❌")
|
||||
|
||||
perms.append(" channels:")
|
||||
|
||||
for child in channel.channels:
|
||||
if isinstance(child, TextChannel):
|
||||
typ = "text"
|
||||
elif isinstance(child, ForumChannel):
|
||||
typ = "forum"
|
||||
elif isinstance(child, VoiceChannel):
|
||||
typ = "voice"
|
||||
elif isinstance(child, StageChannel):
|
||||
typ = "stage"
|
||||
else:
|
||||
typ = "unknown"
|
||||
|
||||
string.append(f" {typ} channel `{child.name}`:")
|
||||
string.append(f" id: {child.id}")
|
||||
|
||||
child_perms = []
|
||||
|
||||
for child_thing, child_overwrites in child.overwrites.items():
|
||||
if isinstance(child_thing, Role):
|
||||
typ = "role"
|
||||
name = child_thing.name
|
||||
elif isinstance(child_thing, Member):
|
||||
typ = "member"
|
||||
name = f"{child_thing.name}#{child_thing.discriminator}"
|
||||
else:
|
||||
typ = repr(child_thing.type)
|
||||
name = "unknown"
|
||||
|
||||
child_perms.append(f" {typ} {name}:")
|
||||
child_perms.append(f" id: {child_thing.id}")
|
||||
|
||||
allow, deny = [], []
|
||||
|
||||
for perm, value in overwrites._values.items():
|
||||
channel_corresponding_value = child_overwrites._values.get(perm)
|
||||
|
||||
unique = value is not channel_corresponding_value
|
||||
if not unique:
|
||||
continue
|
||||
|
||||
if value is True:
|
||||
allow.append(perm)
|
||||
elif value is False:
|
||||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
string.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
string.append(f" {a}: ✅")
|
||||
for d in deny:
|
||||
string.append(f" {d}: ❌")
|
||||
|
||||
if child_perms:
|
||||
string.append(" permissions:")
|
||||
string.extend(child_perms)
|
||||
|
||||
if perms:
|
||||
string.append(" permissions:")
|
||||
string.extend(perms)
|
||||
|
||||
# Category perms end.
|
||||
|
||||
# Channel perms start.
|
||||
|
||||
string.append(" channels:")
|
||||
|
||||
for child in channel.channels:
|
||||
if isinstance(child, TextChannel):
|
||||
typ = "text"
|
||||
elif isinstance(child, ForumChannel):
|
||||
typ = "forum"
|
||||
elif isinstance(child, VoiceChannel):
|
||||
typ = "voice"
|
||||
elif isinstance(child, StageChannel):
|
||||
typ = "stage"
|
||||
else:
|
||||
typ = "unknown"
|
||||
|
||||
string.append(f" {typ} channel `{child.name}`: {child.id}")
|
||||
|
||||
child_perms = []
|
||||
|
||||
for child_thing, child_overwrites in child.overwrites.items():
|
||||
if isinstance(child_thing, Role):
|
||||
typ = "role"
|
||||
name = child_thing.name
|
||||
elif isinstance(child_thing, Member):
|
||||
typ = "member"
|
||||
name = f"{child_thing.name}#{child_thing.discriminator}"
|
||||
else:
|
||||
typ = repr(child_thing.type)
|
||||
name = "unknown"
|
||||
|
||||
allow, deny = [], []
|
||||
|
||||
for perm, value in overwrites._values.items():
|
||||
channel_corresponding_value = child_overwrites._values.get(perm)
|
||||
|
||||
unique = value is not channel_corresponding_value
|
||||
if not unique:
|
||||
continue
|
||||
|
||||
if value is True:
|
||||
allow.append(perm)
|
||||
elif value is False:
|
||||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
child_perms.append(f" {typ} {name}: {child_thing.id}")
|
||||
string.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
string.append(f" {a}: ✅")
|
||||
for d in deny:
|
||||
string.append(f" {d}: ❌")
|
||||
|
||||
if child_perms:
|
||||
string.append(" permissions:")
|
||||
string.extend(child_perms)
|
||||
|
||||
# Child perms end.
|
||||
|
||||
else:
|
||||
if isinstance(channel, TextChannel):
|
||||
|
@ -165,9 +169,10 @@ class Utils(Cog):
|
|||
else:
|
||||
typ = "unknown"
|
||||
|
||||
string.append(f"{typ} channel `{channel.name}`:")
|
||||
string.append(f" id: {channel.id}")
|
||||
string.append(f"{typ} channel `{channel.name}`: {channel.id}")
|
||||
|
||||
# Root perms start.
|
||||
# " permissions:"
|
||||
perms = []
|
||||
|
||||
for thing, overwrites in channel.overwrites.items():
|
||||
|
@ -181,9 +186,6 @@ class Utils(Cog):
|
|||
typ = repr(thing.type)
|
||||
name = "unknown"
|
||||
|
||||
string.append(f" {typ} {name}:")
|
||||
string.append(f" id: {thing.id}")
|
||||
|
||||
allow, deny = [], []
|
||||
|
||||
for perm, value in overwrites._values.items():
|
||||
|
@ -193,16 +195,19 @@ class Utils(Cog):
|
|||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
string.append(" permissions:")
|
||||
string.append(f" {typ} {name}: {thing.id}")
|
||||
string.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
string.append(f" {a}: ✅")
|
||||
string.append(f" {a}: ✅")
|
||||
for d in deny:
|
||||
string.append(f" {d}: ❌")
|
||||
string.append(f" {d}: ❌")
|
||||
|
||||
if perms:
|
||||
string.append(" permissions:")
|
||||
string.extend(perms)
|
||||
|
||||
# Root perms end.
|
||||
|
||||
await ctx.reply(
|
||||
file=File(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue