old

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package old implements a plugin to remember URLs and announce duplicates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(b bot.Bot, oldfile string, ignore []string)

Register registers the plugin with a bot.

Types

type Info

type Info struct {
	Channel, Nick string
	Time          time.Time
}

Info represents information about an observed URL.

func (Info) String

func (i Info) String() string

String returns formatted information about a URL.

type Old

type Old struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Old represents URLs seen.

func NewOld

func NewOld() *Old

NewOld returns a new initialized Old.

func (*Old) Add

func (o *Old) Add(url, channel, nick string) error

Add adds a new URL with its info, error if it already exists.

func (*Old) Clean

func (o *Old) Clean(expiry time.Duration)

Clean removes URLs older than a given duration.

func (*Old) Old

func (o *Old) Old(url string) (Info, error)

Old returns info of an URL if it is old, error if it does not exist.

Jump to

Keyboard shortcuts

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