1
Fork 0
mirror of https://github.com/RGBCube/minearchy-bot synced 2025-07-27 08:57:46 +00:00
This commit is contained in:
RGBCube 2022-12-17 21:47:15 +03:00
parent 8c954ed8d2
commit a4d6277e72

View file

@ -56,9 +56,11 @@ class Utils(Cog):
continue continue
if isinstance(channel, CategoryChannel): if isinstance(channel, CategoryChannel):
string.append(f"category {channel.name}:") string.append(f"category `{channel.name}`: ")
string.append(f" id: {channel.id}")
# Category perms start.
# " permissions:"
perms = [] perms = []
for thing, overwrites in channel.overwrites.items(): for thing, overwrites in channel.overwrites.items():
@ -72,9 +74,6 @@ class Utils(Cog):
typ = repr(thing.type) typ = repr(thing.type)
name = "unknown" name = "unknown"
perms.append(f" {typ} {name}:")
perms.append(f" id: {thing.id}")
allow, deny = [], [] allow, deny = [], []
for perm, value in overwrites._values.items(): for perm, value in overwrites._values.items():
@ -84,6 +83,7 @@ class Utils(Cog):
deny.append(perm) deny.append(perm)
if allow or deny: if allow or deny:
perms.append(f" {typ} {name}: {thing.id}")
perms.append(" permissions:") perms.append(" permissions:")
for a in allow: for a in allow:
@ -91,7 +91,15 @@ class Utils(Cog):
for d in deny: for d in deny:
perms.append(f" {d}: ❌") perms.append(f" {d}: ❌")
perms.append(" channels:") if perms:
string.append(" permissions:")
string.extend(perms)
# Category perms end.
# Channel perms start.
string.append(" channels:")
for child in channel.channels: for child in channel.channels:
if isinstance(child, TextChannel): if isinstance(child, TextChannel):
@ -105,8 +113,7 @@ class Utils(Cog):
else: else:
typ = "unknown" typ = "unknown"
string.append(f" {typ} channel `{child.name}`:") string.append(f" {typ} channel `{child.name}`: {child.id}")
string.append(f" id: {child.id}")
child_perms = [] child_perms = []
@ -121,9 +128,6 @@ class Utils(Cog):
typ = repr(child_thing.type) typ = repr(child_thing.type)
name = "unknown" name = "unknown"
child_perms.append(f" {typ} {name}:")
child_perms.append(f" id: {child_thing.id}")
allow, deny = [], [] allow, deny = [], []
for perm, value in overwrites._values.items(): for perm, value in overwrites._values.items():
@ -139,6 +143,7 @@ class Utils(Cog):
deny.append(perm) deny.append(perm)
if allow or deny: if allow or deny:
child_perms.append(f" {typ} {name}: {child_thing.id}")
string.append(" permissions:") string.append(" permissions:")
for a in allow: for a in allow:
@ -149,9 +154,8 @@ class Utils(Cog):
if child_perms: if child_perms:
string.append(" permissions:") string.append(" permissions:")
string.extend(child_perms) string.extend(child_perms)
if perms:
string.append(" permissions:") # Child perms end.
string.extend(perms)
else: else:
if isinstance(channel, TextChannel): if isinstance(channel, TextChannel):
@ -165,9 +169,10 @@ class Utils(Cog):
else: else:
typ = "unknown" typ = "unknown"
string.append(f"{typ} channel `{channel.name}`:") string.append(f"{typ} channel `{channel.name}`: {channel.id}")
string.append(f" id: {channel.id}")
# Root perms start.
# " permissions:"
perms = [] perms = []
for thing, overwrites in channel.overwrites.items(): for thing, overwrites in channel.overwrites.items():
@ -181,9 +186,6 @@ class Utils(Cog):
typ = repr(thing.type) typ = repr(thing.type)
name = "unknown" name = "unknown"
string.append(f" {typ} {name}:")
string.append(f" id: {thing.id}")
allow, deny = [], [] allow, deny = [], []
for perm, value in overwrites._values.items(): for perm, value in overwrites._values.items():
@ -193,6 +195,7 @@ class Utils(Cog):
deny.append(perm) deny.append(perm)
if allow or deny: if allow or deny:
string.append(f" {typ} {name}: {thing.id}")
string.append(" permissions:") string.append(" permissions:")
for a in allow: for a in allow:
@ -204,6 +207,8 @@ class Utils(Cog):
string.append(" permissions:") string.append(" permissions:")
string.extend(perms) string.extend(perms)
# Root perms end.
await ctx.reply( await ctx.reply(
file=File( file=File(
BytesIO("\n".join(string).encode()), BytesIO("\n".join(string).encode()),