package permissions // Permission bitflags. const ( VIEW_CHANNEL int64 = 1 << 0 SEND_MESSAGES int64 = 1 << 1 MANAGE_MESSAGES int64 = 1 << 2 KICK_MEMBERS int64 = 1 << 3 BAN_MEMBERS int64 = 1 << 4 MANAGE_SERVER int64 = 1 << 5 MANAGE_CHANNELS int64 = 1 << 6 ADMINISTRATOR int64 = 1 << 7 CONNECT_VOICE int64 = 1 << 8 SPEAK_VOICE int64 = 1 << 9 SHARE_SCREEN int64 = 1 << 10 MUTE_MEMBERS int64 = 1 << 11 CREATE_INSTANT_INVITE int64 = 1 << 12 CHANGE_NICKNAME int64 = 1 << 13 MANAGE_NICKNAMES int64 = 1 << 14 MANAGE_ROLES int64 = 1 << 15 MANAGE_WEBHOOKS int64 = 1 << 16 EMBED_LINKS int64 = 1 << 17 ATTACH_FILES int64 = 1 << 18 ADD_REACTIONS int64 = 1 << 19 USE_EXTERNAL_EMOJIS int64 = 1 << 20 MENTION_EVERYONE int64 = 1 << 21 ) // DefaultEveryonePermissions is granted to the @everyone role when a server is created. // VIEW_CHANNEL | SEND_MESSAGES | CONNECT_VOICE | SPEAK_VOICE | SHARE_SCREEN | CREATE_INSTANT_INVITE | EMBED_LINKS | ATTACH_FILES | ADD_REACTIONS = bits 0,1,8,9,10,12,17,18,19. const DefaultEveryonePermissions int64 = VIEW_CHANNEL | SEND_MESSAGES | CONNECT_VOICE | SPEAK_VOICE | SHARE_SCREEN | CREATE_INSTANT_INVITE | EMBED_LINKS | ATTACH_FILES | ADD_REACTIONS // Has reports whether the permission set contains the given permission bits. func Has(permissions int64, perm int64) bool { return permissions&perm == perm } // Add returns permissions with the given bits set. func Add(permissions int64, perm int64) int64 { return permissions | perm } // Remove returns permissions with the given bits cleared. func Remove(permissions int64, perm int64) int64 { return permissions &^ perm }