Milen/commands/macro.go

31 lines
565 B
Go

package commands
import (
"strings"
"github.com/bwmarrin/discordgo"
"gitea.teamortix.com/chanbakjsd/Milen/util"
)
var (
CommonReplacement map[string]string
Macro map[string]string
)
func handleMacro(dg *discordgo.Session, m *discordgo.MessageCreate, split []string) {
for k := range split {
split[k] = strings.ToLower(split[k])
if val, ok := CommonReplacement[split[k]]; ok {
split[k] = val
}
}
full := strings.Join(split, " ")
for k, v := range Macro {
if k == full {
util.SendMessage(dg, m.ChannelID, v)
return
}
}
}