plugins/meme.go (view raw)
1package plugins
2
3import (
4 "encoding/base64"
5 "fmt"
6 "math/rand"
7 "strings"
8 "time"
9
10 "gopkg.in/irc.v3"
11)
12
13func init() {
14 Register(Meme{})
15}
16
17type Meme struct{}
18
19var n []byte
20
21func (Meme) Triggers() []string {
22 n, _ = base64.StdEncoding.DecodeString("bmlnZ2Vy")
23 return []string{"." + string(n), ".kiss"}
24}
25
26func (Meme) Execute(m *irc.Message) (string, error) {
27 parts := strings.SplitN(m.Trailing(), " ", 2)
28 trigger := parts[0]
29 var target string
30 if len(parts) > 1 {
31 target = parts[1]
32 } else {
33 target = m.Prefix.Name
34 }
35
36 switch trigger {
37 case "." + string(n):
38 // lol
39 if m.Prefix.Name == "IRSSucks" {
40 target = "IRSSucks"
41 }
42 return fmt.Sprintf("%s is a %s", target, string(n)), nil
43 case ".kiss", ".love":
44 rand.Seed(time.Now().Unix())
45 kaomoji := []string{
46 "(●´□`)", "(。・ω・。)ノ", "(。’▽’。)",
47 "(ෆ ͒•∘̬• ͒)◞", "( •ॢ◡-ॢ)-", "⁽⁽ପ( •ु﹃ •ु).⑅*",
48 "(๑ Ỡ ◡͐ Ỡ๑)ノ", "◟(◔ั₀◔ั )◞ ༘",
49 }
50 return fmt.Sprintf(
51 "%s \x02\x034 。。・゜゜・。。・❤️ %s ❤️ \x03\x02",
52 kaomoji[rand.Intn(len(kaomoji))],
53 target,
54 ), nil
55 }
56 return "", nil
57}