40 lines
928 B
Go
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}
|
|
}
|