ratelimit: make message configurable
Changelog-Added: Make ratelimit message configurable Closes: https://github.com/damus-io/noteguard/pull/15
This commit is contained in:
parent
3b73e9aa00
commit
77c2a8906c
2 changed files with 7 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ pub struct Tokens {
|
|||
pub struct RateLimit {
|
||||
pub posts_per_minute: i32,
|
||||
pub whitelist: Option<Vec<String>>,
|
||||
pub message: Option<String>,
|
||||
|
||||
#[serde(skip)]
|
||||
pub sources: HashMap<String, Tokens>,
|
||||
|
|
@ -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()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue