all repos — paprika @ 1c96c905b5831dd23c6664c2df92722ec9840865

go rewrite of taigabot

Initial meme plugin

With some clever "obfuscation".
Anirudh Oppiliappan x@icyphox.sh
Thu, 30 Dec 2021 17:54:36 +0530
commit

1c96c905b5831dd23c6664c2df92722ec9840865

parent

1fb89eade8189decfa4977aa0c55a8a79e0d01fa

1 files changed, 43 insertions(+), 0 deletions(-)

jump to
A plugins/meme.go

@@ -0,0 +1,43 @@

+package plugins + +import ( + "encoding/base64" + "fmt" + "strings" + + "gopkg.in/irc.v3" +) + +func init() { + Register(Meme{}) +} + +type Meme struct{} + +var n []byte + +func (Meme) Triggers() []string { + n, _ = base64.StdEncoding.DecodeString("bmlnZ2Vy") + return []string{"." + string(n)} +} + +func (Meme) Execute(m *irc.Message) (string, error) { + parts := strings.SplitN(m.Trailing(), " ", 2) + trigger := parts[0] + var target string + if len(parts) > 1 { + target = parts[1] + } else { + target = m.Prefix.Name + } + + switch trigger { + case "." + string(n): + // lol + if m.Prefix.Name == "IRSSucks" { + target = "IRSSucks" + } + return fmt.Sprintf("%s is a %s", target, string(n)), nil + } + return "", nil +}