plugins

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: ISC Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NameRE = regexp.MustCompile(`@(.+):.+$`)

NameRE matches the "friendly" name. This is typically used in tab completion.

View Source
var Plugs = Plugins{
	&Ban{},
	&BananaStab{},
	&Beat{},
	&Beer{},
	&BotSnack{},
	&DMR{},
	&Feder{},
	&Groan{},
	&Ham{},
	&Hi{},
	&HighFive{},
	&Homestead{},
	&LoveYou{},
	&OpenBSDMan{},
	&Palette{},
	&PGP{},
	&RFC{},
	&Salute{},
	&Snap{},
	&Songwhip{},
	&Source{},
	&Thanks{},
	&Toki{},
	&Version{},
	&Wb{},
	&Weather{},
	&Yeah{},
}

Plugs defines the "enabled" plugins.

View Source
var TokiLang = map[string][]Toki{}/* 239 elements not displayed */

TokiLang is our full representation of toki pona

Functions

func RemoveName

func RemoveName(user, message string) string

RemoveName removes the friendly name from a given message

func SendEmote added in v1.0.6

func SendEmote(c *gomatrix.Client, roomID, message string) error

SendEmote sends an emote to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func SendHTML

func SendHTML(c *gomatrix.Client, roomID, message string) error

SendHTML sends an html message to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func SendImage

func SendImage(c *gomatrix.Client, roomID string, img *image.RGBA) error

SendImage takes an image and sends it!.

func SendMD

func SendMD(c *gomatrix.Client, roomID, message string) error

SendMD takes markdown and converts it to an html message.

func SendMDNotice

func SendMDNotice(c *gomatrix.Client, roomID, message string) error

SendMDNotice sends an html notice to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func SendNotice

func SendNotice(c *gomatrix.Client, roomID, message string) error

SendNotice sends an text notice to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func SendText

func SendText(c *gomatrix.Client, roomID, message string) error

SendText sends a text message to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func SendUnescNotice added in v1.0.5

func SendUnescNotice(c *gomatrix.Client, roomID, message string) error

SendUnescNotice sends an text notice to a given room. It pretends to be "typing" by calling UserTyping for the caller.

func ToMe

func ToMe(user, message string) bool

ToMe returns true of the message pertains to the bot

Types

type Ban added in v1.0.6

type Ban struct {
}

Ban responds to ban messages

func (*Ban) Descr added in v1.0.6

func (h *Ban) Descr() string

Descr returns a description

func (*Ban) Match added in v1.0.6

func (h *Ban) Match(_, msg string) bool

Match determines if we should execute Ban

func (*Ban) Name added in v1.0.6

func (h *Ban) Name() string

Name Ban

func (*Ban) Process added in v1.0.6

func (h *Ban) Process(from, msg string) string

Process does the heavy lifting

func (*Ban) Re added in v1.0.6

func (h *Ban) Re() string

Re matches "ban:" in a given string

func (*Ban) RespondText added in v1.0.6

func (h *Ban) RespondText(c *gomatrix.Client, ev *gomatrix.Event, user, post string) error

RespondText to botsnack events

func (*Ban) SetStore added in v1.0.6

func (h *Ban) SetStore(_ PluginStore)

SetStore we don't need a store, so just return

type BananaStab added in v1.0.6

type BananaStab struct {
}

func (*BananaStab) Descr added in v1.0.6

func (h *BananaStab) Descr() string

Descr describes this plugin

func (*BananaStab) Match added in v1.0.6

func (h *BananaStab) Match(_, msg string) bool

Match checks for our stabee person

func (*BananaStab) Name added in v1.0.6

func (h *BananaStab) Name() string

Name BananaStab!

func (*BananaStab) Process added in v1.0.6

func (h *BananaStab) Process(from, post string) string

func (*BananaStab) Re added in v1.0.6

func (h *BananaStab) Re() string

Re matches our stabbing format

func (*BananaStab) RespondText added in v1.0.6

func (h *BananaStab) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText stabs an unsuspecting person

func (*BananaStab) SetStore added in v1.0.6

func (h *BananaStab) SetStore(_ PluginStore)

SetStore does nothing in BananaStab

type Beat

type Beat struct {
}

Beat responds to beat messages

func (*Beat) Descr

