🔧 remove shopRole document if user not found

This commit is contained in:
Axel Olausson Holtenäs 2022-04-17 18:13:31 +02:00
parent bc6f8f7aa6
commit 503c8b5e97
No known key found for this signature in database
GPG key ID: 7BF6826B76382CBA

View file

@ -79,6 +79,23 @@ export default async (client: Client) => {
if (!rMember) {
logger.error(`Member ${userId} not found for shop role ${roleId}.`);
await shopRoleSchema
.deleteOne({
userId,
roleId,
guildId,
})
.then(async () => {
logger.verbose(
`Shop role document ${roleId} has been deleted from user ${userId}.`
);
})
.catch(async (error) => {
logger.error(
`Error deleting shop role document ${roleId} from user ${userId}.`,
error
);
});
return;
}