notification

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int
const (
	ActionRetag Action = iota + 1
	ActionRelabel
	ActionClean
	ActionPause
	ActionOrphan
)

type BuildOptions

type BuildOptions struct {
	Torrent config.Torrent

	RemovalReason string

	NewTags    []string
	NewUpLimit int64

	NewLabel string

	Orphan     string
	OrphanSize int64
	IsFile     bool
}

type DiscordEmbed

type DiscordEmbed struct {
	Title       string               `json:"title"`
	Description string               `json:"description"`
	Color       int                  `json:"color"`
	Fields      []DiscordEmbedsField `json:"fields,omitempty"`
	Footer      DiscordEmbedsFooter  `json:"footer,omitzero"`
	Timestamp   time.Time            `json:"timestamp"`
}

type DiscordEmbedsField

type DiscordEmbedsField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline,omitempty"`
}

type DiscordEmbedsFooter

type DiscordEmbedsFooter struct {
	Text string `json:"text"`
}

type DiscordMessage

type DiscordMessage struct {
	Content   any            `json:"content"`
	Username  string         `json:"username,omitempty"`
	AvatarURL string         `json:"avatar_url,omitempty"`
	Embeds    []DiscordEmbed `json:"embeds,omitempty"`
}

type DiscordRateLimit

type DiscordRateLimit struct {
	Limit      int           // X-RateLimit-Limit
	Remaining  int           // X-RateLimit-Remaining
	ResetTime  time.Time     // X-RateLimit-Reset (unix timestamp)
	Bucket     string        // X-RateLimit-Bucket
	Scope      string        // X-RateLimit-Scope
	Global     bool          // X-RateLimit-Global
	RetryAfter time.Duration // Retry-After (if rate limited)
}

DiscordRateLimit holds rate limit information from Discord headers

type EmbedColors

type EmbedColors int
const (
	LIGHT_BLUE EmbedColors = 0x58b9ff
	RED        EmbedColors = 0xed4245
	GREEN      EmbedColors = 0x57f287
	GRAY       EmbedColors = 0x99aab5
)

type Field

type Field struct {
	Name  string
	Value string
}

type RateLimiter

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

RateLimiter manages Discord API rate limits

func NewRateLimiter

func NewRateLimiter(log *logrus.Entry) *RateLimiter

func (*RateLimiter) Clean

func (rl *RateLimiter) Clean()

Clean removes expired rate limit entries

func (*RateLimiter) Update

func (rl *RateLimiter) Update(bucket string, headers http.Header)

Update processes rate limit headers from Discord response

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait(bucket string)

Wait blocks until it's safe to make a request

type Sender

type Sender interface {
	CanSend() bool
	Send(title string, description string, client string, runTime time.Duration, fields []Field, dryRun bool) error
	BuildField(action Action, options BuildOptions) Field
	Name() string
}

func NewDiscordSender

func NewDiscordSender(log *logrus.Entry, config config.NotificationsConfig) Sender

Jump to

Keyboard shortcuts

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