Documentation ¶
Index ¶
Constants ¶
View Source
const ( PermissionAdministrator = 0x01 PermissionModerator = 0x02 )
These constants define the bitflags which represent the permissions a user may have
Variables ¶
This section is empty.
Functions ¶
func RemoveFromCache ¶
func RemoveFromCache(userID string)
RemoveFromCache removes a user from the cache
Types ¶
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty"` DiscordID string `bson:"discordID"` Permissions int `bson:"permissions"` }
User represents a bot user
func RetrieveCached ¶
RetrieveCached retrieves a user but checks the cache first
func (*User) GrantPermission ¶
func (user *User) GrantPermission(permission Permission)
GrantPermission gives the current user the given permission
func (*User) HasPermission ¶
func (user *User) HasPermission(permissions ...Permission) bool
HasPermission checks whether or not the current user has at least one of the given permissions
func (*User) RevokePermission ¶
func (user *User) RevokePermission(permission Permission)
RevokePermission revokes the given permission from the current user
Click to show internal directories.
Click to hide internal directories.