feat: domain blocker plugin
Some checks failed
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/push/ci Pipeline failed

This commit is contained in:
Felipe M 2025-04-22 18:09:27 +02:00
parent c9edb57505
commit 7dd02c0056
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
25 changed files with 898 additions and 63 deletions

View file

@ -32,7 +32,7 @@ func NewDice() *DicePlugin {
}
// OnMessage handles incoming messages
func (p *DicePlugin) OnMessage(msg *model.Message, config map[string]interface{}) []*model.Message {
func (p *DicePlugin) OnMessage(msg *model.Message, config map[string]interface{}) []*model.MessageAction {
if !strings.HasPrefix(strings.TrimSpace(strings.ToLower(msg.Text)), "!dice") {
return nil
}
@ -62,7 +62,14 @@ func (p *DicePlugin) OnMessage(msg *model.Message, config map[string]interface{}
Channel: msg.Channel,
}
return []*model.Message{response}
action := &model.MessageAction{
Type: model.ActionSendMessage,
Message: response,
Chat: msg.Chat,
Channel: msg.Channel,
}
return []*model.MessageAction{action}
}
// rollDice parses a dice formula string and returns the result