Last active
June 10, 2023 23:15
-
-
Save sekaiwish/91720cc7237affcab607d0d60301e0e4 to your computer and use it in GitHub Desktop.
Discord Permissions Integer Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
names = [ | |
"create instant invite", # 1 | |
"kick members", # 2 | |
"ban members", # 4 | |
"administrator", # 8 | |
"manage channels", # 16 | |
"manage server", # 32 | |
"add reactions", # 64 | |
"view audit log", # 128 | |
"priority speaker", # 256 | |
"stream video", # 512 | |
"read messages/view channels", # 1024 | |
"send messages", # 2048 | |
"send tts messages", # 4096 | |
"manage messages", # 8192 | |
"embed links", # 16384 | |
"attach files", # 32768 | |
"read message history", # 65536 | |
"mention everyone/all roles", # 131072 | |
"use external emojis", # 262144 | |
"view server insights", # 524288 | |
"connect voice", # 1048576 | |
"speak", # 2097152 | |
"mute members", # 4194304 | |
"deafen members", # 8388608 | |
"move members", # 16777216 | |
"use voice activity", # 33554432 | |
"change nickname", # 67108864 | |
"manage nicknames", # 134217728 | |
"manage roles", # 268435456 | |
"manage webhooks", # 536870912 | |
"manage expressions", # 1073741824 | |
"use slash commands", # 2147483648 | |
"request to speak", # 4294967296 | |
"manage events", # 8589934592 | |
"manage threads", # 17179869184 | |
"create public threads", # 34359738368 | |
"create private threads", # 68719476736 | |
"use external stickers", # 137438953472 | |
"send messages in threads", # 274877906944 | |
"use embedded activities", # 549755813888 | |
"moderate members", # 1099511627776 | |
"view creator monetization insights", # 2199023255552 | |
"use soundboard", # 4398046511104 | |
"create expressions", # 8796093022208 | |
"create events", # 17592186044416 | |
"use external sounds" # 35184372088832 | |
] | |
names.reverse() | |
integer = int(input("> ")) | |
for i in range(len(names)): | |
permission = 2**((len(names)-1)-i) | |
if not integer - permission < 0: | |
print(names[i]) | |
integer -= permission |
Thanks, was very helpful!
Btw this is the opposite to calculate the index when inputting the permission names:
def getFeatureIndex(listOfFeatures):
featureIndex = 0
for feature in listOfFeatures:
if feature in names:
featureIndex += 2** names.index(feature)
return featureIndex
getFeatureIndex(['manage events','manage roles','kick members'])
so whats every permission combined?
updated for mid-2023, emojis and stickers were renamed to 'expressions', application commands were standardised to slash commands.
so whats every permission combined?
by setting all the (currently available at this times) bits, you'd get 70368744177663
or 0x3FFFFFFFFFFF
.
not that you need to, you should be able to just set the administrator bit.
Yea i just want cool permission invites for my bot lol
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Restart