Add proper cycki plugin.
parent
57280448c2
commit
32e7422459
13
bot/cycki.go
13
bot/cycki.go
|
@ -6,13 +6,14 @@ package bot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/arachnist/gorepost/irc"
|
"github.com/arachnist/gorepost/irc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var stripCycki *regexp.Regexp
|
||||||
|
|
||||||
func cycki(output chan irc.Message, msg irc.Message) {
|
func cycki(output chan irc.Message, msg irc.Message) {
|
||||||
var rmsg string
|
var rmsg string
|
||||||
|
|
||||||
|
@ -20,17 +21,17 @@ func cycki(output chan irc.Message, msg irc.Message) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
img, err := httpGetXpath("http://www.bonjourmadame.fr/page/"+string(rand.Intn(2370)+1), "//div[@class='photo post']//img/@src")
|
img, err := httpGetXpath("http://oboobs.ru/random/", "//img/@src")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rmsg = fmt.Sprint("error:", err)
|
rmsg = fmt.Sprint("error:", err)
|
||||||
} else {
|
} else {
|
||||||
rmsg = "bonjour (nsfw): " + img
|
rmsg = "bonjour (nsfw): " + string(stripCycki.ReplaceAll([]byte(img), []byte("")))
|
||||||
}
|
}
|
||||||
|
|
||||||
output <- reply(msg, rmsg)
|
output <- reply(msg, rmsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rand.Seed(time.Now().UnixNano())
|
stripCycki, _ = regexp.Compile("_preview")
|
||||||
addCallback("PRIVMSG", "bonjour", cycki)
|
addCallback("PRIVMSG", "cycki", cycki)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue