goMuffin/handler/messageCreate.go

26 lines
542 B
Go
Raw Permalink Normal View History

2024-08-01 11:37:18 +00:00
package handler
import (
2024-08-17 07:54:14 +00:00
"strings"
2024-08-01 11:37:18 +00:00
"github.com/bwmarrin/discordgo"
2024-10-09 13:11:03 +00:00
"gitlab.wh64.net/muffin/goMuffin/configs"
2024-08-01 11:37:18 +00:00
)
2024-08-17 07:54:14 +00:00
// MessageCreate is handlers of messageCreate event
2024-08-01 11:37:18 +00:00
func MessageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
2024-10-09 12:08:17 +00:00
config := configs.Config
2024-08-01 11:37:18 +00:00
if m.Author.ID == s.State.User.ID && m.Author.Bot {
return
}
2024-10-09 12:08:17 +00:00
if strings.HasPrefix(m.Content, config.Prefix) {
content := strings.TrimPrefix(m.Content, config.Prefix)
2024-08-17 07:54:14 +00:00
if content == "안녕" {
s.ChannelMessageSend(m.ChannelID, "안녕")
}
} else {
return
2024-08-01 11:37:18 +00:00
}
}