goMuffin/handler/messageCreate.go

26 lines
548 B
Go
Raw Normal View History

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