feat: Add slowmode functionality to text channels (#680)
* feat: Add slowmode functionality to text channels Signed-off-by: arsabutispik <ispik@ispik.dev> * fix: use atomic check-and-set to prevent spamming with scripts Signed-off-by: arsabutispik <ispik@ispik.dev> * feat: Add BypassSlowmode permission to channel permissions Signed-off-by: arsabutispik <ispik@ispik.dev> * refactor: Use set_options instead of manually building the command Signed-off-by: arsabutispik <ispik@ispik.dev> --------- Signed-off-by: arsabutispik <ispik@ispik.dev>
This commit is contained in:
@@ -36,6 +36,9 @@ impl IntoResponse for Error {
|
||||
ErrorType::NotInGroup => StatusCode::NOT_FOUND,
|
||||
ErrorType::AlreadyPinned => StatusCode::BAD_REQUEST,
|
||||
ErrorType::NotPinned => StatusCode::BAD_REQUEST,
|
||||
ErrorType::InSlowmode {
|
||||
retry_after: _,
|
||||
} => StatusCode::TOO_MANY_REQUESTS,
|
||||
|
||||
ErrorType::CantCreateServers => StatusCode::FORBIDDEN,
|
||||
ErrorType::UnknownServer => StatusCode::NOT_FOUND,
|
||||
|
||||
@@ -102,6 +102,9 @@ pub enum ErrorType {
|
||||
NotInGroup,
|
||||
AlreadyPinned,
|
||||
NotPinned,
|
||||
InSlowmode {
|
||||
retry_after: u64,
|
||||
},
|
||||
|
||||
// ? Server related errors
|
||||
CantCreateServers,
|
||||
|
||||
@@ -42,6 +42,9 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
ErrorType::NotInGroup => Status::NotFound,
|
||||
ErrorType::AlreadyPinned => Status::BadRequest,
|
||||
ErrorType::NotPinned => Status::BadRequest,
|
||||
ErrorType::InSlowmode {
|
||||
retry_after: _,
|
||||
} => Status::TooManyRequests,
|
||||
ErrorType::InvalidFlagValue => Status::BadRequest,
|
||||
|
||||
ErrorType::CantCreateServers => Status::Forbidden,
|
||||
|
||||
Reference in New Issue
Block a user