sed

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: 8 Imported by: 1

Documentation

Overview

Package sed implements a plugin to replace pattern in sentences. When someone says s/pattern/replace/ bot replaces that someone's last line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(b bot.Bot)

Register registers the plugin with a bot.

Types

type Backlog

type Backlog struct {
	sync.Mutex
	M map[string]map[string]*list.List
}

Backlog is an accessible map of channels to nick to entries.

func (*Backlog) Clean

func (bl *Backlog) Clean()

Clean maintains a backlog clean by expiring old entries and ensuring maximum of lines.

func (*Backlog) Search

func (bl *Backlog) Search(channel, nick string) []string

Search returns backlog lines of a channel/nick.

func (*Backlog) Sed

func (bl *Backlog) Sed(channel, nick, pattern, replace string) string

Sed attempts to replace a pattern in a backlog for channel/nick.

func (*Backlog) Store

func (bl *Backlog) Store(channel, nick, line string)

Store saves a line from a channel/nick into backlog.

type Entry

type Entry struct {
	Line string
	Time time.Time
}

Entry is a backlog entry: text line and time it happened.

func (*Entry) Expired

func (e *Entry) Expired() bool

Expired tells if an entry is expired based on time it happened and expiration.

Jump to

Keyboard shortcuts

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