common

package
v0.0.0-...-4d84aa9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelAllocationStream

func ChannelAllocationStream(
	channelAllocs *ChannelAllocationMap,
	callback func(channelID string, allocation int) (collected int, err error),
	maxMessages int,
	rolloverLeftovers int,
) error

func CountMap

func CountMap(m map[string]int) int

func GetChannelsFromList

func GetChannelsFromList(g *discordgo.Guild, filterChans []string) []*discordgo.Channel

Given a guild and a list of channels, return the channels that are in the list, removing duplicates

This is useful for creating a set of channels to allocate messages counts to etc.

func SaveIntermediateResult

func SaveIntermediateResult(
	progstate taskstate.TaskProgressState,
	prog *taskstate.Progress,
	data map[string]any,
) error

SaveIntermediateResult is a helper method to save an intermediate result to database within the state

Types

type ChannelAllocationMap

type ChannelAllocationMap struct {
	*orderedmap.OrderedMap[string, int]
}

func CreateChannelAllocations

func CreateChannelAllocations(
	basePerms int64,
	g *discordgo.Guild,
	m *discordgo.Member,
	neededPerms []int64,
	allowedChannelTypes []discordgo.ChannelType,
	channels []*discordgo.Channel,
	specialAllocs map[string]int,
	perChannel int,
	maxMessages int,
) (*ChannelAllocationMap, error)

func (ChannelAllocationMap) TotalAllocations

func (c ChannelAllocationMap) TotalAllocations() int

Jump to

Keyboard shortcuts

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