diff --git a/noteguard.toml b/noteguard.toml index d3445bd..467693c 100644 --- a/noteguard.toml +++ b/noteguard.toml @@ -4,6 +4,7 @@ pipeline = ["protected_events", "kinds", "content", "whitelist", "ratelimit"] [filters.ratelimit] posts_per_minute = 8 whitelist = ["127.0.0.1"] +message = "rate-limited: you note too much" [filters.content] filters = ["https://cdn.nostr.build/i/some-spammy-or-abusive-image-image.png"] diff --git a/src/filters/ratelimit.rs b/src/filters/ratelimit.rs index 4279f24..44cb514 100644 --- a/src/filters/ratelimit.rs +++ b/src/filters/ratelimit.rs @@ -12,6 +12,7 @@ pub struct Tokens { pub struct RateLimit { pub posts_per_minute: i32, pub whitelist: Option>, + pub message: Option, #[serde(skip)] pub sources: HashMap, @@ -65,7 +66,11 @@ impl NoteFilter for RateLimit { return OutputMessage::new( msg.event.id.clone(), Action::Reject, - Some("rate-limited: you are noting too much".to_string()), + Some( + self.message + .clone() + .unwrap_or("rate-limited: you are noting too much".to_string()), + ), ); }