aboutsummaryrefslogtreecommitdiff
path: root/extramemes.go
blob: fb2f8f6a075124d57ddc166a40fd59c191db20a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package thulani

import (
	"math/rand"
	"regexp"
	"strings"
	"time"
)

func init() {
	rand.Seed(time.Now().UnixNano())
}

var extraMemes = []func(*messageCtx) MemeStatus{
	respondToFuckYou,
	respondToMeme,
	respondToRaaaaaaaaaaaay,
}

var hateMatch = []string{
	"suck",
	"fuck",
	"trash",
	"garbage",
	"stupid",
	"shit",
	"dick",
	"bitch",
	"hate",
}

var responses = []string{
	"WELL FUCK YOU TOO YOU PIECE OF SHIT",
	"**i'll fucking burst ye**",
	"memememexexxxxxxxxxxxwerp",
	"thulando madondo",
	"you are a memerman",
}

type MemeStatus int

const (
	Continue MemeStatus = iota
	Interrupt
)

func respondToFuckYou(ctx *messageCtx) (result MemeStatus) {
	result = Continue
	content := strings.ToLower(ctx.Message.Content)

	if !strings.Contains(content, config.Trigger) {
		return
	}

	for _, v := range hateMatch {
		if strings.Contains(content, strings.ToLower(v)) {
			response := responses[rand.Intn(len(responses))]

			ctx.sendMessage(response, true)
			return
		}
	}

	return
}

func respondToMeme(ctx *messageCtx) MemeStatus {
	if !(ctx.Matched && ctx.Command == "meme") {
		return Continue
	}

	ctx.sendMessage("i am not yet capable of memeing.", false)
	return Interrupt
}

var ray = regexp.MustCompile("ra+y")

// TODO: play the sound clip
func respondToRaaaaaaaaaaaay(ctx *messageCtx) MemeStatus {
	if ctx.Matched && ray.MatchString(ctx.Command) {
		ctx.sendMessage(ctx.Command, true)
		return Interrupt
	}

	return Continue
}