feat: hltb plugin
This commit is contained in:
parent
c53942ac53
commit
ae3c9f665d
24 changed files with 940 additions and 17 deletions
|
@ -65,7 +65,7 @@ func extractDomains(text string) []string {
|
|||
}
|
||||
|
||||
// OnMessage processes incoming messages
|
||||
func (p *DomainBlockPlugin) OnMessage(msg *model.Message, config map[string]interface{}) []*model.MessageAction {
|
||||
func (p *DomainBlockPlugin) OnMessage(msg *model.Message, config map[string]interface{}, cache model.CacheInterface) []*model.MessageAction {
|
||||
// Skip messages from bots
|
||||
if msg.FromBot {
|
||||
return nil
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.nakama.town/fmartingr/butterrobot/internal/model"
|
||||
"git.nakama.town/fmartingr/butterrobot/internal/testutil"
|
||||
)
|
||||
|
||||
func TestExtractDomains(t *testing.T) {
|
||||
|
@ -124,7 +125,8 @@ func TestOnMessage(t *testing.T) {
|
|||
"blocked_domains": test.blockedDomains,
|
||||
}
|
||||
|
||||
responses := plugin.OnMessage(msg, config)
|
||||
mockCache := &testutil.MockCache{}
|
||||
responses := plugin.OnMessage(msg, config, mockCache)
|
||||
|
||||
if test.expectBlocked {
|
||||
if len(responses) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue