booo, booooooo!

This commit is contained in:
Aaron Bieber 2020-06-11 16:50:13 -06:00
parent 9508a17831
commit c0e6b28c58
3 changed files with 22 additions and 2 deletions

View File

@ -9,7 +9,7 @@
|Beer|`(?i)^beer: `|Queries [OpenDataSoft](https://public-us.opendatasoft.com/explore/dataset/open-beer-database/table/)'s beer database for a given beer.|
|BotSnack|`(?i)botsnack`|Consumes a botsnack. This pleases mcchunkie and brings balance to the universe.|
|Covid|`(?i)^covid: (.+)$`|Queries [thebigboard.cc](http://www.thebigboard.cc)'s api for information on COVID-19.|
|Feder|`(?i)^feder: (.*)$`|check the Matrix federation status of a given URL.|
|Feder|`(?i)^(?:feder: |tayshame: )(.*)$`|check the Matrix federation status of a given URL.|
|Ham|`(?i)^ham: (\w+)$`|queries the FCC's [ULS](https://wireless2.fcc.gov/UlsApp/UlsSearch/searchLicense.jsp) for a given callsign.|
|HighFive|`o/|\\o`|Everyone loves highfives.|
|Hi|`(?i)^hi|hi$`|Friendly bots say hi.|

View File

@ -33,7 +33,7 @@ func (h *Feder) Descr() string {
// Re returns the federation check matching string
func (h *Feder) Re() string {
return `(?i)^feder: (.*)$`
return `(?i)^(?:feder: |tayshame: )(.*)$`
}
func (h *Feder) fix(msg string) string {

View File

@ -0,0 +1,20 @@
package plugins
import (
"testing"
)
func TestFederRE(t *testing.T) {
testStrings := make(map[string]bool)
testStrings["feder: what.com"] = true
testStrings["tayshame: what.com"] = true
testStrings["feder:what"] = false
testStrings["tayshame:what"] = false
h := &Feder{}
for msg, should := range testStrings {
if h.Match("", msg) != should {
t.Errorf("HighFive expected to match %q (%t); but doesn't\n", msg, should)
}
}
}