This commit is contained in:
parent
9c78ea2d48
commit
7c684af8c3
79 changed files with 3594 additions and 3257 deletions
40
internal/plugin/fun/loquito.go
Normal file
40
internal/plugin/fun/loquito.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
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}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue