message

package
v0.0.0-...-a121215 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MatchFunctionByUser = func(userID string) matchFunction {
	return func(message *discordgo.Message) bool {
		return message.Author.ID == userID && message.Timestamp.Before(twoWeeksAgo())
	}
}
View Source
var MatchFunctionByUserWithImages = func(userID string) matchFunction {
	return func(message *discordgo.Message) bool {
		isImage := false
		for _, attachment := range message.Attachments {
			if strings.HasPrefix(attachment.ContentType, "image/") {
				isImage = true
				break
			}
		}
		return message.Author.ID == userID && message.Timestamp.Before(twoWeeksAgo()) && isImage
	}
}

Functions

func CollectMessageIDs

func CollectMessageIDs(s *discordgo.Session, channelID string, totalCount int, match matchFunction) ([]string, error)

Types

type Manager

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

func NewManager

func NewManager(session *discordgo.Session) *Manager

func (*Manager) RemoveUserMessages

func (man *Manager) RemoveUserMessages(channelID, userID string, count int) error

func (*Manager) RemoveUserMessagesWithImages

func (man *Manager) RemoveUserMessagesWithImages(channelID, userID string, count int) error

Jump to

Keyboard shortcuts

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