44 lines
899 B
Go
44 lines
899 B
Go
package discord
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func init() {
|
|
commands["insult"] = command{
|
|
validate: func(cmd commandInit) bool {
|
|
return true
|
|
},
|
|
run: func(cmd commandInit) (string, error) {
|
|
if !memeRateLimit.Try() {
|
|
return "", nil
|
|
}
|
|
|
|
fields := strings.Fields(cmd.message.Content)
|
|
|
|
var target string
|
|
if len(fields) > 1 {
|
|
target = strings.Join(fields[1:], " ")
|
|
} else if cmd.message.Member.Nick != "" {
|
|
target = cmd.message.Member.Nick
|
|
} else {
|
|
target = cmd.message.Author.Username
|
|
}
|
|
|
|
insult := fmt.Sprintf("%s, your %s looks like %s, you %s %s.",
|
|
target,
|
|
random(cmd.config.Insult.Targets),
|
|
random(cmd.config.Insult.Comparisons),
|
|
random(cmd.config.Insult.Adjectives),
|
|
random(cmd.config.Insult.Nouns),
|
|
)
|
|
|
|
sendMessage(cmd.session, cmd.message.ChannelID, insult, true)
|
|
|
|
return "", nil
|
|
},
|
|
help: "Insult someone!",
|
|
}
|
|
}
|