func (h *Beat) Descr() string

Descr describes this plugin

func (*Beat) Match

func (h *Beat) Match(_, msg string) bool

Match determines if we are asking for a beat

func (*Beat) Name

func (h *Beat) Name() string

Name beat

func (*Beat) Process added in v1.0.5

func (h *Beat) Process(from, msg string) string

Process does the heavy lifting of calculating .beat

func (*Beat) Re

func (h *Beat) Re() string

Re is the regex for matching beat messages.

func (*Beat) RespondText

func (h *Beat) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to beat request events

func (*Beat) SetStore

func (h *Beat) SetStore(_ PluginStore)

SetStore we don't need a store here

type Beer

type Beer struct {
}

Beer responds to beer requests

func (*Beer) Descr

func (h *Beer) Descr() string

Descr describes this plugin

func (*Beer) Match

func (h *Beer) Match(_, msg string) bool

Match determines if we should call the response for Beer

func (*Beer) Name

func (h *Beer) Name() string

Name Beer!

func (*Beer) Process added in v1.0.5

func (h *Beer) Process(from, msg string) string

func (*Beer) Re

func (h *Beer) Re() string

Re returns the beer matching string

func (*Beer) RespondText

func (h *Beer) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of beer requests

func (*Beer) SetStore

func (h *Beer) SetStore(_ PluginStore)

SetStore we don't need a store here.

type BeerResp

type BeerResp struct {
	Nhits      int        `json:"nhits"`
	Parameters Parameters `json:"parameters"`
	Records    []Records  `json:"records"`
}

BeerResp represents our response from the api

type BotSnack

type BotSnack struct {
}

BotSnack responds to botsnack messages

func (*BotSnack) Descr

func (h *BotSnack) Descr() string

Descr returns a description

func (*BotSnack) Match

func (h *BotSnack) Match(_, msg string) bool

Match determines if we should execute BotSnack

func (*BotSnack) Name

func (h *BotSnack) Name() string

Name BotSnack

func (*BotSnack) Process added in v1.0.5

func (h *BotSnack) Process(from, msg string) string

Process does the heavy lifting

func (*BotSnack) Re

func (h *BotSnack) Re() string

Re matches "botsnack" in a given string

func (*BotSnack) RespondText

func (h *BotSnack) RespondText(c *gomatrix.Client, ev *gomatrix.Event, user, post string) error

RespondText to botsnack events

func (*BotSnack) SetStore

func (h *BotSnack) SetStore(_ PluginStore)

SetStore we don't need a store, so just return

type CloudsResp

type CloudsResp struct {
	All int `json:"all"`
}

CloudsResp ?

type CoordResp

type CoordResp struct {
	Lon float64 `json:"lon"`
	Lat float64 `json:"lat"`
}

CoordResp is the log/lat of the location queried

type DMR

type DMR struct {
}

DMR is our plugin type

func (*DMR) Descr

func (p *DMR) Descr() string

Descr describes this plugin

func (*DMR) Match

func (p *DMR) Match(_, msg string) bool

Match checks for "dmr " messages

func (*DMR) Name

func (p *DMR) Name() string

Name DMR!

func (*DMR) Process added in v1.0.5

func (p *DMR) Process(from, post string) string

func (*DMR) Re

func (p *DMR) Re() string

Re is what our dmr request matches

func (*DMR) RespondText

func (p *DMR) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of DMR info

func (*DMR) SetStore

func (p *DMR) SetStore(s PluginStore)

SetStore is the setup function for a plugin

type DMRRepeater

type DMRRepeater struct {
	Count   int `json:"count"`
	Results []struct {
		Callsign    string `json:"callsign"`
		City        string `json:"city"`
		ColorCode   int    `json:"color_code"`
		Country     string `json:"country"`
		Details     string `json:"details"`
		Frequency   string `json:"frequency"`
		ID          string `json:"id"`
		IpscNetwork string `json:"ipsc_network"`
		Offset      string `json:"offset"`
		Rfinder     string `json:"rfinder"`
		State       string `json:"state"`
		Trustee     string `json:"trustee"`
		TsLinked    string `json:"ts_linked"`
	} `json:"results"`
}

DMRRepeater represents a response from: https://database.radioid.net/api/dmr/repeater/

type DMRUser

