Documentation ¶
Index ¶
- Constants
- Variables
- func Contains[T comparable](slice []T, v T) bool
- func IsThread(ch discord.Channel) bool
- func PermStrings(p discord.Permissions) []string
- func PermStringsFor(m []Perm, p discord.Permissions) []string
- func Version() string
- func WaitFor[T any](ctx context.Context, s StateWaiter, filter func(t T) bool) (t T, ok bool)
- type Map
- func (m *Map[K, V]) Exists(k K) (exists bool)
- func (m *Map[K, V]) Get(k K) (v V, ok bool)
- func (m *Map[K, V]) Length() int
- func (m *Map[K, V]) ReadFunc(fn func(map[K]V))
- func (m *Map[K, V]) Remove(k K) (exists bool)
- func (m *Map[K, V]) Set(k K, v V)
- func (m *Map[K, V]) Values() []V
- func (m *Map[K, V]) WriteFunc(fn func(map[K]V))
- type Perm
- type Set
- type StateWaiter
Constants ¶
const ( ColourPurple = 0x9b59b6 ColourGreen = 0x2ecc71 ColourRed = 0xe74c3c ColourOrange = 0xe67e22 ColourBlue = 0x3498db ColourGold = 0xf1c40f )
const ( PermissionViewServerInsights = 1 << 19 PermissionModerateMembers = 1 << 40 )
Permission constants that Arikawa is missing
Variables ¶
var ( MajorPerms = []Perm{ {discord.PermissionAdministrator, "Administrator"}, {discord.PermissionManageGuild, "Manage Server"}, {discord.PermissionManageWebhooks, "Manage Webhooks"}, {discord.PermissionManageChannels, "Manage Channels"}, {discord.PermissionBanMembers, "Ban Members"}, {discord.PermissionKickMembers, "Kick Members"}, {discord.PermissionManageRoles, "Manage Roles"}, {discord.PermissionManageNicknames, "Manage Nicknames"}, {discord.PermissionManageEmojisAndStickers, "Manage Emojis and Stickers"}, {discord.PermissionManageThreads, "Manage Threads"}, {discord.PermissionManageMessages, "Manage Messages"}, {PermissionModerateMembers, "Moderate Members"}, {discord.PermissionMentionEveryone, "Mention Everyone"}, {discord.PermissionModerateMembers, "Timeout Members"}, {discord.PermissionMuteMembers, "Voice Mute Members"}, {discord.PermissionDeafenMembers, "Voice Deafen Members"}, {discord.PermissionMoveMembers, "Voice Move Members"}, } NotablePerms = []Perm{ {discord.PermissionViewAuditLog, "View Audit Log"}, {PermissionViewServerInsights, "View Server Insights"}, {discord.PermissionPrioritySpeaker, "Priority Speaker"}, {discord.PermissionSendTTSMessages, "Send TTS Messages"}, {discord.PermissionCreateInstantInvite, "Create Invite"}, {discord.PermissionCreatePublicThreads, "Create Public Threads"}, {discord.PermissionCreatePrivateThreads, "Create Private Threads"}, } MinorPerms = []Perm{ {discord.PermissionStream, "Video"}, {discord.PermissionUseVAD, "Use Voice Activity"}, {discord.PermissionSpeak, "Speak"}, {discord.PermissionConnect, "Connect"}, {discord.PermissionRequestToSpeak, "Request to Speak"}, {discord.PermissionAttachFiles, "Attach Files"}, {discord.PermissionEmbedLinks, "Embed Links"}, {discord.PermissionStartEmbeddedActivities, "Start Embedded Activities"}, {discord.PermissionAddReactions, "Add Reactions"}, {discord.PermissionSendMessages, "Send Messages"}, {discord.PermissionSendMessagesInThreads, "Send Messages in Threads"}, {discord.PermissionReadMessageHistory, "Read Message History"}, {discord.PermissionViewChannel, "View Channel"}, {discord.PermissionUseSlashCommands, "Use Slash Commands"}, {discord.PermissionChangeNickname, "Change Nickname"}, {discord.PermissionUseExternalEmojis, "Use External Emojis"}, } AllPerms = append(MajorPerms, append(NotablePerms, MinorPerms...)...) )
All permissions
var Commands = []api.CreateCommandData{ { Name: "catalogger", Description: "Meta commands", Options: discord.CommandOptions{ &discord.SubcommandOption{ OptionName: "help", Description: "Show help!", }, &discord.SubcommandOption{ OptionName: "invite", Description: "Get an invite for Catalogger", }, &discord.SubcommandOption{ OptionName: "dashboard", Description: "Get a link to the Catalogger dashboard", }, }, }, { Name: "config", Description: "Configure Catalogger", DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageGuild), Options: discord.CommandOptions{ &discord.SubcommandOption{ OptionName: "channels", Description: "Configure logging channels", }, }, }, }
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, v T) bool
Contains returns whether `v` is in `slice`.
func PermStrings ¶
func PermStrings(p discord.Permissions) []string
PermStrings gives permission strings for all Discord permissions
func PermStringsFor ¶
func PermStringsFor(m []Perm, p discord.Permissions) []string
PermStringsFor gives permission strings for the given Perm slice
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map is a concurrent map. It wraps the standard library's map with a mutex for concurrent access.
func (*Map[K, V]) ReadFunc ¶
func (m *Map[K, V]) ReadFunc(fn func(map[K]V))
ReadFunc runs fn with the mutex locked for reading. The raw map is passed to fn.
func (*Map[K, V]) Remove ¶
Remove removes a key from the map. It returns true if the key existed in the map, false otherwise.
type Perm ¶
type Perm struct { Permission discord.Permissions Name string }
Perm is a single permission
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
Set is a concurrent set. It is not ordered.
func (*Set[T]) Add ¶
Add adds a value to the set. It returns true if the value doesn't already exist, false otherwise.
func (*Set[T]) Append ¶
func (s *Set[T]) Append(values ...T)
Append adds a slice of values to the set.