Merge branch 'develop' into feature/204-coins-cron
This commit is contained in:
commit
a4e9242020
6 changed files with 42 additions and 19 deletions
13
.env.example
13
.env.example
|
@ -13,23 +13,24 @@ BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
BOT_ENV=4
|
BOT_ENV=4
|
||||||
BOT_ADMINS=147392775707426816,887272961504071690
|
BOT_ADMINS=147392775707426816,887272961504071690
|
||||||
|
BOT_LOGLEVEL=info
|
||||||
|
|
||||||
ABOUT_FUNDING=
|
ABOUT_FUNDING=
|
||||||
ABOUT_REPO=
|
ABOUT_REPO=
|
||||||
|
|
||||||
DATA_DIR=
|
DATA_DIR=./.temp
|
||||||
|
|
||||||
DB_HOST=
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=
|
DB_PORT=3301
|
||||||
DB_NAME=
|
DB_NAME=carddrop
|
||||||
DB_AUTH_USER=
|
DB_AUTH_USER=
|
||||||
DB_AUTH_PASS=
|
DB_AUTH_PASS=
|
||||||
DB_SYNC=
|
DB_SYNC=
|
||||||
DB_LOGGING=
|
DB_LOGGING=
|
||||||
DB_DATA_LOCATION=~/.docker
|
DB_DATA_LOCATION=./.temp/database
|
||||||
|
|
||||||
DB_CARD_FILE=:memory:
|
DB_CARD_FILE=:memory:
|
||||||
|
|
||||||
EXPRESS_PORT=3303
|
EXPRESS_PORT=3302
|
||||||
|
|
||||||
GDRIVESYNC_AUTO=true
|
GDRIVESYNC_AUTO=true
|
|
@ -53,12 +53,13 @@ jobs:
|
||||||
DATA_DIR: ${{ secrets.PROD_DATA_DIR }}
|
DATA_DIR: ${{ secrets.PROD_DATA_DIR }}
|
||||||
GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }}
|
GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }}
|
||||||
EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }}
|
EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }}
|
||||||
|
BOT_LOGLEVEL: ${{ vars.PROD_BOT_LOGLEVEL }}
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.PROD_SSH_HOST }}
|
host: ${{ secrets.PROD_SSH_HOST }}
|
||||||
username: ${{ secrets.PROD_SSH_USER }}
|
username: ${{ secrets.PROD_SSH_USER }}
|
||||||
key: ${{ secrets.PROD_SSH_KEY }}
|
key: ${{ secrets.PROD_SSH_KEY }}
|
||||||
port: ${{ secrets.PROD_SSH_PORT }}
|
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
|
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
|
||||||
script: |
|
script: |
|
||||||
source .sshrc \
|
source .sshrc \
|
||||||
&& cd /home/vylpes/apps/card-drop/card-drop_prod \
|
&& cd /home/vylpes/apps/card-drop/card-drop_prod \
|
||||||
|
|
|
@ -53,12 +53,13 @@ jobs:
|
||||||
DATA_DIR: ${{ secrets.STAGE_DATA_DIR }}
|
DATA_DIR: ${{ secrets.STAGE_DATA_DIR }}
|
||||||
GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }}
|
GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }}
|
||||||
EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }}
|
EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }}
|
||||||
|
BOT_LOGLEVEL: ${{ vars.STAGE_BOT_LOGLEVEL }}
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.STAGE_SSH_HOST }}
|
host: ${{ secrets.STAGE_SSH_HOST }}
|
||||||
username: ${{ secrets.STAGE_SSH_USER }}
|
username: ${{ secrets.STAGE_SSH_USER }}
|
||||||
key: ${{ secrets.STAGE_SSH_KEY }}
|
key: ${{ secrets.STAGE_SSH_KEY }}
|
||||||
port: ${{ secrets.STAGE_SSH_PORT }}
|
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
|
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
|
||||||
script: |
|
script: |
|
||||||
source .sshrc \
|
source .sshrc \
|
||||||
&& cd /home/vylpes/apps/card-drop/card-drop_stage \
|
&& cd /home/vylpes/apps/card-drop/card-drop_stage \
|
||||||
|
|
22
package-lock.json
generated
22
package-lock.json
generated
|
@ -1906,9 +1906,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.12.7",
|
"version": "20.12.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
|
||||||
"integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",
|
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
}
|
}
|
||||||
|
@ -6831,11 +6831,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/jest-mock-extended": {
|
"node_modules/jest-mock-extended": {
|
||||||
"version": "3.0.6",
|
"version": "3.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/jest-mock-extended/-/jest-mock-extended-3.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/jest-mock-extended/-/jest-mock-extended-3.0.7.tgz",
|
||||||
"integrity": "sha512-DJuEoFzio0loqdX8NIwkbE9dgIXNzaj//pefOQxGkoivohpxbSQeNHCAiXkDNA/fmM4EIJDoZnSibP4w3dUJ9g==",
|
"integrity": "sha512-7lsKdLFcW9B9l5NzZ66S/yTQ9k8rFtnwYdCNuRU/81fqDWicNDVhitTSPnrGmNeNm0xyw0JHexEOShrIKRCIRQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ts-essentials": "^9.4.2"
|
"ts-essentials": "^10.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0",
|
"jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0",
|
||||||
|
@ -10870,11 +10870,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ts-essentials": {
|
"node_modules/ts-essentials": {
|
||||||
"version": "9.4.2",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-9.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-10.0.0.tgz",
|
||||||
"integrity": "sha512-mB/cDhOvD7pg3YCLk2rOtejHjjdSi9in/IBYE13S+8WA5FBSraYf4V/ws55uvs0IvQ/l0wBOlXy5yBNZ9Bl8ZQ==",
|
"integrity": "sha512-77FHNJEyysF9+1s4G6eejuA1lxw7uMchT3ZPy3CIbh7GIunffpshtM8pTe5G6N5dpOzNevqRHew859ceLWVBfw==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": ">=4.1.0"
|
"typescript": ">=4.5.0"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"typescript": {
|
"typescript": {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import AppLogger from "../client/appLogger";
|
||||||
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import User from "../database/entities/app/User";
|
||||||
|
|
||||||
export default class Claim extends ButtonEvent {
|
export default class Claim extends ButtonEvent {
|
||||||
public override async execute(interaction: ButtonInteraction) {
|
public override async execute(interaction: ButtonInteraction) {
|
||||||
|
@ -41,6 +42,17 @@ export default class Claim extends ButtonEvent {
|
||||||
|
|
||||||
await inventory.Save(Inventory, inventory);
|
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);
|
const claim = new eClaim(claimId);
|
||||||
claim.SetInventory(inventory);
|
claim.SetInventory(inventory);
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,12 @@ export default class User extends AppBaseEntity {
|
||||||
public UpdateCurrency(currency: number) {
|
public UpdateCurrency(currency: number) {
|
||||||
this.Currency = currency;
|
this.Currency = currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RemoveCurrency(amount: number): boolean {
|
||||||
|
if (this.Currency < amount) return false;
|
||||||
|
|
||||||
|
this.Currency -= amount;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue