2020-07-02 20:00:22 +00:00
|
|
|
package discord
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2021-02-23 05:53:55 +00:00
|
|
|
commands = append(commands, &command{
|
|
|
|
name: "insult",
|
2020-07-02 20:00:22 +00:00
|
|
|
validate: func(cmd commandInit) bool {
|
|
|
|
return true
|
|
|
|
},
|
|
|
|
run: func(cmd commandInit) (string, error) {
|
|
|
|
if !memeRateLimit.Try() {
|
2020-07-02 21:33:47 +00:00
|
|
|
return "", nil
|
2020-07-02 20:00:22 +00:00
|
|
|
}
|
|
|
|
|
2020-07-02 20:43:43 +00:00
|
|
|
fields := strings.Fields(cmd.message.Content)
|
2020-07-02 20:00:22 +00:00
|
|
|
|
|
|
|
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),
|
|
|
|
)
|
2020-07-02 20:43:43 +00:00
|
|
|
|
|
|
|
sendMessage(cmd.session, cmd.message.ChannelID, insult, true)
|
|
|
|
|
|
|
|
return "", nil
|
2020-07-02 20:00:22 +00:00
|
|
|
},
|
|
|
|
help: "Insult someone!",
|
2021-02-23 05:53:55 +00:00
|
|
|
})
|
2020-07-02 20:00:22 +00:00
|
|
|
}
|