🔒️ fixed work command
This commit is contained in:
parent
1b0b9fb6bb
commit
f94f1192bf
2 changed files with 12 additions and 4 deletions
|
@ -26,9 +26,12 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^0.12.0",
|
"@discordjs/builders": "^0.12.0",
|
||||||
"@discordjs/rest": "^0.3.0",
|
"@discordjs/rest": "^0.3.0",
|
||||||
|
"@nastyox/rando.js": "^2.0.5",
|
||||||
"axios": "^0.26.0",
|
"axios": "^0.26.0",
|
||||||
"better-sqlite3": "^7.5.0",
|
"better-sqlite3": "^7.5.0",
|
||||||
|
"chance": "^1.1.8",
|
||||||
"common": "^0.2.5",
|
"common": "^0.2.5",
|
||||||
|
"crypto": "^1.0.1",
|
||||||
"dbd-dark-dashboard": "^1.6.45",
|
"dbd-dark-dashboard": "^1.6.45",
|
||||||
"discord-api-types": "^0.31.0",
|
"discord-api-types": "^0.31.0",
|
||||||
"discord-dashboard": "^2.3.14",
|
"discord-dashboard": "^2.3.14",
|
||||||
|
@ -45,6 +48,7 @@
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/chance": "^1.1.3",
|
||||||
"@types/node-schedule": "^1.3.2",
|
"@types/node-schedule": "^1.3.2",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
||||||
|
import Chance from 'chance';
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from '../../../../config.json';
|
||||||
|
@ -20,6 +21,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
// Destructure member
|
// Destructure member
|
||||||
const { guild, user } = interaction;
|
const { guild, user } = interaction;
|
||||||
|
|
||||||
|
// Chance module
|
||||||
|
const chance = new Chance();
|
||||||
|
|
||||||
// Check if user has a timeout
|
// Check if user has a timeout
|
||||||
const isTimeout = await timeouts?.findOne({
|
const isTimeout = await timeouts?.findOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
|
@ -33,10 +37,10 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// If user is not on timeout
|
// If user is not on timeout
|
||||||
if (!isTimeout) {
|
if (!isTimeout) {
|
||||||
// Make a variable of how much credits user will earn based on random multiplied with work rate
|
const creditsEarned = chance.integer({
|
||||||
const creditsEarned = Math?.floor(
|
min: 0,
|
||||||
Math?.random() * guildDB?.credits?.workRate
|
max: guildDB?.credits?.workRate,
|
||||||
);
|
});
|
||||||
|
|
||||||
const userDB = await userSchema?.findOne({
|
const userDB = await userSchema?.findOne({
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
|
|
Loading…
Add table
Reference in a new issue