-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
53 lines (48 loc) · 2.57 KB
/
index.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
tcpp = require('tcp-ping');
const { Client, GatewayIntentBits, Partials, EmbedBuilder } = require('discord.js');
const client = new Client({
intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildInvites ],
partials: [ Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction, Partials.ThreadMember, Partials.GuildScheduledEvent ]
});
client.config = require('./config.json');
client.login(client.config.token);
let description = '';
client.on('ready', () => {
console.log(`[!] — Logged in as ${client.user.tag} (${client.user.id})`);
const embed = new EmbedBuilder()
.setTitle('`🪄` ▸ Verification')
.setDescription('*Loading...*')
.setFooter({ text: `Last updated on ${new Date().toLocaleString('fr-FR',{timeZone: 'Europe/Paris'})}`, iconURL: client.user.avatarURL() })
.setColor('#2b2d31');
client.channels.resolve(client.config.channel).send({ embeds: [embed] })
.then(msg => {
setInterval(() => {
try {
client.config.site.forEach((s) => {
description = ""
tcpp.probe(s.ipweb, s.portweb, function(err, available0) {
tcpp.ping({ address: s.ipweb, port: s.portweb }, function(err, data) {
if (available0 == true) {
var web = `*\`🟢\` — [\`${s.nameweb}\`](https://${s.ipweb}) (\`${Math.floor(data.avg)}ms\`)*`;
} else {
var web = `*\`🔴\` — [\`${s.nameweb}\`](https://${s.ipweb})*`;
}
description += `${web}\n\n`;
});
});
});
wait(2000, function() {
const embed = new EmbedBuilder()
.setTitle('`🪄` ▸ Status Site')
.setDescription(description)
.setFooter({ text: `Last updated on ${new Date().toLocaleString('fr-FR', { timeZone: 'Europe/Paris' })}`, iconURL: client.user.avatarURL() })
.setColor('#2b2d31');
msg.edit({ embeds: [embed] }), description = '';
});
} catch {}
}, 3000);
});
});
function wait(milliseconds, callback) {
setTimeout(callback, milliseconds);
}