ping

package
v0.0.0-...-7cb85a9 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is simple cache for pings.

func NewCache

func NewCache() *Cache

NewCache creates a new cache.

func (*Cache) Add

func (c *Cache) Add(id int, gid, uid, pattern string) error

Add adds a ping to the cache.

func (*Cache) Delete

func (c *Cache) Delete(gid discord.GuildID, id int)

Delete removes a ping from the cache.

func (*Cache) Find

func (c *Cache) Find(gid discord.GuildID, msg string) []*Ping

Find checks for any pings that match the given string and returns them.

func (*Cache) Update

func (c *Cache) Update(gid discord.GuildID, id int, newPattern string) error

Update updates a ping's internal regexp.

type Ping

type Ping struct {
	ID      int
	Pattern *regexp.Regexp
	UserID  discord.UserID
}

Ping represents a user-defined ping.

func New

func New(id int, uid discord.UserID, pattern string) (*Ping, error)

New creates a new ping.

func (*Ping) Matches

func (p *Ping) Matches(msg string) bool

Matches tests if a string matches a ping.

Jump to

Keyboard shortcuts

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