permission

package
v0.0.0-...-8fd61c5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: BSD-3-Clause Imports: 7 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BuildPermissions

func BuildPermissions(permissions ...Permission) uint64

func CanInteractWith

func CanInteractWith(ctx context.Context, shard *gateway.Shard, guildId, userId, targetId uint64) bool

func CanSelfInteractWith

func CanSelfInteractWith(ctx context.Context, shard *gateway.Shard, guildId, targetId uint64) (bool, error)

func GetBasePermissions

func GetBasePermissions(ctx context.Context, shard *gateway.Shard, guildId uint64) (uint64, error)

func GetChannelBasePermissions

func GetChannelBasePermissions(ctx context.Context, shard *gateway.Shard, guildId, channelId uint64, initialPermissions uint64) (uint64, error)

func GetChannelMemberPermissions

func GetChannelMemberPermissions(ctx context.Context, shard *gateway.Shard, userId, channelId uint64, initialPermissions uint64) (uint64, error)

func GetChannelTotalRolePermissions

func GetChannelTotalRolePermissions(ctx context.Context, shard *gateway.Shard, guildId, userId, channelId uint64, initialPermissions uint64) (uint64, error)

func GetEffectivePermissions

func GetEffectivePermissions(ctx context.Context, shard *gateway.Shard, guildId, userId uint64) (uint64, error)

func GetEffectivePermissionsChannel

func GetEffectivePermissionsChannel(ctx context.Context, shard *gateway.Shard, guildId, userId, channelId uint64) (uint64, error)

func GetGuildTotalRolePermissions

func GetGuildTotalRolePermissions(ctx context.Context, shard *gateway.Shard, guildId, userId uint64, initialPermissions uint64) (uint64, error)

func GetHighestRolePosition

func GetHighestRolePosition(ctx context.Context, shard *gateway.Shard, guildId, userId uint64) int

func HasPermissionRaw

func HasPermissionRaw(permissions uint64, permission Permission) bool

func HasPermissions

func HasPermissions(ctx context.Context, shard *gateway.Shard, guildId, userId uint64, permissions ...Permission) bool

func HasPermissionsChannel

func HasPermissionsChannel(ctx context.Context, shard *gateway.Shard, guildId, userId, channelId uint64, permissions ...Permission) bool

Types

type Permission

type Permission uint64
const (
	CreateInstantInvite Permission = 1 << iota
	KickMembers
	BanMembers
	Administrator
	ManageChannels
	ManageGuild
	AddReactions
	ViewAuditLog
	PrioritySpeaker
	Stream
	ViewChannel // Read messages
	SendMessages
	SendTTSMessages
	ManageMessages
	EmbedLinks
	AttachFiles
	ReadMessageHistory
	MentionEveryone
	UseExternalEmojis
	ViewGuildInsights
	Connect
	Speak
	MuteMembers
	DeafenMembers
	MoveMembers
	UseVAD // Use voice activity
	ChangeNickname
	ManageNicknames
	ManageRoles // Manage permissions
	ManageWebhooks
	ManageEmojis
	UseApplicationCommands
	RequestToSpeak
	ManageEvents
	ManageThreads
	CreatePublicThreads
	CreatePrivateThreads
	UseExternalStickers
	SendMessagesInThreads
	UseEmbeddedActivities
	ModerateMembers
)

func GetAllPermissions

func GetAllPermissions(ctx context.Context, shard *gateway.Shard, guildId, userId uint64) []Permission

func GetAllPermissionsChannel

func GetAllPermissionsChannel(ctx context.Context, shard *gateway.Shard, guildId, userId, channelId uint64) []Permission

func (Permission) String

func (p Permission) String() string

Jump to

Keyboard shortcuts

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