File tree Expand file tree Collapse file tree 5 files changed +14
-5
lines changed Expand file tree Collapse file tree 5 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,12 @@ export async function baseHandler(
18
18
return helloCommand ( message . member . user . id ) ;
19
19
}
20
20
case getCommandName ( VERIFY ) : {
21
+ console . log ( "inside verify command case" ) ;
21
22
return await verifyCommand (
22
23
message . member . user . id ,
23
24
message . member . user . avatar ,
24
25
message . member . user . username ,
26
+ message . member . user . discriminator ,
25
27
env
26
28
) ;
27
29
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export async function verifyCommand(
9
9
userId : number ,
10
10
userAvatarHash : string ,
11
11
userName : string ,
12
+ discriminator : string ,
12
13
env : env
13
14
) {
14
15
const token = await generateUniqueToken ( ) ;
@@ -18,6 +19,7 @@ export async function verifyCommand(
18
19
userId ,
19
20
userAvatarHash ,
20
21
userName ,
22
+ discriminator ,
21
23
env
22
24
) ;
23
25
if ( response ?. status === 201 ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface messageMember {
24
24
id : number ;
25
25
username : string ;
26
26
avatar : string ;
27
+ discriminator : string ;
27
28
}
28
29
29
30
export interface createDmChannel {
Original file line number Diff line number Diff line change 1
1
import { env } from "../typeDefinitions/default.types" ;
2
2
import jwt from "@tsndr/cloudflare-worker-jwt" ;
3
- import {
4
- DISCORD_AVATAR_BASE_URL ,
5
- STAGING_API_BASE_URL ,
6
- } from "../constants/urls" ;
3
+ import { DISCORD_AVATAR_BASE_URL } from "../constants/urls" ;
4
+ import config from "../../config/config" ;
7
5
8
6
export const sendUserDiscordData = async (
9
7
token : string ,
10
8
discordId : number ,
11
9
userAvatarHash : string ,
12
10
userName : string ,
11
+ discriminator : string ,
13
12
env : env
14
13
) => {
15
14
const authToken = await jwt . sign (
@@ -24,11 +23,14 @@ export const sendUserDiscordData = async (
24
23
discordId : discordId ,
25
24
userAvatar : `${ DISCORD_AVATAR_BASE_URL } /${ discordId } /${ userAvatarHash } .jpg` ,
26
25
userName : userName ,
26
+ discriminator : discriminator ,
27
27
expiry : Date . now ( ) + 1000 * 60 * 2 ,
28
28
} ,
29
29
} ;
30
+ console . log ( data ) ;
31
+ const base_url = config ( env ) . RDS_BASE_API_URL ;
30
32
try {
31
- const response = await fetch ( `${ STAGING_API_BASE_URL } /external-accounts` , {
33
+ const response = await fetch ( `${ base_url } /external-accounts` , {
32
34
method : "POST" ,
33
35
headers : {
34
36
"Content-Type" : "application/json" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const dummyHelloMessage: discordMessageRequest = {
11
11
id : 123456 ,
12
12
username : "ritik" ,
13
13
avatar : "d1eaa8f8ab5e8235e08e659aef5dfeac" ,
14
+ discriminator : "1234" ,
14
15
} ,
15
16
} ,
16
17
guild_id : 123456 ,
@@ -26,6 +27,7 @@ export const dummyVerifyMessage: discordMessageRequest = {
26
27
id : 123456 ,
27
28
username : "ritik" ,
28
29
avatar : "d1eaa8f8ab5e8235e08e659aef5dfeac" ,
30
+ discriminator : "1234" ,
29
31
} ,
30
32
} ,
31
33
guild_id : 123456 ,
You can’t perform that action at this time.
0 commit comments