File tree Expand file tree Collapse file tree 5 files changed +22
-4
lines changed
interactionCreate/middleware Expand file tree Collapse file tree 5 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 7
7
# any secret values.
8
8
9
9
BOT_TOKEN =
10
- BOT_VER = 0.6.3
10
+ BOT_VER = 0.6.4
11
11
BOT_AUTHOR = Vylpes
12
12
BOT_OWNERID = 147392775707426816
13
13
BOT_CLIENTID = 682942374040961060
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " card-drop" ,
3
- "version" : " 0.6.3 " ,
3
+ "version" : " 0.6.4 " ,
4
4
"main" : " ./dist/bot.js" ,
5
5
"typings" : " ./dist" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ export default class Claim extends ButtonEvent {
31
31
return ;
32
32
}
33
33
34
- await user . Save ( User , user ) ;
35
-
36
34
const claimed = await eClaim . FetchOneByClaimId ( claimId ) ;
37
35
38
36
if ( claimed ) {
@@ -45,6 +43,8 @@ export default class Claim extends ButtonEvent {
45
43
return ;
46
44
}
47
45
46
+ await user . Save ( User , user ) ;
47
+
48
48
let inventory = await Inventory . FetchOneByCardNumberAndUserId ( userId , cardNumber ) ;
49
49
50
50
if ( ! inventory ) {
Original file line number Diff line number Diff line change @@ -2,11 +2,14 @@ import { Interaction } from "discord.js";
2
2
import ChatInputCommand from "./interactionCreate/ChatInputCommand" ;
3
3
import Button from "./interactionCreate/Button" ;
4
4
import AppLogger from "./appLogger" ;
5
+ import NewUserDiscovery from "./interactionCreate/middleware/NewUserDiscovery" ;
5
6
6
7
export class Events {
7
8
public async onInteractionCreate ( interaction : Interaction ) {
8
9
if ( ! interaction . guildId ) return ;
9
10
11
+ await NewUserDiscovery ( interaction ) ;
12
+
10
13
if ( interaction . isChatInputCommand ( ) ) {
11
14
AppLogger . LogVerbose ( "Client" , `ChatInputCommand: ${ interaction . commandName } ` ) ;
12
15
ChatInputCommand . onChatInput ( interaction ) ;
Original file line number Diff line number Diff line change
1
+ import { Interaction } from "discord.js" ;
2
+ import User from "../../../database/entities/app/User" ;
3
+ import CardConstants from "../../../constants/CardConstants" ;
4
+ import AppLogger from "../../appLogger" ;
5
+
6
+ export default async function NewUserDiscovery ( interaction : Interaction ) {
7
+ const existingUser = await User . FetchOneById ( User , interaction . user . id ) ;
8
+
9
+ if ( existingUser ) return ;
10
+
11
+ const newUser = new User ( interaction . user . id , CardConstants . StartingCurrency ) ;
12
+ await newUser . Save ( User , newUser ) ;
13
+
14
+ AppLogger . LogInfo ( "NewUserDiscovery" , `Discovered new user ${ interaction . user . id } ` ) ;
15
+ }
You can’t perform that action at this time.
0 commit comments