Merge pull request #211 from VermiumSifell/dev

🐛 not removing role and taking negative payed
This commit is contained in:
Axel Olausson Holtenäs 2022-04-11 22:33:55 +02:00 committed by GitHub
commit ae4ffc9b04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,12 +34,16 @@ export default async (client: Client) => {
if (userDB === null) return;
if (userDB.credits < pricePerHour) {
const rGuild = await client.guilds.cache.get(`${shopRole.guildId}`);
const rMember = await rGuild?.members.fetch(`${shopRole.userId}`);
const rGuild = client?.guilds?.cache?.get(`${shopRole.guildId}`);
const rMember = await rGuild?.members?.fetch(`${shopRole.userId}`);
shopRolesSchema.deleteOne({ _id: shopRole._id });
shopRolesSchema
.deleteOne({ _id: shopRole._id })
.then(async () =>
logger.debug(`Removed ${shopRole._id} from shopRoles`)
);
await rMember?.roles
return await rMember?.roles
.remove(`${shopRole.roleId}`)
.then(async (test) => console.log("4", test))
.catch(async (test) => console.log("5", test)); // Removes all roles