butterrobot/internal/plugin/fun/loquito.go
Felipe M. 7c684af8c3
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
refactor: python -> go
2025-04-20 14:13:44 +02:00

40 lines
928 B
Go

package fun
import (
"strings"
"git.nakama.town/fmartingr/butterrobot/internal/model"
"git.nakama.town/fmartingr/butterrobot/internal/plugin"
)
// LoquitoPlugin replies with "Loquito tu." when someone says "lo quito"
type LoquitoPlugin struct {
plugin.BasePlugin
}
// NewLoquito creates a new LoquitoPlugin instance
func NewLoquito() *LoquitoPlugin {
return &LoquitoPlugin{
BasePlugin: plugin.BasePlugin{
ID: "fun.loquito",
Name: "Loquito Reply",
Help: "Replies with 'Loquito tu.' when someone says 'lo quito'",
},
}
}
// OnMessage handles incoming messages
func (p *LoquitoPlugin) OnMessage(msg *model.Message, config map[string]interface{}) []*model.Message {
if !strings.Contains(strings.ToLower(msg.Text), "lo quito") {
return nil
}
response := &model.Message{
Text: "Loquito tu.",
Chat: msg.Chat,
ReplyTo: msg.ID,
Channel: msg.Channel,
}
return []*model.Message{response}
}