Compare commits
3 commits
976445fa0d
...
53656ba0da
Author | SHA1 | Date | |
---|---|---|---|
53656ba0da | |||
27b6224b5e | |||
e584c1291b |
5 changed files with 22 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.6.3
|
BOT_VER=0.6.4
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "card-drop",
|
"name": "card-drop",
|
||||||
"version": "0.6.3",
|
"version": "0.6.4",
|
||||||
"main": "./dist/bot.js",
|
"main": "./dist/bot.js",
|
||||||
"typings": "./dist",
|
"typings": "./dist",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -31,8 +31,6 @@ export default class Claim extends ButtonEvent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await user.Save(User, user);
|
|
||||||
|
|
||||||
const claimed = await eClaim.FetchOneByClaimId(claimId);
|
const claimed = await eClaim.FetchOneByClaimId(claimId);
|
||||||
|
|
||||||
if (claimed) {
|
if (claimed) {
|
||||||
|
@ -45,6 +43,8 @@ export default class Claim extends ButtonEvent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await user.Save(User, user);
|
||||||
|
|
||||||
let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
|
let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
|
||||||
|
|
||||||
if (!inventory) {
|
if (!inventory) {
|
||||||
|
|
|
@ -2,11 +2,14 @@ import { Interaction } from "discord.js";
|
||||||
import ChatInputCommand from "./interactionCreate/ChatInputCommand";
|
import ChatInputCommand from "./interactionCreate/ChatInputCommand";
|
||||||
import Button from "./interactionCreate/Button";
|
import Button from "./interactionCreate/Button";
|
||||||
import AppLogger from "./appLogger";
|
import AppLogger from "./appLogger";
|
||||||
|
import NewUserDiscovery from "./interactionCreate/middleware/NewUserDiscovery";
|
||||||
|
|
||||||
export class Events {
|
export class Events {
|
||||||
public async onInteractionCreate(interaction: Interaction) {
|
public async onInteractionCreate(interaction: Interaction) {
|
||||||
if (!interaction.guildId) return;
|
if (!interaction.guildId) return;
|
||||||
|
|
||||||
|
await NewUserDiscovery(interaction);
|
||||||
|
|
||||||
if (interaction.isChatInputCommand()) {
|
if (interaction.isChatInputCommand()) {
|
||||||
AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`);
|
AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`);
|
||||||
ChatInputCommand.onChatInput(interaction);
|
ChatInputCommand.onChatInput(interaction);
|
||||||
|
|
15
src/client/interactionCreate/middleware/NewUserDiscovery.ts
Normal file
15
src/client/interactionCreate/middleware/NewUserDiscovery.ts
Normal 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}`);
|
||||||
|
}
|
Loading…
Reference in a new issue