diff --git a/.env.example b/.env.example index 4fccad3..3ff53e9 100644 --- a/.env.example +++ b/.env.example @@ -13,24 +13,23 @@ BOT_OWNERID=147392775707426816 BOT_CLIENTID=682942374040961060 BOT_ENV=4 BOT_ADMINS=147392775707426816,887272961504071690 -BOT_LOGLEVEL=info ABOUT_FUNDING= ABOUT_REPO= -DATA_DIR=./.temp +DATA_DIR= -DB_HOST=127.0.0.1 -DB_PORT=3301 -DB_NAME=carddrop +DB_HOST= +DB_PORT= +DB_NAME= DB_AUTH_USER= DB_AUTH_PASS= DB_SYNC= DB_LOGGING= -DB_DATA_LOCATION=./.temp/database +DB_DATA_LOCATION=~/.docker DB_CARD_FILE=:memory: -EXPRESS_PORT=3302 +EXPRESS_PORT=3303 GDRIVESYNC_AUTO=true \ No newline at end of file diff --git a/.forgejo/workflows/production.yml b/.forgejo/workflows/production.yml index 79906d1..ba028b4 100644 --- a/.forgejo/workflows/production.yml +++ b/.forgejo/workflows/production.yml @@ -53,13 +53,12 @@ jobs: DATA_DIR: ${{ secrets.PROD_DATA_DIR }} GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }} EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }} - BOT_LOGLEVEL: ${{ vars.PROD_BOT_LOGLEVEL }} with: host: ${{ secrets.PROD_SSH_HOST }} username: ${{ secrets.PROD_SSH_USER }} key: ${{ secrets.PROD_SSH_KEY }} port: ${{ secrets.PROD_SSH_PORT }} - envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT,BOT_LOGLEVEL + envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT script: | source .sshrc \ && cd /home/vylpes/apps/card-drop/card-drop_prod \ diff --git a/.forgejo/workflows/stage.yml b/.forgejo/workflows/stage.yml index ce9b78f..d0d0215 100644 --- a/.forgejo/workflows/stage.yml +++ b/.forgejo/workflows/stage.yml @@ -53,13 +53,12 @@ jobs: DATA_DIR: ${{ secrets.STAGE_DATA_DIR }} GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }} EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }} - BOT_LOGLEVEL: ${{ vars.STAGE_BOT_LOGLEVEL }} with: host: ${{ secrets.STAGE_SSH_HOST }} username: ${{ secrets.STAGE_SSH_USER }} key: ${{ secrets.STAGE_SSH_KEY }} port: ${{ secrets.STAGE_SSH_PORT }} - envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT,BOT_LOGLEVEL + envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT script: | source .sshrc \ && cd /home/vylpes/apps/card-drop/card-drop_stage \ diff --git a/.gitignore b/.gitignore index 9326cc8..aecb458 100644 --- a/.gitignore +++ b/.gitignore @@ -108,5 +108,4 @@ config.json ormconfig.json gdrive-credentials.json data/ -*.db -.temp/ \ No newline at end of file +*.db \ No newline at end of file diff --git a/src/buttonEvents/Claim.ts b/src/buttonEvents/Claim.ts index 9d29f7b..6c45900 100644 --- a/src/buttonEvents/Claim.ts +++ b/src/buttonEvents/Claim.ts @@ -7,7 +7,6 @@ import AppLogger from "../client/appLogger"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import { readFileSync } from "fs"; import path from "path"; -import User from "../database/entities/app/User"; export default class Claim extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -42,17 +41,6 @@ export default class Claim extends ButtonEvent { await inventory.Save(Inventory, inventory); - let user = await User.FetchOneById(User, userId) || new User(userId, 300); - - AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`); - - if (!user.RemoveCurrency(10)) { - await interaction.reply(`Not enough currency! You need 10 currency, you have ${user.Currency}`); - return; - } - - await user.Save(User, user); - const claim = new eClaim(claimId); claim.SetInventory(inventory); diff --git a/src/database/entities/app/User.ts b/src/database/entities/app/User.ts index 649c1c1..c954aea 100644 --- a/src/database/entities/app/User.ts +++ b/src/database/entities/app/User.ts @@ -16,12 +16,4 @@ export default class User extends AppBaseEntity { public UpdateCurrency(currency: number) { this.Currency = currency; } - - public RemoveCurrency(amount: number): boolean { - if (this.Currency < amount) return false; - - this.Currency -= amount; - - return true; - } } \ No newline at end of file