antispam

package
v0.0.0-...-c4580cc Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Antispam

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

func NewAntispam

func NewAntispam(opts Options) (*Antispam, error)

func (*Antispam) AddUserToDeniedList

func (a *Antispam) AddUserToDeniedList(userId userIdType)

func (*Antispam) Enabled

func (a *Antispam) Enabled() bool

func (*Antispam) GenerateAlertMessage

func (a *Antispam) GenerateAlertMessage(i *dgo.MessageCreate) *dgo.MessageSend

func (*Antispam) GetTrackedChannelIds

func (a *Antispam) GetTrackedChannelIds() []string

func (*Antispam) GetUserMessages

func (a *Antispam) GetUserMessages(userId userIdType) map[string]string

GetUserMessages retrieves the messages associated with a user and organizes them in a map. The keys of the map represent the channel IDs, and the corresponding values are the message IDs.

Note: This function is designed to be used with an Antispam instance and requires a valid userIdType parameter.

Parameters:

  • userId: The unique identifier of the user for whom messages are to be retrieved.

Returns:

  • map[string]string: A map where keys are channel IDs, and values are message IDs.

func (*Antispam) GetUserUniqueMessages

func (a *Antispam) GetUserUniqueMessages(userId userIdType) map[string]string

func (*Antispam) Handler

func (a *Antispam) Handler(s *dgo.Session, i *dgo.MessageCreate)

func (*Antispam) IsChannelIdTrackable

func (a *Antispam) IsChannelIdTrackable(channelId string) bool

func (*Antispam) IsUserInDeniedList

func (a *Antispam) IsUserInDeniedList(userId userIdType) bool

func (*Antispam) IsUserWithinMaxChannelsLimit

func (a *Antispam) IsUserWithinMaxChannelsLimit(userId userIdType) bool

func (*Antispam) StoreMessage

func (a *Antispam) StoreMessage(userId userIdType, channelId string, message Message)

func (*Antispam) TrackHandler

func (a *Antispam) TrackHandler(s *dgo.Session, i *dgo.MessageCreate)

type Message

type Message struct {
	ID        string `json:"id"`
	CreatedAt int64  `json:"createdAt"` // Unix timestamp
	Content   string `json:"content"`
}

func NewMessage

func NewMessage(ID string, content string) (Message, error)

type Options

type Options struct {
	Cfg        yaml.Antispam
	Moderators *moderators.Moderators
}

Jump to

Keyboard shortcuts

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