report

package
v0.0.0-...-eb18d79 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRoleDiff       = errors.New("you can only ban or kick members with lower permissions than yours")
	ErrMemberHasLeft  = errors.New("this user is no more a member of this guild")
	ErrInvalidTimeout = errors.New("timeout must be in the future")
)

Functions

This section is empty.

Types

type Provider

type Provider interface {
	PushReport(rep models.Report) (models.Report, error)
	PushKick(rep models.Report) (models.Report, error)
	PushBan(rep models.Report) (models.Report, error)
	PushMute(rep models.Report) (models.Report, error)
	RevokeMute(guildID, executorID, victimID, reason string) (emb *discordgo.MessageEmbed, err error)
	RevokeReport(rep models.Report, executorID, reason,
		wsPublicAddr string,
	) (emb *discordgo.MessageEmbed, err error)
	UnbanReport(
		unbanReq models.UnbanRequest,
		executorID string,
		reason string,
		isUnban bool,
	) (emb *discordgo.MessageEmbed, err error)
	ExpireLastReport(guildID, victimID string, typ models.ReportType) (err error)
	ExpireExpiredReports() (mErr *multierror.MultiError)
}

type ReportError

type ReportError struct {
	models.Report
	// contains filtered or unexported fields
}

type ReportService

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

func New

func New(container di.Container) (t *ReportService, err error)

func (*ReportService) ExpireExpiredReports

func (r *ReportService) ExpireExpiredReports() (mErr *multierror.MultiError)

func (*ReportService) ExpireLastReport

func (r *ReportService) ExpireLastReport(guildID, victimID string, typ models.ReportType) (err error)

func (*ReportService) PushBan

func (r *ReportService) PushBan(rep models.Report) (models.Report, error)

PushBan is shorthand for PushReport as member ban action and also bans the member from the guild with the given reason and case ID for the audit log.

func (*ReportService) PushKick

func (r *ReportService) PushKick(rep models.Report) (models.Report, error)

PushKick is shorthand for PushReport as member kick action and also kicks the member from the guild with the given reason and case ID for the audit log.

func (*ReportService) PushMute

func (r *ReportService) PushMute(rep models.Report) (models.Report, error)

PushMute is shorthand for PushReport as member mute action and also adds the mute role to the specified victim.

func (*ReportService) PushReport

func (r *ReportService) PushReport(rep models.Report) (models.Report, error)

PushReport creates a new Report object with the given executorID, victimID, reason, attachmentID, and typ. The report is saved to the database using the passed db databse rpovider and an embed is created with the attachment url assembled with publicAddr as image endpoint root. This embed is then sent to the specified mod log channel for this guild, if existent.

func (*ReportService) RevokeMute

func (r *ReportService) RevokeMute(guildID, executorID, victimID, reason string) (emb *discordgo.MessageEmbed, err error)

RevokeMute removes the mute role of the specified victim and sends an unmute embed to the users DMs and to the mod log channel.

func (*ReportService) RevokeReport

func (r *ReportService) RevokeReport(
	rep models.Report,
	executorID string,
	reason string,
	wsPublicAddr string,
) (emb *discordgo.MessageEmbed, err error)

func (*ReportService) UnbanReport

func (r *ReportService) UnbanReport(
	unbanReq models.UnbanRequest,
	executorID string,
	reason string,
	isUnban bool,
) (emb *discordgo.MessageEmbed, err error)

Jump to

Keyboard shortcuts

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