type DMRUser struct {
	Count   int `json:"count"`
	Results []struct {
		Callsign string `json:"callsign"`
		City     string `json:"city"`
		Country  string `json:"country"`
		Fname    string `json:"fname"`
		ID       int    `json:"id"`
		Remarks  string `json:"remarks"`
		State    string `json:"state"`
		Surname  string `json:"surname"`
	} `json:"results"`
}

DMRUser represents a response from: https://database.radioid.net/api/dmr/user/

type FedResp

type FedResp struct {
	Status bool        `json:"FederationOK"`
	Info   ServiceInfo `json:"Version"`
}

FedResp represents a federation statuse response

type Feder

type Feder struct {
}

Feder responds to federation check requests

func (*Feder) Descr

func (h *Feder) Descr() string

Descr describes this plugin

func (*Feder) Match

func (h *Feder) Match(_, msg string) bool

Match determines if we should call the response for Feder

func (*Feder) Name

func (h *Feder) Name() string

Name Feder!

func (*Feder) Process added in v1.0.5

func (h *Feder) Process(from, post string) string

func (*Feder) Re

func (h *Feder) Re() string

Re returns the federation check matching string

func (*Feder) RespondText

func (h *Feder) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of federation check requests

func (*Feder) SetStore

func (h *Feder) SetStore(_ PluginStore)

SetStore we don't need a store here.

type FeelsResp

