Files
dcbot/bot/onMessageCreate.go
Yi-Ting Shih cb11672817 Refactor: cleanup
- Introduce tracing
- Introduce cobra / viper framework
- Introduce resty client
- Seperate files in api/ and bot/
- Trim unused functions
2025-12-12 23:51:48 +08:00

24 lines
448 B
Go

package bot
import (
"strings"
"github.com/bwmarrin/discordgo"
)
// Message listener for "ciallo"
func (b *Bot) onMessageCreate(
s *discordgo.Session,
m *discordgo.MessageCreate,
) {
// Ignore messages from the bot itself
if m.Author.ID == s.State.User.ID {
return
}
// Check if message is "ciallo" (case insensitive)
if strings.ToLower(strings.TrimSpace(m.Content)) == "ciallo" {
s.ChannelMessageSend(m.ChannelID, "Ciallo!")
}
}