Skip to content

PermissionsBuilder

PermissionsBuilder is used to construct and manage permissions for a Discord bot.

Usage:

local permissions = PermissionsBuilder.new()
:addPermission(PermissionsBuilder.Permissions.Administrator)
:addPermission(PermissionsBuilder.Permissions.ManageChannels)
print(permissions:getValue())

Properties

Permissions

PermissionsBuilder.Permissions  :: table

An enumeration of permissions.

  • CreateInstantInvite: 0
  • KickMembers: 1
  • BanMembers: 2
  • Administrator: 3
  • ManageChannels: 4
  • ManageGuild: 5
  • AddReactions: 6
  • ViewAuditLog: 7
  • PrioritySpeaker: 8
  • Stream: 9
  • ViewChannel: 10
  • SendMessages: 11
  • SendTTSMessages: 12
  • ManageMessages: 13
  • EmbedLinks: 14
  • AttachFiles: 15
  • ReadMessageHistory: 16
  • MentionEveryone: 17
  • UseExternalEmojis: 18
  • ViewGuildInsights: 19
  • Connect: 20
  • Speak: 21
  • MuteMembers: 22
  • DeafenMembers: 23
  • MoveMembers: 24
  • UseVAD: 25
  • ChangeNickname: 26
  • ChangeNicknames: 27
  • ManageRoles: 28
  • ManageWebhooks: 29
  • ManageGuildExpressions: 30
  • UseApplicationCommands: 31
  • RequestToSpeak: 32
  • ManageEvents: 33
  • ManageThreads: 34
  • CreatePublicThreads: 35
  • CreatePrivateThreads: 36
  • UseExternalStickers: 37
  • SendMessagesInThreads: 38
  • UseEmbeddedActivities: 39
  • ModerateMembers: 40
  • ViewCreatorMonetizationAnalytics: 41
  • UseSoundboard: 42
  • UseExternalSounds: 45
  • SendVoiceMessages: 46

Methods

addPermission

PermissionsBuilder : addPermission (

     permission: number
)  -> Builders.PermissionsBuilder

Adds a permission to the builder.

deletePermission

PermissionsBuilder : deletePermission (

     permission: number
)  -> Builders.PermissionsBuilder

Removes a permission from the builder.

hasPermission

PermissionsBuilder : hasPermission (

     permission: number
)  -> boolean

Checks if a permission is in the builder.

getValue

PermissionsBuilder : getValue ()  -> string

Gets the bitfield value of the permissions.

Functions

new

PermissionsBuilder . new ()  -> ()

Creates a new instance of PermissionsBuilder.

none

PermissionsBuilder . none ()  -> ()

Creates a new instance of PermissionsBuilder with no permissions.

all

PermissionsBuilder . all ()  -> ()

Creates a new instance of PermissionsBuilder with all permissions.

from

PermissionsBuilder . from (

     bitfield: string
)  -> ()

Creates a new instance of PermissionsBuilder from a bitfield.