plugins/meme.go (view raw)
1package plugins
2
3import (
4 "encoding/base64"
5 "fmt"
6 "strings"
7
8 "gopkg.in/irc.v3"
9)
10
11func init() {
12 Register(Meme{})
13}
14
15type Meme struct{}
16
17var n []byte
18
19func (Meme) Triggers() []string {
20 n, _ = base64.StdEncoding.DecodeString("bmlnZ2Vy")
21 return []string{"." + string(n)}
22}
23
24func (Meme) Execute(m *irc.Message) (string, error) {
25 parts := strings.SplitN(m.Trailing(), " ", 2)
26 trigger := parts[0]
27 var target string
28 if len(parts) > 1 {
29 target = parts[1]
30 } else {
31 target = m.Prefix.Name
32 }
33
34 switch trigger {
35 case "." + string(n):
36 // lol
37 if m.Prefix.Name == "IRSSucks" {
38 target = "IRSSucks"
39 }
40 return fmt.Sprintf("%s is a %s", target, string(n)), nil
41 }
42 return "", nil
43}