acl

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelRestrictionString

func ChannelRestrictionString(c ChannelRestriction) string

ChannelRestrictionString returns a user-friendly representation of the channel restriction

func RestrictionString

func RestrictionString(c ChannelRestriction, r RoleRestriction) string

RestrictionString returns a user-friendly representation of an restriction pair

func RoleRestrictionString

func RoleRestrictionString(r RoleRestriction) string

RoleRestrictionString returns a user-friendly representation of the role restriction

Types

type ACL

type ACL struct {
	// contains filtered or unexported fields
}

func NewACL

func NewACL(s *storage.StormDB) *ACL

func (ACL) Check

Check will perform checks for the given RoleRestriction and ChannelRestriction.

func (ACL) HasRole

func (a ACL) HasRole(u *discordgo.Member, r string) bool

HasRole will check if a guild member has the given role

func (ACL) IsAdmin

func (a ACL) IsAdmin(s *discordgo.Session, m *discordgo.Message) (bool, error)

IsAdmin will check if a member has the admin role.

func (ACL) IsMusic

func (a ACL) IsMusic(m *discordgo.Message, gc *models.Conf) bool

IsMusic will check if the provided message was sent to the music channel.

func (ACL) IsPrivileged

func (a ACL) IsPrivileged(s *discordgo.Session, m *discordgo.Message, gc *models.Conf) (bool, error)

IsPrivileged will check if a member is either admin or DJ.

type ChannelRestriction

type ChannelRestriction int
const (
	Music ChannelRestriction = iota
	Anywhere
)

type RoleRestriction

type RoleRestriction int
const (
	Admin RoleRestriction = iota
	Privileged
	Anyone
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL