karma

package
v0.0.0-...-553821e Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	GetState(guildID string) (ok bool, err error)
	IsBlockListed(guildID, userID string) (isBlocklisted bool, err error)
	Update(guildID, userID, executorID string, value int) (err error)
	ApplyPenalty(guildID, userID string) (err error)
	CheckAndUpdate(guildID, executorID string, object *discordgo.User, value int) (ok bool, err error)
}

type Service

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

Service provides functionalities to check karma state, karma blocklist and alter karma of a user.

func NewKarmaService

func NewKarmaService(container di.Container) (k *Service)

NewKarmaService initializes a new Service instance.

func (*Service) ApplyPenalty

func (k *Service) ApplyPenalty(guildID, userID string) (err error)

func (*Service) CheckAndUpdate

func (k *Service) CheckAndUpdate(guildID, executorID string, object *discordgo.User, value int) (ok bool, err error)

CheckAndUpdate is shorthand for GetState, IsBlockListed and Update in one single pipe.

func (*Service) GetState

func (k *Service) GetState(guildID string) (ok bool, err error)

GetState returns the current enabled/disabled state of the karma system on the specified guild.

func (*Service) IsBlockListed

func (k *Service) IsBlockListed(guildID, userID string) (isBlocklisted bool, err error)

IsBlockListed returns true if the passed user on the specified guild is blocked from gaining or giving karma.

func (*Service) Update

func (k *Service) Update(guildID, userID, executorID string, value int) (err error)

Update adds or removes karma of the given value of the specified user.

Jump to

Keyboard shortcuts

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