-
Notifications
You must be signed in to change notification settings - Fork 1
/
pythonic.js
100 lines (82 loc) · 3.33 KB
/
pythonic.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
const db = require("quick.db");
const discord = require("discord.js");
const client = new discord.Client({ disableEveryone: true });
client.login("please don't reveal your token...");
const fetch = require("node-fetch");
const fs = require("fs");
require("express")().listen(1343); //port
//uptime begins
const express = require("express");
const app = express();
const http = require("http");
app.get("/", (request, response) => {
console.log("pinged.");
response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
//helps the bot uptime itself and the bots in itself.
setInterval(() => {
var links = db.get("linkler");
if (!links) return;
var linkA = links.map(c => c.url);
linkA.forEach(link => {
try {
fetch(link);
} catch (e) {
console.log("" + e);
}
});
console.log("Pinglendi."); //message to warn that a project has been failed to ping
}, 60000);
client.on("ready", () => {
if (!Array.isArray(db.get("linkler"))) {
db.set("linkler", []);
}
});
//embeds
const help = new discord.MessageEmbed()
.setFooter("plasmic uptime yardımcısı")
.setColor("RED")
.setThumbnail('https://i.imgur.com/4M7IWwP.gif') //this is a help menu, edit is as you will
.setDescription(`Selamlar, botunu uptime etmeye hazırmısın? \n artık kolay bir şekilde botunu 7/24 aktif edebilirsin! \n\n🤹 uptime olmak için \`!ekle [glitch linki]\` yazabilirsin \n🎭 Uptime ettiğin botlarımı görmek istiyorsun \`!göster\` `)
client.on("message", message => {
if (message.author.bot) return;
var spl = message.content.split(" ");
if (spl[0] == "!ekle") { //if the message includes !ekle, feel free to change it
var link = spl[1];
fetch(link)
.then(() => {
if (
db
.get("linkler")
.map(z => z.url)
.includes(link) //sets up our little links
)
return message.channel.send(new discord.MessageEmbed().setFooter("Plasmic-uptime").setColor("RED").setDescription("Projeniz Sistemimizde Zaten Var"));
message.channel.send(new discord.MessageEmbed().setFooter("Plasmic-uptime").setColor("RED").setDescription("Projeniz Sistemimize Başarıyla Eklendi."));
db.push("linkler", { url: link, owner: message.author.id }); //saves the links to a database
}) //feel free to change the embeds
.catch(e => {
return message.channel.send(new discord.MessageEmbed().setFooter("Plasmic-uptime").setColor("RED").setDescription("Lütfen Bir Link Giriniz"));
});
}
});
client.on("message", message => {
if (message.author.bot) return;
var spl = message.content.split(" ");
if (spl[0] == "!göster") { //checks if msg includes !göster, change it as you will.
var link = spl[1];
message.channel.send(new discord.MessageEmbed().setFooter("Plasmic-uptime").setColor("RED").setDescription(`${db.get("linkler").length} Proje Aktif Tutuluyor!`));
} //this is the menu where it shows how many servers it is holding
});
client.on("message", message => {
if (message.author.bot) return;
var spl = message.content.split(" ");
if (spl[0] == "!yardım") { //checks if msg includes !yardım, change it as you will.
var link = spl[1];
message.channel.send(help); //our embed from the start, aka the help menu
}
});