type FeelsResp struct {
	ID          int    `json:"id"`
	Main        string `json:"main"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
}

FeelsResp represents the friendly info like "light rain"

type Fields

type Fields struct {
	Website       string    `json:"website"`
	City          string    `json:"city"`
	StyleID       string    `json:"style_id"`
	Name          string    `json:"name"`
	Country       string    `json:"country"`
	CatID         string    `json:"cat_id"`
	BreweryID     string    `json:"brewery_id"`
	Descript      string    `json:"descript"`
	Upc           int       `json:"upc"`
	Coordinates   []float64 `json:"coordinates"`
	Ibu           int       `json:"ibu"`
	CatName       string    `json:"cat_name"`
	LastMod       time.Time `json:"last_mod"`
	State         string    `json:"state"`
	StyleName     string    `json:"style_name"`
	Abv           float64   `json:"abv"`
	Address1      string    `json:"address1"`
	NameBreweries string    `json:"name_breweries"`
	Srm           int       `json:"srm"`
	ID            string    `json:"id"`
	AddUser       string    `json:"add_user"`
}

Fields are the bits of info we care about

type Geometry

type Geometry struct {
	Type        string    `json:"type"`
	Coordinates []float64 `json:"coordinates"`
}

Geometry is basically useless

type Groan

type Groan struct {
}

Groan responds to groans.

func (*Groan) Descr

func (h *Groan) Descr() string

Descr describes this plugin

func (*Groan) Match

func (h *Groan) Match(user, msg string) bool

Match determines if we should bother groaning

func (*Groan) Name

func (h *Groan) Name() string

Name returns the name of the Groan plugin

func (*Groan) Process added in v1.0.5

func (h *Groan) Process(_, _ string) string

func (*Groan) Re

func (h *Groan) Re() string

Re are the regexes that high five uses

func (*Groan) RespondText

func (h *Groan) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to groan events

func (*Groan) SetStore

func (h *Groan) SetStore(_ PluginStore)

SetStore we don't need a store here.

type HTTPRequest

type HTTPRequest struct {
	Client  http.Client
	Request *http.Request
	Timeout time.Duration
	URL     string
	Method  string
	ReqBody interface{}
	ResBody interface{}
}

HTTPRequest has the bits for making http requests

func (*HTTPRequest) DoJSON

func (h *HTTPRequest) DoJSON() (err error)

DoJSON is a general purpose http mechanic that can be used to get, post.. what evs. The response is always expected to be json

type Ham

type Ham struct{}

Ham for querying the fcc'd uls

func (*Ham) Descr

func (h *Ham) Descr() string

Descr describes this plugin

func (*Ham) Match

func (h *Ham) Match(_, msg string) bool

Match determines if we should call the response for Ham

func (*Ham) Name

func (h *Ham) Name() string

Name Ham!

func (*Ham) Process added in v1.0.5

func (h *Ham) Process(from, post string) string

Process does the heavy lifting

func (*Ham) Re

func (h *Ham) Re() string

Re returns the federation check matching string

func (*Ham) RespondText

func (h *Ham) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of federation check requests

func (*Ham) SetStore

func (h *Ham) SetStore(_ PluginStore)

SetStore we don't need a store here.

type Hi

type Hi struct {
}

Hi responds to hi messages

func (*Hi) Descr

func (h *Hi) Descr() string

Descr describes this plugin

func (*Hi) Match

func (h *Hi) Match(user, msg string) bool

Match determines if we are highfiving

func (*Hi) Name

func (h *Hi) Name() string

Name hi

func (*Hi) Process added in v1.0.5

func (h *Hi) Process(from, post string) string

Process does the lifting

func (*Hi) Re

func (h *Hi) Re() string

Re is the regex for matching hi messages.

func (*Hi) RespondText

func (h *Hi) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to hi events

func (*Hi) SetStore

func (h *Hi) SetStore(_ PluginStore)

SetStore we don't need a store here

type HighFive

type HighFive struct {
}

HighFive high fives!

func (*HighFive) Descr

func (h *HighFive) Descr() string

Descr describes this plugin

func (*HighFive) Match

func (h *HighFive) Match(user, msg string) bool

Match determines if we should bother giving a high five

func (*HighFive) Name

func (h *HighFive) Name() string

Name returns the name of the HighFive plugin

func (*HighFive) Process added in v1.0.5

func (h *HighFive) Process(from, post string) string

func (*HighFive) Re

func (h *HighFive) Re() string

Re are the regexes that high five uses

func (*HighFive) RespondText

func (h *HighFive) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to high five events

func (*HighFive) SetStore

func (h *HighFive) SetStore(_ PluginStore)

SetStore we don't need a store here.

type Homestead added in v1.0.5

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

Homestead is our plugin type

func (*Homestead) Descr added in v1.0.5

func (h *Homestead) Descr() string

Descr describes this plugin

func (*Homestead) Match added in v1.0.5

func (h *Homestead) Match(_, msg string) bool

Match checks for "home: name?" messages

func (*Homestead) Name added in v1.0.5

func (h *Homestead) Name() string

Name Homestead!

func (*Homestead) Process added in v1.0.5

func (h *Homestead) Process(from, post string) string

func (*Homestead) Re added in v1.0.5

func (h *Homestead) Re() string

Re is what our weather matches

func (*Homestead) RespondText added in v1.0.5

func (h *Homestead) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of weather lookup requests

func (*Homestead) SetStore added in v1.0.5

func (h *Homestead) SetStore(s PluginStore)

SetStore is the setup function for a plugin

type HomesteadResp added in v1.0.5

type HomesteadResp struct {
	Status string `json:"status"`
	Data   struct {
		Resulttype string `json:"resultType"`
		Result     []struct {
			Metric struct {
				Instance string `json:"instance"`
				Job      string `json:"job"`
				Name     string `json:"name"`
			} `json:"metric"`
			Value []interface{} `json:"value"`
		} `json:"result"`
	} `json:"data"`
}

HomesteadResp is the json returned from our api

type LicenseResp

type LicenseResp struct {
	Hamdb struct {
		Version  string `json:"version"`
		Callsign struct {
			Call    string `json:"call"`
			Class   string `json:"class"`
			Expires string `json:"expires"`
			Status  string `json:"status"`
			Grid    string `json:"grid"`
			Lat     string `json:"lat"`
			Lon     string `json:"lon"`
			Fname   string `json:"fname"`
			Mi      string `json:"mi"`
			Name    string `json:"name"`
			Suffix  string `json:"suffix"`
			Addr1   string `json:"addr1"`
			Addr2   string `json:"addr2"`
			State   string `json:"state"`
			Zip     string `json:"zip"`
			Country string `json:"country"`
		} `json:"callsign"`
		Messages struct {
			Status string `json:"status"`
		} `json:"messages"`
	} `json:"hamdb"`
}

LicenseResp represents a response from http://hamdb.org/api

type LoveYou

type LoveYou struct {
}

LoveYou responds to love messages

func (*LoveYou) Descr

func (h *LoveYou) Descr() string

Descr describes this plugin

func (*LoveYou) Match

func (h *LoveYou) Match(user, msg string) bool

Match checks for 'i love you' and a reference to the bot name

func (*LoveYou) Name

func (h *LoveYou) Name() string

Name i love you

func (*LoveYou) Process added in v1.0.5

func (h *LoveYou) Process(from, post string) string

Process does the heavy lifting

func (*LoveYou) Re

func (h *LoveYou) Re() string

Re matches "i love you"

func (*LoveYou) RespondText

func (h *LoveYou) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to love events

func (*LoveYou) SetStore

func (h *LoveYou) SetStore(_ PluginStore)

SetStore we don't need a store, so just return

type MainResp

type MainResp struct {
	Temp     float64 `json:"temp"`
	Pressure int     `json:"pressure"`
	Humidity int     `json:"humidity"`
	TempMin  float64 `json:"temp_min"`
	TempMax  float64 `json:"temp_max"`
}

MainResp contains the bulk of the weather data

type OpenBSDMan

type OpenBSDMan struct {
}

OpenBSDMan responds to beer requests

func (*OpenBSDMan) Descr

func (h *OpenBSDMan) Descr() string

Descr describes this plugin

func (*OpenBSDMan) Match

func (h *OpenBSDMan) Match(_, msg string) bool

Match checks for our man page re

func (*OpenBSDMan) Name

func (h *OpenBSDMan) Name() string

Name OpenBSDMan!

func (*OpenBSDMan) Process added in v1.0.5

func (h *OpenBSDMan) Process(from, post string) string

func (*OpenBSDMan) Re

func (h *OpenBSDMan) Re() string

Re matches our man format

func (*OpenBSDMan) RespondText

func (h *OpenBSDMan) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText sends back a man page.

func (*OpenBSDMan) SetStore

func (h *OpenBSDMan) SetStore(_ PluginStore)

SetStore does nothing in OpenBSDMan

type PGP

type PGP struct {
}

PGP is our plugin type

func (*PGP) Descr

func (p *PGP) Descr() string

Descr describes this plugin

func (*PGP) Match

func (p *PGP) Match(_, msg string) bool

Match checks for "pgp: " messages

func (*PGP) Name

func (p *PGP) Name() string

Name PGP!

func (*PGP) Process added in v1.0.5

func (p *PGP) Process(from, post string) string

func (*PGP) Re

func (p *PGP) Re() string

Re is what our pgp request matches

func (*PGP) RespondText

func (p *PGP) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of PGP info

func (*PGP) SetStore

func (p *PGP) SetStore(s PluginStore)

SetStore is the setup function for a plugin

type Palette

type Palette struct {
}

Palette responds to color messages

func (*Palette) Descr

func (h *Palette) Descr() string

Descr describes this plugin

func (*Palette) Match

func (h *Palette) Match(_, msg string) bool

Match determines if we are asking for a color

func (*Palette) Name

func (h *Palette) Name() string

Name color

func (*Palette) Process added in v1.0.5

func (h *Palette) Process(_, _ string) string

func (*Palette) Re

func (h *Palette) Re() string

Re is the regex for matching color messages.

func (*Palette) RespondText

func (h *Palette) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to color request events

func (*Palette) SetStore

func (h *Palette) SetStore(_ PluginStore)

SetStore we don't need a store here

type Parameters

type Parameters struct {
	Dataset  []string `json:"dataset"`
	Timezone string   `json:"timezone"`
	Q        string   `json:"q"`
	Rows     int      `json:"rows"`
	Format   string   `json:"format"`
}

Parameters are the meta information

type Plugin

type Plugin interface {
	// Descr returns a brief description of the plugin.
	Descr() string

	// Match determines if the plugin's main Respond function should be
	// called
	Match(user, message string) bool

	// Name should return the human readable name of the bot
	Name() string

	// Re returns the regular expression that a plugin uses to "match"
	Re() string

	// RespondMatrix responds to a Matrix "m.text" event
	RespondText(c *gomatrix.Client, ev *gomatrix.Event, user, path string) error

	// Process is the processed response from the plugin. This is useful for
	// running the plugins outside of the context of Matrix.
	Process(from, message string) string

	// SetStore exposes the top level MCStore to a plugin
	SetStore(s PluginStore)
}

Plugin defines the interface a plugin must implement to be used by mcchunkie.

type PluginStore

type PluginStore interface {
	Set(key, values string)
	Get(key string) (string, error)
}

PluginStore matches MCStore. This allows the main store to be used by plugins.

type Plugins

type Plugins []Plugin

Plugins is a collection of our plugins. An instance of this is iterated over for each message the bot receives.

type RFC

type RFC struct {
}

RFC sends rfc urls when someone references an rfc

func (*RFC) Descr

func (h *RFC) Descr() string

Descr describes this plugin

func (*RFC) Match

func (h *RFC) Match(_, msg string) bool

Match checks for our man page re

func (*RFC) Name

func (h *RFC) Name() string

Name RFC

func (*RFC) Process added in v1.0.5

func (h *RFC) Process(from, post string) string

Process does the heavy lifting

func (*RFC) Re

func (h *RFC) Re() string

Re matches our man format

func (*RFC) RespondText

func (h *RFC) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText sends back a man page.

func (*RFC) SetStore

func (h *RFC) SetStore(_ PluginStore)

SetStore does nothing in RFC

type Records

type Records struct {
	Datasetid       string    `json:"datasetid"`
	Recordid        string    `json:"recordid"`
	Fields          Fields    `json:"fields"`
	Geometry        Geometry  `json:"geometry"`
	RecordTimestamp time.Time `json:"record_timestamp"`
}

Records holds our fileds

type Salute added in v1.0.6

type Salute struct {
}

Salute high fives!

func (*Salute) Descr added in v1.0.6

func (h *Salute) Descr() string

Descr describes this plugin

func (*Salute) Match added in v1.0.6

func (h *Salute) Match(user, msg string) bool

Match determines if we should bother giving a salute

func (*Salute) Name added in v1.0.6

func (h *Salute) Name() string

Name returns the name of the Salute plugin

func (*Salute) Process added in v1.0.6

func (h *Salute) Process(from, post string) string

func (*Salute) Re added in v1.0.6

func (h *Salute) Re() string

Re are the regexes that high five uses

func (*Salute) RespondText added in v1.0.6

func (h *Salute) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to high five events

func (*Salute) SetStore added in v1.0.6

func (h *Salute) SetStore(_ PluginStore)

SetStore we don't need a store here.

type ServiceInfo

type ServiceInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Error   string `json:"error"`
}

ServiceInfo represents the version info from a response

type Snap

type Snap struct {
}

Snap responds to OpenBSD snapshot checks

func (*Snap) Descr

func (p *Snap) Descr() string

Descr describes this plugin

func (*Snap) Match

func (p *Snap) Match(_, msg string) bool

Match determines if we should call the response for Snap

func (*Snap) Name

func (p *Snap) Name() string

Name Snap!

func (*Snap) Process added in v1.0.5

func (p *Snap) Process(from, post string) string

Process does the heavy lifting

func (*Snap) Re

func (p *Snap) Re() string

Re returns the federation check matching string

func (*Snap) RespondText

func (p *Snap) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to looking up of federation check requests

func (*Snap) SetStore

func (p *Snap) SetStore(_ PluginStore)

SetStore we don't need a store here.

type Songwhip added in v1.0.9

type Songwhip struct{}

func (*Songwhip) Descr added in v1.0.9

func (s *Songwhip) Descr() string

Descr describes this plugin

func (*Songwhip) Match added in v1.0.9

func (s *Songwhip) Match(_, msg string) bool

Match determines if we should call the response for Songwhip

func (*Songwhip) Name added in v1.0.9

func (s *Songwhip) Name() string

Name Songwhip!

func (*Songwhip) Process added in v1.0.9

func (s *Songwhip) Process(from, post string) string

func (*Songwhip) Re added in v1.0.9

func (s *Songwhip) Re() string

Re returns the federation check matching string

func (*Songwhip) RespondText added in v1.0.9

func (s *Songwhip) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of federation check requests

func (*Songwhip) SetStore added in v1.0.9

func (s *Songwhip) SetStore(_ PluginStore)

SetStore we don't need a store here.

type SongwhipReq added in v1.0.9

type SongwhipReq struct {
	URL string `json:"url"`
}

type SongwhipResp added in v1.0.9

type SongwhipResp struct {
	Type     string `json:"type"`
	ID       int    `json:"id"`
	Path     string `json:"path"`
	PagePath string `json:"pagePath"`
	Name     string `json:"name"`
	Image    string `json:"image"`
	Links    struct {
		Qobuz        bool `json:"qobuz"`
		Tidal        bool `json:"tidal"`
		Amazon       bool `json:"amazon"`
		Deezer       bool `json:"deezer"`
		Itunes       bool `json:"itunes"`
		Discogs      bool `json:"discogs"`
		Napster      bool `json:"napster"`
		Pandora      bool `json:"pandora"`
		Spotify      bool `json:"spotify"`
		Twitter      bool `json:"twitter"`
		Youtube      bool `json:"youtube"`
		Bandcamp     bool `json:"bandcamp"`
		Facebook     bool `json:"facebook"`
		Audiomack    bool `json:"audiomack"`
		Instagram    bool `json:"instagram"`
		LineMusic    bool `json:"lineMusic"`
		Soundcloud   bool `json:"soundcloud"`
		AmazonMusic  bool `json:"amazonMusic"`
		ItunesStore  bool `json:"itunesStore"`
		MusicBrainz  bool `json:"musicBrainz"`
		YoutubeMusic bool `json:"youtubeMusic"`
	} `json:"links"`
	Description          interface{} `json:"description"`
	LinksCountries       []string    `json:"linksCountries"`
	SourceCountry        string      `json:"sourceCountry"`
	SpotifyID            string      `json:"spotifyId"`
	CreatedAtTimestamp   int64       `json:"createdAtTimestamp"`
	RefreshedAtTimestamp int64       `json:"refreshedAtTimestamp"`
	URL                  string      `json:"url"`
}

type Source

type Source struct {
}

Source responds to source requests

func (*Source) Descr

func (h *Source) Descr() string

Descr describes this plugin

func (*Source) Match

func (h *Source) Match(user, msg string) bool

Match determines if someone is asking about the source code

func (*Source) Name

func (h *Source) Name() string

Name Source

func (*Source) Process added in v1.0.5

func (h *Source) Process(from, post string) string

Process does the heavy lifting

func (*Source) Re

func (h *Source) Re() string

Re matches the source code question

func (*Source) RespondText

func (h *Source) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to questions about TheSource™©®⑨

func (*Source) SetStore

func (h *Source) SetStore(_ PluginStore)

SetStore does nothing in here

type SysResp

type SysResp struct {
	Type    int     `json:"type"`
	ID      int     `json:"id"`
	Message float64 `json:"message"`
	Country string  `json:"country"`
	Sunrise int     `json:"sunrise"`
	Sunset  int     `json:"sunset"`
}

SysResp seems to be used internally for something

type Thanks

type Thanks struct {
}

Thanks responds to thanks

func (*Thanks) Descr

func (h *Thanks) Descr() string

Descr describes this plugin

func (*Thanks) Match

func (h *Thanks) Match(user, msg string) bool

Match determines if we are being thanked

func (*Thanks) Name

func (h *Thanks) Name() string

Name Thanks

func (*Thanks) Process added in v1.0.5

func (h *Thanks) Process(from, post string) string

Process

func (*Thanks) Re

func (h *Thanks) Re() string

Re checks for various forms of thanks

func (*Thanks) RespondText

func (h *Thanks) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to welcome back events

func (*Thanks) SetStore

func (h *Thanks) SetStore(_ PluginStore)

SetStore we don't need a store here

type Toki

type Toki struct {
	POS          string
	Meanings     []string
	MeaningStems []string
	Alt          string
	Principle    string
}

Toki responds to toki pona word queries

func (*Toki) Descr

func (t *Toki) Descr() string

Descr describes this plugin

func (*Toki) Match

func (t *Toki) Match(_, msg string) bool

Match determines if we are highfiving

func (*Toki) Name

func (t *Toki) Name() string

Name hi

func (*Toki) Print

func (t *Toki) Print(w string) string

Print prints the definition

func (*Toki) Process added in v1.0.5

func (t *Toki) Process(from, post string) string

Process does the heavy lifting

func (*Toki) Re

func (t *Toki) Re() string

Re is the regex for matching hi messages.

func (*Toki) RespondText

func (t *Toki) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to hi events

func (*Toki) SetStore

func (t *Toki) SetStore(_ PluginStore)

SetStore we don't need a store here

func (*Toki) Words

func (t *Toki) Words() []string

Words prints the definition

type Version

type Version struct {
}

Version responds to hi messages

func (*Version) Descr

func (v *Version) Descr() string

Descr describes this plugin

func (*Version) Match

func (v *Version) Match(user, msg string) bool

Match checks for "version" anywhere. Might want to tighten this one down at some point

func (*Version) Name

func (v *Version) Name() string

Name Version

func (*Version) Process added in v1.0.5

func (v *Version) Process(_, _ string) string

Process does the heavy lifting

func (*Version) Re

func (v *Version) Re() string

Re matches version

func (*Version) RespondText

func (v *Version) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to version events

func (*Version) SetStore

func (v *Version) SetStore(_ PluginStore)

SetStore does nothing in here

type Wb

type Wb struct {
}

Wb responds to welcome back messages

func (*Wb) Descr

func (h *Wb) Descr() string

Descr describes this plugin

func (*Wb) Match

func (h *Wb) Match(user, msg string) bool

Match determines if we are welcomed back

func (*Wb) Name

func (h *Wb) Name() string

Name Wb

func (*Wb) Process added in v1.0.5

func (h *Wb) Process(from, post string) string

func (*Wb) Re

func (h *Wb) Re() string

Re checks for various welcome back things

func (*Wb) RespondText

func (h *Wb) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, _ string) error

RespondText to welcome back events

func (*Wb) SetStore

func (h *Wb) SetStore(_ PluginStore)

SetStore we don't need a store here

type Weather

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

Weather is our plugin type

func (*Weather) Descr

func (h *Weather) Descr() string

Descr describes this plugin

func (*Weather) Match

func (h *Weather) Match(_, msg string) bool

Match checks for "weather: " messages

func (*Weather) Name

func (h *Weather) Name() string

Name Weather!

func (*Weather) Process added in v1.0.5

func (h *Weather) Process(from, post string) string

func (*Weather) Re

func (h *Weather) Re() string

Re is what our weather matches

func (*Weather) RespondText

func (h *Weather) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to looking up of weather lookup requests

func (*Weather) SetStore

func (h *Weather) SetStore(s PluginStore)

SetStore is the setup function for a plugin

type WeatherResp

type WeatherResp struct {
	Coord      CoordResp   `json:"coord"`
	Weather    []FeelsResp `json:"weather"`
	Base       string      `json:"base"`
	Main       MainResp    `json:"main"`
	Visibility int         `json:"visibility"`
	Wind       WindResp    `json:"wind"`
	Clouds     CloudsResp  `json:"clouds"`
	Dt         int         `json:"dt"`
	Sys        SysResp     `json:"sys"`
	ID         int         `json:"id"`
	Name       string      `json:"name"`
	Cod        int         `json:"cod"`
}

WeatherResp is a JSON response from OpenWeatherMap.org

type WindResp

type WindResp struct {
	Speed float64 `json:"speed"`
	Deg   int     `json:"deg"`
	Gust  float64 `json:"gust"`
}

WindResp gives us various bits of information about the wind. Direction, etc.

type Yeah added in v1.0.12

type Yeah struct {
}

Yeah puts on the shades

func (*Yeah) Descr added in v1.0.12

func (h *Yeah) Descr() string

Descr describes this plugin

func (*Yeah) Match added in v1.0.12

func (h *Yeah) Match(user, msg string) bool

Match determines if we should bother giving a high five

func (*Yeah) Name added in v1.0.12

func (h *Yeah) Name() string

Name returns the name of the Yeah plugin

func (*Yeah) Process added in v1.0.12

func (h *Yeah) Process(from, post string) string

func (*Yeah) Re added in v1.0.12

func (h *Yeah) Re() string

Re are the regexes that high five uses

func (*Yeah) RespondText added in v1.0.12

func (h *Yeah) RespondText(c *gomatrix.Client, ev *gomatrix.Event, _, post string) error

RespondText to high five events

func (*Yeah) SetStore added in v1.0.12

func (h *Yeah) SetStore(_ PluginStore)

SetStore we don't need a store here.

Jump to

Keyboard shortcuts

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