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,28 +592,40 @@ WHERE
if let Err(e) = result { if let Err(e) = result {
if let Error::Http(error) = e { if let Error::Http(error) = e {
if let HttpError::UnsuccessfulRequest(http_error) = *error { if let HttpError::UnsuccessfulRequest(http_error) = *error {
if http_error.error.code == 50007 { match http_error.error.code {
error!( 10003 => {
"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!( error!(
"Reminder {} could not be sent as channel does not exist", "Reminder {} could not be sent as channel does not exist",
self.id self.id
); );
self.force_delete(pool).await; self.force_delete(pool).await;
} else if http_error.error.code == 10004 { }
10004 => {
error!( error!(
"Reminder {} could not be sent as guild does not exist", "Reminder {} could not be sent as guild does not exist",
self.id self.id
); );
self.force_delete(pool).await; self.force_delete(pool).await;
} else { }
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); error!("HTTP Error sending reminder {}: {:?}", self.id, http_error);
self.refresh(pool).await; self.refresh(pool).await;
} }
}
} else { } else {
error!( error!(
"(Likely) a parsing error when sending reminder {}: {:?}", "(Likely) a parsing error when sending reminder {}: {:?}",