Compare commits
1 commit
b30e2f4533
...
ee1d8ab4a5
Author | SHA1 | Date | |
---|---|---|---|
ee1d8ab4a5 |
15 changed files with 45 additions and 123 deletions
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.6.1
|
BOT_VER=0.5.0
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
|
|
39
package-lock.json
generated
39
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "card-drop",
|
"name": "card-drop",
|
||||||
"version": "0.6.1",
|
"version": "0.5.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "card-drop",
|
"name": "card-drop",
|
||||||
"version": "0.6.1",
|
"version": "0.5.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/rest": "^2.0.0",
|
"@discordjs/rest": "^2.0.0",
|
||||||
|
@ -732,9 +732,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@discordjs/builders": {
|
"node_modules/@discordjs/builders": {
|
||||||
"version": "1.8.2",
|
"version": "1.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.8.1.tgz",
|
||||||
"integrity": "sha512-6wvG3QaCjtMu0xnle4SoOIeFB4y6fKMN6WZfy3BMKJdQQtPLik8KGzDwBVL/+wTtcE/ZlFjgEk74GublyEVZ7g==",
|
"integrity": "sha512-GkF+HM01FHy+NSoTaUPR8z44otfQgJ1AIsRxclYGUZDyUbdZEFyD/5QVv2Y1Flx6M+B0bQLzg2M9CJv5lGTqpA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/formatters": "^0.4.0",
|
"@discordjs/formatters": "^0.4.0",
|
||||||
|
@ -815,9 +815,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@discordjs/ws": {
|
"node_modules/@discordjs/ws": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.0.tgz",
|
||||||
"integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==",
|
"integrity": "sha512-O97DIeSvfNTn5wz5vaER6ciyUsr7nOqSEtsLoMhhIgeFkhnxLRqSr00/Fpq2/ppLgjDGLbQCDzIK7ilGoB/M7A==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/collection": "^2.1.0",
|
"@discordjs/collection": "^2.1.0",
|
||||||
|
@ -4242,17 +4242,17 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/discord.js": {
|
"node_modules/discord.js": {
|
||||||
"version": "14.15.3",
|
"version": "14.15.2",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.15.2.tgz",
|
||||||
"integrity": "sha512-/UJDQO10VuU6wQPglA4kz2bw2ngeeSbogiIPx/TsnctfzV/tNf+q+i1HlgtX1OGpeOBpJH9erZQNO5oRM2uAtQ==",
|
"integrity": "sha512-wGD37YCaTUNprtpqMIRuNiswwsvSWXrHykBSm2SAosoTYut0VUDj9yo9t4iLtMKvuhI49zYkvKc2TNdzdvpJhg==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^1.8.2",
|
"@discordjs/builders": "^1.8.1",
|
||||||
"@discordjs/collection": "1.5.3",
|
"@discordjs/collection": "1.5.3",
|
||||||
"@discordjs/formatters": "^0.4.0",
|
"@discordjs/formatters": "^0.4.0",
|
||||||
"@discordjs/rest": "^2.3.0",
|
"@discordjs/rest": "^2.3.0",
|
||||||
"@discordjs/util": "^1.1.0",
|
"@discordjs/util": "^1.1.0",
|
||||||
"@discordjs/ws": "^1.1.1",
|
"@discordjs/ws": "^1.1.0",
|
||||||
"@sapphire/snowflake": "3.5.3",
|
"@sapphire/snowflake": "3.5.3",
|
||||||
"discord-api-types": "0.37.83",
|
"discord-api-types": "0.37.83",
|
||||||
"fast-deep-equal": "3.1.3",
|
"fast-deep-equal": "3.1.3",
|
||||||
|
@ -10921,10 +10921,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ts-jest": {
|
"node_modules/ts-jest": {
|
||||||
"version": "29.1.3",
|
"version": "29.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz",
|
||||||
"integrity": "sha512-6L9qz3ginTd1NKhOxmkP0qU3FyKjj5CPoY+anszfVn6Pmv/RIKzhiMCsH7Yb7UvJR9I2A64rm4zQl531s2F1iw==",
|
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==",
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bs-logger": "0.x",
|
"bs-logger": "0.x",
|
||||||
"fast-json-stable-stringify": "2.x",
|
"fast-json-stable-stringify": "2.x",
|
||||||
|
@ -10939,11 +10938,10 @@
|
||||||
"ts-jest": "cli.js"
|
"ts-jest": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
|
"node": "^16.10.0 || ^18.0.0 || >=20.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": ">=7.0.0-beta.0 <8",
|
"@babel/core": ">=7.0.0-beta.0 <8",
|
||||||
"@jest/transform": "^29.0.0",
|
|
||||||
"@jest/types": "^29.0.0",
|
"@jest/types": "^29.0.0",
|
||||||
"babel-jest": "^29.0.0",
|
"babel-jest": "^29.0.0",
|
||||||
"jest": "^29.0.0",
|
"jest": "^29.0.0",
|
||||||
|
@ -10953,9 +10951,6 @@
|
||||||
"@babel/core": {
|
"@babel/core": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@jest/transform": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@jest/types": {
|
"@jest/types": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "card-drop",
|
"name": "card-drop",
|
||||||
"version": "0.6.1",
|
"version": "0.5.1",
|
||||||
"main": "./dist/bot.js",
|
"main": "./dist/bot.js",
|
||||||
"typings": "./dist",
|
"typings": "./dist",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -39,13 +39,6 @@ export default class CardMetadataFunction {
|
||||||
CoreClient.Cards = cardResult.Result!;
|
CoreClient.Cards = cardResult.Result!;
|
||||||
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
|
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
|
||||||
|
|
||||||
const duplicateCards = CoreClient.Cards.flatMap(x => x.cards)
|
|
||||||
.filter((card, index, self) => self.findIndex(c => c.id === card.id) !== index);
|
|
||||||
|
|
||||||
if (duplicateCards.length > 0) {
|
|
||||||
AppLogger.LogWarn("Functions/CardMetadataFunction", `Duplicate card ids found: ${duplicateCards.flatMap(x => x.id).join(", ")}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
IsSuccess: true,
|
IsSuccess: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
import { ButtonInteraction } from "discord.js";
|
import { AttachmentBuilder, ButtonInteraction } from "discord.js";
|
||||||
import { ButtonEvent } from "../type/buttonEvent";
|
import { ButtonEvent } from "../type/buttonEvent";
|
||||||
import Inventory from "../database/entities/app/Inventory";
|
import Inventory from "../database/entities/app/Inventory";
|
||||||
import { CoreClient } from "../client/client";
|
import { CoreClient } from "../client/client";
|
||||||
import { default as eClaim } from "../database/entities/app/Claim";
|
import { default as eClaim } from "../database/entities/app/Claim";
|
||||||
import AppLogger from "../client/appLogger";
|
import AppLogger from "../client/appLogger";
|
||||||
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import path from "path";
|
||||||
import User from "../database/entities/app/User";
|
import User from "../database/entities/app/User";
|
||||||
import CardConstants from "../constants/CardConstants";
|
import CardConstants from "../constants/CardConstants";
|
||||||
|
|
||||||
export default class Claim extends ButtonEvent {
|
export default class Claim extends ButtonEvent {
|
||||||
public override async execute(interaction: ButtonInteraction) {
|
public override async execute(interaction: ButtonInteraction) {
|
||||||
if (!interaction.guild || !interaction.guildId) return;
|
if (!interaction.guild || !interaction.guildId) return;
|
||||||
if (!interaction.channel) return;
|
|
||||||
|
|
||||||
await interaction.deferUpdate();
|
|
||||||
|
|
||||||
const cardNumber = interaction.customId.split(" ")[1];
|
const cardNumber = interaction.customId.split(" ")[1];
|
||||||
const claimId = interaction.customId.split(" ")[2];
|
const claimId = interaction.customId.split(" ")[2];
|
||||||
|
@ -22,26 +21,15 @@ export default class Claim extends ButtonEvent {
|
||||||
|
|
||||||
AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`);
|
AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`);
|
||||||
|
|
||||||
const user = await User.FetchOneById(User, userId) || new User(userId, CardConstants.StartingCurrency);
|
|
||||||
|
|
||||||
AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`);
|
|
||||||
|
|
||||||
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
|
|
||||||
await interaction.channel.send(`${interaction.user}, Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await user.Save(User, user);
|
|
||||||
|
|
||||||
const claimed = await eClaim.FetchOneByClaimId(claimId);
|
const claimed = await eClaim.FetchOneByClaimId(claimId);
|
||||||
|
|
||||||
if (claimed) {
|
if (claimed) {
|
||||||
await interaction.channel.send(`${interaction.user}, This card has already been claimed!`);
|
await interaction.reply("This card has already been claimed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (claimId == CoreClient.ClaimId && userId != droppedBy) {
|
if (claimId == CoreClient.ClaimId && userId != droppedBy) {
|
||||||
await interaction.channel.send(`${interaction.user}, The latest dropped card can only be claimed by the user who dropped it!`);
|
await interaction.reply("The latest dropped card can only be claimed by the user who dropped it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +43,17 @@ export default class Claim extends ButtonEvent {
|
||||||
|
|
||||||
await inventory.Save(Inventory, inventory);
|
await inventory.Save(Inventory, inventory);
|
||||||
|
|
||||||
|
const user = await User.FetchOneById(User, userId) || new User(userId, CardConstants.StartingCurrency);
|
||||||
|
|
||||||
|
AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`);
|
||||||
|
|
||||||
|
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
@ -66,13 +65,17 @@ export default class Claim extends ButtonEvent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.card.path));
|
||||||
const imageFileName = card.card.path.split("/").pop()!;
|
const imageFileName = card.card.path.split("/").pop()!;
|
||||||
|
|
||||||
|
const attachment = new AttachmentBuilder(image, { name: imageFileName });
|
||||||
|
|
||||||
const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username);
|
const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username);
|
||||||
const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true);
|
const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true);
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.update({
|
||||||
embeds: [ embed ],
|
embeds: [ embed ],
|
||||||
|
files: [ attachment ],
|
||||||
components: [ row ],
|
components: [ row ],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import Config from "../database/entities/app/Config";
|
||||||
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import AppLogger from "../client/appLogger";
|
import AppLogger from "../client/appLogger";
|
||||||
import User from "../database/entities/app/User";
|
|
||||||
import CardConstants from "../constants/CardConstants";
|
|
||||||
|
|
||||||
export default class Reroll extends ButtonEvent {
|
export default class Reroll extends ButtonEvent {
|
||||||
public override async execute(interaction: ButtonInteraction) {
|
public override async execute(interaction: ButtonInteraction) {
|
||||||
|
@ -25,20 +23,6 @@ export default class Reroll extends ButtonEvent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = await User.FetchOneById(User, interaction.user.id);
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
user = new User(interaction.user.id, CardConstants.StartingCurrency);
|
|
||||||
await user.Save(User, user);
|
|
||||||
|
|
||||||
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.Currency < CardConstants.ClaimCost) {
|
|
||||||
await interaction.reply(`Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const randomCard = CardDropHelperMetadata.GetRandomCard();
|
const randomCard = CardDropHelperMetadata.GetRandomCard();
|
||||||
|
|
||||||
if (!randomCard) {
|
if (!randomCard) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class CoreClient extends Client {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
AppLogger.LogInfo("Client", "App Data Source Initialised");
|
AppLogger.LogInfo("Client", "App Data Source Initialised");
|
||||||
|
|
||||||
const timerId = this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false);
|
const timerId = this._timerHelper.AddTimer("*/30 * * * * *", "Europe/London", GiveCurrency, false);
|
||||||
this._timerHelper.StartTimer(timerId);
|
this._timerHelper.StartTimer(timerId);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
|
|
||||||
import { Command } from "../type/command";
|
|
||||||
import User from "../database/entities/app/User";
|
|
||||||
import EmbedColours from "../constants/EmbedColours";
|
|
||||||
|
|
||||||
export default class Balance extends Command {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.CommandBuilder = new SlashCommandBuilder()
|
|
||||||
.setName("balance")
|
|
||||||
.setDescription("Get your currency balance");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async execute(interaction: CommandInteraction) {
|
|
||||||
const user = await User.FetchOneById(User, interaction.user.id);
|
|
||||||
|
|
||||||
let userBalance = user != null ? user.Currency : 0;
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setColor(EmbedColours.Ok)
|
|
||||||
.setTitle("Balance")
|
|
||||||
.setDescription(`You currently have **${userBalance} currency**!`)
|
|
||||||
.setFooter({ text: interaction.user.username, iconURL: interaction.user.avatarURL() ?? undefined });
|
|
||||||
|
|
||||||
await interaction.reply({ embeds: [ embed ]});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,6 +38,6 @@ export default class Daily extends Command {
|
||||||
|
|
||||||
await user.Save(User, user);
|
await user.Save(User, user);
|
||||||
|
|
||||||
await interaction.reply(`Congratulations, you have claimed your daily ${CardConstants.DailyCurrency} currency! You now have ${user.Currency} currency and can claim again in 24 hours!`);
|
await interaction.reply(`Given ${CardConstants.DailyCurrency} currency to ${interaction.user.username}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,6 @@ import Config from "../database/entities/app/Config";
|
||||||
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import AppLogger from "../client/appLogger";
|
import AppLogger from "../client/appLogger";
|
||||||
import User from "../database/entities/app/User";
|
|
||||||
import CardConstants from "../constants/CardConstants";
|
|
||||||
|
|
||||||
export default class Drop extends Command {
|
export default class Drop extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -33,20 +31,6 @@ export default class Drop extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = await User.FetchOneById(User, interaction.user.id);
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
user = new User(interaction.user.id, CardConstants.StartingCurrency);
|
|
||||||
await user.Save(User, user);
|
|
||||||
|
|
||||||
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.Currency < CardConstants.ClaimCost) {
|
|
||||||
await interaction.reply(`Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const randomCard = CardDropHelperMetadata.GetRandomCard();
|
const randomCard = CardDropHelperMetadata.GetRandomCard();
|
||||||
|
|
||||||
if (!randomCard) {
|
if (!randomCard) {
|
||||||
|
|
|
@ -36,11 +36,6 @@ export default class Trade extends Command {
|
||||||
|
|
||||||
AppLogger.LogSilly("Commands/Trade", `Parameters: user=${user.id}, give=${give.value}, receive=${receive.value}`);
|
AppLogger.LogSilly("Commands/Trade", `Parameters: user=${user.id}, give=${give.value}, receive=${receive.value}`);
|
||||||
|
|
||||||
if (interaction.user.id == user.id) {
|
|
||||||
await interaction.reply("You can not create a trade with yourself.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString());
|
const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString());
|
||||||
const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString());
|
const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString());
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export default class CardConstants {
|
export default class CardConstants {
|
||||||
public static readonly ClaimCost = 10;
|
public static readonly ClaimCost = 10;
|
||||||
public static readonly TimerGiveAmount = 10;
|
|
||||||
public static readonly DailyCurrency = 100;
|
public static readonly DailyCurrency = 100;
|
||||||
public static readonly StartingCurrency = 300;
|
public static readonly StartingCurrency = 300;
|
||||||
}
|
}
|
|
@ -3,7 +3,6 @@ import { Environment } from "./constants/Environment";
|
||||||
|
|
||||||
// Global Command Imports
|
// Global Command Imports
|
||||||
import About from "./commands/about";
|
import About from "./commands/about";
|
||||||
import Balance from "./commands/balance";
|
|
||||||
import Daily from "./commands/daily";
|
import Daily from "./commands/daily";
|
||||||
import Drop from "./commands/drop";
|
import Drop from "./commands/drop";
|
||||||
import Gdrivesync from "./commands/gdrivesync";
|
import Gdrivesync from "./commands/gdrivesync";
|
||||||
|
@ -31,7 +30,6 @@ export default class Registry {
|
||||||
public static RegisterCommands() {
|
public static RegisterCommands() {
|
||||||
// Global Commands
|
// Global Commands
|
||||||
CoreClient.RegisterCommand("about", new About());
|
CoreClient.RegisterCommand("about", new About());
|
||||||
CoreClient.RegisterCommand("balance", new Balance());
|
|
||||||
CoreClient.RegisterCommand("daily", new Daily());
|
CoreClient.RegisterCommand("daily", new Daily());
|
||||||
CoreClient.RegisterCommand("drop", new Drop());
|
CoreClient.RegisterCommand("drop", new Drop());
|
||||||
CoreClient.RegisterCommand("gdrivesync", new Gdrivesync());
|
CoreClient.RegisterCommand("gdrivesync", new Gdrivesync());
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import AppLogger from "../client/appLogger";
|
import AppLogger from "../client/appLogger";
|
||||||
import CardConstants from "../constants/CardConstants";
|
|
||||||
import User from "../database/entities/app/User";
|
import User from "../database/entities/app/User";
|
||||||
|
|
||||||
export default async function GiveCurrency() {
|
export default async function GiveCurrency() {
|
||||||
|
@ -8,10 +7,10 @@ export default async function GiveCurrency() {
|
||||||
const users = await User.FetchAll(User);
|
const users = await User.FetchAll(User);
|
||||||
|
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
user.AddCurrency(CardConstants.TimerGiveAmount);
|
user.AddCurrency(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.SaveAll(User, users);
|
User.SaveAll(User, users);
|
||||||
|
|
||||||
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`);
|
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +5 currency to ${users.length} users`);
|
||||||
}
|
}
|
Loading…
Reference in a new issue