Compare commits

...

4 commits

Author SHA1 Message Date
90a7dbee39 Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 7s
Deploy To Stage / deploy (push) Successful in 14s
2024-06-15 21:02:07 +01:00
53656ba0da v0.6.4
All checks were successful
Deploy To Production / build (push) Successful in 8s
Deploy To Production / deploy (push) Successful in 14s
2024-06-15 21:01:28 +01:00
27b6224b5e 0.6.4 2024-06-15 21:01:22 +01:00
e584c1291b Fix the claim logic removing a user's currency before it checks if the card is actually claimable
All checks were successful
Test / build (push) Successful in 7s
2024-06-15 21:00:14 +01:00
5 changed files with 22 additions and 4 deletions

View file

@ -7,7 +7,7 @@
# any secret values.
BOT_TOKEN=
BOT_VER=0.6.3
BOT_VER=0.6.4
BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060

View file

@ -1,6 +1,6 @@
{
"name": "card-drop",
"version": "0.6.3",
"version": "0.6.4",
"main": "./dist/bot.js",
"typings": "./dist",
"scripts": {

View file

@ -39,8 +39,6 @@ export default class Claim extends ButtonEvent {
return;
}
await user.Save(User, user);
const claimed = await eClaim.FetchOneByClaimId(claimId);
if (claimed) {
@ -53,6 +51,8 @@ export default class Claim extends ButtonEvent {
return;
}
await user.Save(User, user);
let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
if (!inventory) {

View file

@ -2,11 +2,14 @@ import { Interaction } from "discord.js";
import ChatInputCommand from "./interactionCreate/ChatInputCommand";
import Button from "./interactionCreate/Button";
import AppLogger from "./appLogger";
import NewUserDiscovery from "./interactionCreate/middleware/NewUserDiscovery";
export class Events {
public async onInteractionCreate(interaction: Interaction) {
if (!interaction.guildId) return;
await NewUserDiscovery(interaction);
if (interaction.isChatInputCommand()) {
AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`);
ChatInputCommand.onChatInput(interaction);

View file

@ -0,0 +1,15 @@
import { Interaction } from "discord.js";
import User from "../../../database/entities/app/User";
import CardConstants from "../../../constants/CardConstants";
import AppLogger from "../../appLogger";
export default async function NewUserDiscovery(interaction: Interaction) {
const existingUser = await User.FetchOneById(User, interaction.user.id);
if (existingUser) return;
const newUser = new User(interaction.user.id, CardConstants.StartingCurrency);
await newUser.Save(User, newUser);
AppLogger.LogInfo("NewUserDiscovery", `Discovered new user ${interaction.user.id}`);
}