-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
197 lines (167 loc) · 6.98 KB
/
index.js
File metadata and controls
197 lines (167 loc) · 6.98 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
const { Client, GatewayIntentBits, MessageEmbed, WebEmbed } = require('discord.js-selfbot-v13');
const client = new Client({ checkUpdate: false });
const fetch = require('node-fetch');
const { token, webhookUrl, userIdToMonitor } = require('./config.json');
client.once('ready', () => {
console.log('Selfbot está online!');
});
client.on('messageCreate', async message => {
if (message.author && message.author.id === userIdToMonitor) {
let messageContent = message.content;
let imageUrl = '';
if (message.attachments.size > 0) {
message.attachments.forEach(attachment => {
if (attachment.contentType && (attachment.contentType.startsWith('image/') || attachment.contentType.startsWith('video/'))) {
imageUrl = attachment.url;
}
});
}
const embed = new MessageEmbed()
.setAuthor({
name: `${message.author.tag} - ${message.guild.name}`,
iconURL: message.author.displayAvatarURL({ dynamic: true }),
})
.setColor('#2b2d31')
.setDescription(
`**Usuário:**\n<@${userIdToMonitor}> \`(${message.author.id})\`\n\n` +
`**Canal:** <#${message.channel.id}>\n\`(${message.channel.id})\`\n\n` +
`**Mensagem:**\n \`\`\`${messageContent}\`\`\`\n` +
(imageUrl ? `` : '')
)
.setTimestamp();
if (imageUrl) {
embed.setImage(imageUrl);
}
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
});
client.on('messageUpdate', async (oldMessage, newMessage) => {
if (newMessage.author && newMessage.author.id === userIdToMonitor) {
let oldContent = oldMessage.content;
let newContent = newMessage.content;
const embed = new MessageEmbed()
.setAuthor({
name: `${newMessage.author.tag} - ${newMessage.guild.name}`,
iconURL: newMessage.author.displayAvatarURL({ dynamic: true }),
})
.setColor('#2b2d31')
.setDescription(
`**Usuário:**\n<@${userIdToMonitor}> \`(${newMessage.author.id})\`\n\n` +
`**Canal:** <#${newMessage.channel.id}>\n\`(${newMessage.channel.id})\`\n\n` +
`**Mensagem Editada:**\n` +
`**Antiga:**\n\`\`\`${oldContent}\`\`\`\n` +
`**Nova:**\n\`\`\`${newContent}\`\`\`\n`
)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
});
client.on('voiceStateUpdate', (oldState, newState) => {
if (newState.id === userIdToMonitor) {
const serverInviteUrl = `https://discord.gg/${newState.guild.vanityURLCode}`;
const serverName = newState.guild.name;
if (newState.channel) {
const channelId = newState.channelId;
const channelName = newState.channel.name;
const members = newState.channel.members.map(member => `> <@${member.user.id}> \`(${member.user.id})\``).join('\n');
const embed = new MessageEmbed()
.setColor('#2b2d31')
.setAuthor({
name: `${newState.member.user.username} - ${serverName}`,
iconURL: newState.member.user.displayAvatarURL({ dynamic: true, size: 1024 }),
})
.setDescription(
`**Usuário:**\n<@${userIdToMonitor}> \`(${newState.member.user.id})\`\n\n` +
`**Canal:** ${newState.channel.name} <#${newState.channel.id}>\n\`(${newState.channel.id})\`\n\n` +
`**Membros na call** <:Bomb:1248065311769366672>\n${members}\n\n` +
`**Vanity URL** <:entrou:1243192881175466097>\n> ${serverInviteUrl}`
)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
} else if (oldState.channel && !newState.channel) {
const oldChannelId = oldState.channelId;
const oldChannelName = oldState.channel.name;
const embed = new MessageEmbed()
.setColor('#2b2d31')
.setTitle('Usuário Saiu da Call')
.setDescription(
`**Servidor:** ${serverName}\n` +
`**Url personalizada:** ${serverInviteUrl}\n` +
`**Usuário:** <@${userIdToMonitor}> \n` +
`**Canal:** <#${oldChannelId}> / ${oldChannelName} \`(${oldChannelId})\``
)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
}
});
client.on('userUpdate', (oldUser, newUser) => {
if (newUser.id === userIdToMonitor) {
const oldAvatarURL = oldUser.displayAvatarURL({ dynamic: true, size: 1024 });
const newAvatarURL = newUser.displayAvatarURL({ dynamic: true, size: 1024 });
if (oldAvatarURL !== newAvatarURL) {
const embed = new MessageEmbed()
.setColor('#2b2d31')
.setAuthor({ name: `${newUser.tag}`, iconURL: newAvatarURL })
.setDescription(`${newUser} alterou o avatar`)
.setImage(newAvatarURL)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
if (oldUser.username !== newUser.username) {
const avatarURL = newUser.displayAvatarURL({ dynamic: true, size: 1024 });
const embed = new MessageEmbed()
.setColor('#2b2d31')
.setAuthor({ name: `${newUser.tag}`, iconURL: avatarURL })
.setDescription(`**Atualização de Username:**\n> \`@${oldUser.username}\` -> \`@${newUser.username}\``)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
}
});
client.on('guildMemberAdd', async (member) => {
if (member.user.id === userIdToMonitor) {
const embed = new MessageEmbed()
.setColor('#2b2d31')
.setAuthor({ name: `${member.user.tag}`, iconURL: member.user.displayAvatarURL({ dynamic: true }) })
.setDescription(`**Usuário:** <@${userIdToMonitor}> \`(${member.user.id})\`\n\n**Entrou no servidor:** ${member.guild.name}\n\`(${member.guild.id})\`\n\n**Horário:** <t:${Math.floor(Date.now() / 1000)}:F>`)
.setTimestamp();
const payload = JSON.stringify({ embeds: [embed] });
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: payload
}).catch(console.error);
}
});
client.login(token);