feat: Implement macros
parent
f531877521
commit
11fed61073
@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue