feat: implement global autoresponder plugin
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once PLUGIN_ROOT . '/exec/lib/RepeatState.php';
|
||||
|
||||
test('repeat state allows first reply and blocks repeated reply until ttl', function (): void {
|
||||
$state = new RepeatState(TEST_TMP . '/state', 1000);
|
||||
assert_true($state->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
|
||||
$state->record('alice', 'rule', 'info@example.com', 'sender@example.com');
|
||||
assert_false($state->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
|
||||
|
||||
$later = new RepeatState(TEST_TMP . '/state', 5000);
|
||||
assert_true($later->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
|
||||
});
|
||||
Reference in New Issue
Block a user