mirror of
https://github.com/Penguin-71630/meme-bot-frontend-dc.git
synced 2026-03-12 20:40:16 +08:00
Refactor: cleanup
- Introduce tracing - Introduce cobra / viper framework - Introduce resty client - Seperate files in api/ and bot/ - Trim unused functions
This commit is contained in:
23
bot/onMessageCreate.go
Normal file
23
bot/onMessageCreate.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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!")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user