Merge pull request #24 from ZynerOrg/main-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
9f42740390
3 changed files with 10 additions and 10 deletions
|
@ -32,7 +32,7 @@ module.exports = async (interaction) => {
|
||||||
userId: member.id,
|
userId: member.id,
|
||||||
guildId: interaction.member.guild.id,
|
guildId: interaction.member.guild.id,
|
||||||
});
|
});
|
||||||
const pricePerHour = guild.shop.roles.pricePerHour;
|
const { pricePerHour } = guild.shop.roles;
|
||||||
|
|
||||||
userObject.balance -= pricePerHour;
|
userObject.balance -= pricePerHour;
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@ const config = require('../../../../config.json');
|
||||||
|
|
||||||
module.exports = async (interaction) => {
|
module.exports = async (interaction) => {
|
||||||
let totalSeconds = interaction.client.uptime / 1000;
|
let totalSeconds = interaction.client.uptime / 1000;
|
||||||
let days = Math.floor(totalSeconds / 86400);
|
const days = Math.floor(totalSeconds / 86400);
|
||||||
totalSeconds %= 86400;
|
totalSeconds %= 86400;
|
||||||
let hours = Math.floor(totalSeconds / 3600);
|
const hours = Math.floor(totalSeconds / 3600);
|
||||||
totalSeconds %= 3600;
|
totalSeconds %= 3600;
|
||||||
let minutes = Math.floor(totalSeconds / 60);
|
const minutes = Math.floor(totalSeconds / 60);
|
||||||
let seconds = Math.floor(totalSeconds % 60);
|
const seconds = Math.floor(totalSeconds % 60);
|
||||||
|
|
||||||
let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
|
const uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
|
||||||
|
|
||||||
const interactionEmbed = {
|
const interactionEmbed = {
|
||||||
title: ':hammer: Utilities - Stats',
|
title: ':hammer: Utilities - Stats',
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = async (client) => {
|
||||||
schedule.scheduleJob('*/30 * * * *', async () => {
|
schedule.scheduleJob('*/30 * * * *', async () => {
|
||||||
shopRoles.find().then(async (data) => {
|
shopRoles.find().then(async (data) => {
|
||||||
data.map(async (role) => {
|
data.map(async (role) => {
|
||||||
var payed = new Date(role.lastPayed);
|
const payed = new Date(role.lastPayed);
|
||||||
|
|
||||||
oneHourAfterPayed = payed.setHours(payed.getHours() + 1);
|
oneHourAfterPayed = payed.setHours(payed.getHours() + 1);
|
||||||
|
|
||||||
|
@ -24,16 +24,16 @@ module.exports = async (client) => {
|
||||||
userId: role.userId,
|
userId: role.userId,
|
||||||
guildId: role.guildId,
|
guildId: role.guildId,
|
||||||
});
|
});
|
||||||
const pricePerHour = guild.shop.roles.pricePerHour;
|
const { pricePerHour } = guild.shop.roles;
|
||||||
|
|
||||||
if (userObject.balance < pricePerHour) {
|
if (userObject.balance < pricePerHour) {
|
||||||
const rGuild = await client.guilds.cache.get(`${role.guildId}`);
|
const rGuild = await client.guilds.cache.get(`${role.guildId}`);
|
||||||
let rMember = await rGuild.members.fetch(`${role.userId}`);
|
const rMember = await rGuild.members.fetch(`${role.userId}`);
|
||||||
|
|
||||||
await rMember.roles
|
await rMember.roles
|
||||||
.remove(`${role.roleId}`)
|
.remove(`${role.roleId}`)
|
||||||
.then(console.log)
|
.then(console.log)
|
||||||
.catch(console.error); //Removes all roles
|
.catch(console.error); // Removes all roles
|
||||||
}
|
}
|
||||||
|
|
||||||
role.lastPayed = new Date();
|
role.lastPayed = new Date();
|
||||||
|
|
Loading…
Add table
Reference in a new issue