Add handler for 50001 Missing Access

This commit is contained in:
jude 2023-07-30 14:13:20 +01:00
parent e65429aa9c
commit 90df265114

View File

@ -592,27 +592,39 @@ WHERE
if let Err(e) = result {
if let Error::Http(error) = e {
if let HttpError::UnsuccessfulRequest(http_error) = *error {
if http_error.error.code == 50007 {
error!(
"Reminder {} could not be sent as user has DMs disabled",
self.id
);
self.force_delete(pool).await;
} else if http_error.error.code == 10003 {
error!(
"Reminder {} could not be sent as channel does not exist",
self.id
);
self.force_delete(pool).await;
} else if http_error.error.code == 10004 {
error!(
"Reminder {} could not be sent as guild does not exist",
self.id
);
self.force_delete(pool).await;
} else {
error!("HTTP Error sending reminder {}: {:?}", self.id, http_error);
self.refresh(pool).await;
match http_error.error.code {
10003 => {
error!(
"Reminder {} could not be sent as channel does not exist",
self.id
);
self.force_delete(pool).await;
}
10004 => {
error!(
"Reminder {} could not be sent as guild does not exist",
self.id
);
self.force_delete(pool).await;
}
50001 => {
error!(
"Reminder {} could not be sent as permissions are invalid",
self.id
);
self.force_delete(pool).await;
}
50007 => {
error!(
"Reminder {} could not be sent as user has DMs disabled",
self.id
);
self.force_delete(pool).await;
}
_ => {
error!("HTTP Error sending reminder {}: {:?}", self.id, http_error);
self.refresh(pool).await;
}
}
} else {
error!(