Making code more efficient

Using map/.join/filter/lambda
pull/8/head
sgoudham 4 years ago
parent b375e6a209
commit 472dd0780e

@ -74,7 +74,7 @@ class GetInfo(commands.Cog):
filtered = filter(lambda x: x[1], target.guild_permissions) filtered = filter(lambda x: x[1], target.guild_permissions)
# now replace all "_" with " " in each item and join them together # now replace all "_" with " " in each item and join them together
permission = ",".join(map(lambda x: x[0].replace("_", " "), filtered)) permission = ",".join(map(lambda x: x[0].replace("_", " "), filtered))
# Capitalise every word in the array and get rid of the ", " at the end of the string # Capitalise every word in the array and get rid of the ", " at the end of the string
permissions = string.capwords("".join(map(str, DetectPermissions(permission, Perms)))) permissions = string.capwords("".join(map(str, DetectPermissions(permission, Perms))))

Loading…
Cancel
Save