5 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
57 | <%- include('../static/foot.ejs') %>
58 |
--------------------------------------------------------------------------------
/src/views/partners.ejs:
--------------------------------------------------------------------------------
1 | <%- include('parts/head', {bot, user, path}) %>
2 |
3 |
4 |
13 |
14 |
15 |
Partners
16 |
Join our discord server to partner with us.
17 |
18 | <% db.get(`partners`).map(a => { %>
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
<%= a.serverName %>
31 |
32 |
33 |
<%= a.description %>
34 |
35 |
38 |
39 |
40 |
41 | <% }) %>
42 |
43 |
44 | <%- include('parts/foot') %>
--------------------------------------------------------------------------------
/src/routers/uptime/add.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const path = require("path");
3 | const uptimedata = require("../../database/models/uptime.js");
4 | const roles = global.config.server.roles,
5 | channels = global.config.server.channels;
6 | const client = global.Client;
7 | const Discord = require("discord.js");
8 |
9 | console.log("[disbots.xyz]: Uptime/Add router loaded.");
10 |
11 | app.post("/add", global.checkAuth, async (req, res) => {
12 | const rBody = req.body;
13 | if (!rBody['link']) {
14 | res.send({ error: true, message: "Write a any link." });
15 | } else {
16 | if (!rBody['link'].match('https')) return res.send({ error: true, message: "You must enter a valid link." })
17 | const updcode = createID(24);
18 | const dde = await uptimedata.findOne({
19 | link: rBody['link']
20 | });
21 | const dd = await uptimedata.find({
22 | userID: req.user.id
23 | });
24 | if (dd.length > 9) res.send({ error: true, message: "Your uptime limit has reached." })
25 |
26 | if (dde) return res.send({ error: true, message: "This link already exists in the system." });
27 | client.users.fetch(req.user.id).then(a => {
28 | client.channels.cache.get(channels.uptimelog).send(new Discord.MessageEmbed()
29 | .setAuthor(a.username, a.avatarURL({
30 | dynamic: true
31 | }))
32 | .setDescription("New link added uptime system.")
33 | .setThumbnail(client.user.avatarURL)
34 | .setColor("GREEN")
35 | .addField("User;", `${a.tag} \`(${a.id})\``, true)
36 | .addField("Uptime Limit;", `${dd.length+1}/10`, true)
37 | )
38 | new uptimedata({
39 | server: config.serverID,
40 | userName: a.username,
41 | userID: req.user.id,
42 | link: rBody['link'],
43 | code: updcode
44 | }).save();
45 | })
46 | res.send({ success: true, message:"Link successfuly added." });
47 | }
48 | })
49 |
50 | function createID(length) {
51 | var result = '';
52 | var characters = '123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
53 | var charactersLength = characters.length;
54 | for (var i = 0; i < length; i++) {
55 | result += characters.charAt(Math.floor(Math.random() * charactersLength));
56 | }
57 | return result;
58 | }
59 | module.exports = app;
--------------------------------------------------------------------------------
/src/servers/client.js:
--------------------------------------------------------------------------------
1 | const Discord = require("discord.js");
2 | const { Client, Collection } = require("discord.js");
3 | const serverClient = global.clientSL;
4 | const config = global.config;
5 | const fs = require("fs");
6 | const { createCanvas } = require('canvas')
7 | const { MessageButton } = require("discord-buttons");
8 |
9 | require('discord-buttons')(serverClient);
10 | serverClient.on('clickButton', async (button) => {
11 | button.defer(true);
12 | });
13 |
14 | require('events').EventEmitter.prototype._maxListeners = 100;
15 | serverClient.commands = new Discord.Collection();
16 | serverClient.aliases = new Discord.Collection();
17 | fs.readdir("./src/servers/commands/", (err, files) => {
18 | if (err) console.error(err);
19 | console.log(`[disbots.xyz/servers]: ${files.length} command loaded.`);
20 | files.forEach(async f => {
21 | let props = require(`./commands/${f}`);
22 | serverClient.commands.set(props.help.name, props);
23 | props.conf.aliases.forEach(alias => {
24 | serverClient.aliases.set(alias, props.help.name);
25 | });
26 | });
27 | });
28 | let serverPrefix = config.bot.servers.prefix;
29 | serverClient.on('message', async message => {
30 | if (message.author.bot) return;
31 | if (message.channel.type === 'dm') return;
32 | if (message.content.startsWith(serverPrefix)) {
33 | let command = message.content.split(' ')[0].slice(serverPrefix.length);
34 | let params = message.content.split(' ').slice(1);
35 | let cmd
36 | if (serverClient.commands.has(command)) {
37 | cmd = serverClient.commands.get(command);
38 | } else if (serverClient.aliases.has(command)) {
39 | cmd = serverClient.commands.get(serverClient.aliases.get(command));
40 | }
41 | if(cmd) cmd.run(serverClient, message, params);
42 | if(!cmd) return;
43 | }
44 | })
45 |
46 |
47 | serverClient.on('ready',async () => {
48 | console.log("[disbots.xyz/servers]: Bot successfully connected as "+serverClient.user.tag+".");
49 | let serversdata = require("../../src/database/models/servers/server.js");
50 | const servers = await serversdata.find();
51 | serverClient.user.setPresence({ activity: { type: 'WATCHING', name: + servers.length+' Servers | disbots.xyz/servers' }, status: "dnd" });
52 | });
53 |
54 | serverClient.makeid = length => {
55 | let text = "";
56 | const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
57 | for (let i = 0; i < length; i++) {
58 | text += possible.charAt(Math.floor(Math.random() * possible.length));
59 | }
60 | return text;
61 | }
62 |
63 | module.exports = serverClient;
--------------------------------------------------------------------------------
/src/views/botlist/apps/certification.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../../parts/head', {bot, user, path}) %>
2 |
Certification | Discord Bots
3 |
4 |
5 |
6 |
7 |
»» Certificate Requirements
8 |
9 | » Your bot must have been on our site for at least 5 days.
10 | » It must be hosted 24/7. Only short downtimes are accepted to perform minor maintenance or fix errors.
11 | » It must have original features.
12 | » It must not have been forked from another existing project.
13 | » It must have a site, or a GitHub repository that provides very clear documentation about the bot's features.
14 | » It must have more than 100 servers.
15 |
16 |
17 |
»» Certificate Perks
18 |
19 | »» For bots
20 | » A special role on our Discord server to let people know that it's certified.
21 | »A special badge(
22 |
23 | ) on your bot card to let people know that it's certified.
24 |
25 | »» For bots developers
26 |
27 | » A special role on our Discord server to let people know that you are certified.
28 | » A special badge(
29 |
30 | ) on your profile to let people know that you are certified.
31 |
32 |
33 |
34 |
35 |
36 | Apply your bot
37 |
38 |
39 |
40 | <%- include('../../parts/foot') %>
--------------------------------------------------------------------------------
/src/servers/commands/link.js:
--------------------------------------------------------------------------------
1 | const Discord = require('discord.js');
2 | const client = new Discord.Client();
3 | const bots = require("../../database/models/servers/server.js");
4 |
5 | module.exports.run = async (client, message, args) => {
6 | if (args[0]) {
7 | let b = await bots.findOne({
8 | id: args[0]
9 | });
10 | const targetGuild = client.guilds.cache.get(b.id)
11 | if (!b) return message.channel.send("This server was not added to our website.\nAdd server https://disbots.xyz/server/add")
12 | let invitelink = b.link ? " [Join Server](" + b.link + ")" : "";
13 | const embed = new Discord.MessageEmbed()
14 | .setThumbnail(b.icon)
15 | .setAuthor(`${b.name} | ${b.id}`)
16 | .setDescription(b.shortDesc)
17 | .addField("ID", b.id, true)
18 | .addField("Server Name", b.name, true)
19 | .addField("Votes", b.votes, true)
20 | .addField("Bumps", b.bumps, true)
21 | .addField("Member Count", client.guilds.cache.get(args[0]).memberCount
22 | , true)
23 | .addField("Emoji Count", client.guilds.cache.get(args[0]).emojis.cache.size
24 | , true)
25 | .setColor("#7289da")
26 | .addField("Owner(s)", `<@${b.ownerID}>\n${coowner.replace("<@>", "")}`, true)
27 | .addField("Invite Link:", `${invitelink || "No Server Invite"}`, true)
28 |
29 | message.channel.send(embed)
30 | }
31 | if (!args[0]) {
32 | let b = await bots.findOne({
33 | id: message.guild.id
34 | });
35 | if (!b) return message.channel.send("This server was not added to our website.\nAdd server https://disbots.xyz/server/add")
36 | const targetGuild = client.guilds.cache.get(b.id)
37 | let invitelink = b.link ? " [Join Server](" + b.link + ")" : "";
38 | const embed = new Discord.MessageEmbed()
39 | .setThumbnail(b.icon)
40 | .setAuthor(`${b.name} | ${b.id}`)
41 | .setDescription(b.shortDesc)
42 | .addField("ID", b.id, true)
43 | .addField("Server Name", b.name, true)
44 | .addField("Votes", b.votes, true)
45 | .addField("Bumps", b.bumps, true)
46 | .addField("Member Count", client.guilds.cache.get(message.guild.id).memberCount
47 | , true)
48 | .addField("Emoji Count", client.guilds.cache.get(message.guild.id).emojis.cache.size
49 | , true)
50 | .setColor("#7289da")
51 | .addField("Owner(s)", `<@${b.ownerID}>`, true)
52 | .addField("Invite Link:", `${invitelink || "No Server Invite"}`, true)
53 |
54 | message.channel.send(embed)
55 | }
56 | };
57 | exports.conf = {
58 | enabled: true,
59 | guildOnly: false,
60 | aliases: ["l"],
61 | };
62 |
63 | exports.help = {
64 | name: "link",
65 | description: "Sends the link of server",
66 | usage: ""
67 | };
--------------------------------------------------------------------------------
/src/routers/botlist/bot/edit.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const botsdata = require("../../../database/models/botlist/bots.js");
3 | const client = global.Client;
4 | const channels = global.config.server.channels;
5 |
6 | console.log("[disbots.xyz]: Botlist/Edit router loaded.");
7 |
8 | app.get("/bot/:botID/edit", global.checkAuth, async (req, res) => {
9 | let botdata = await botsdata.findOne({
10 | botID: req.params.botID
11 | });
12 | if (!botdata) return res.redirect("/error?code=404&message=You entered an invalid bot id.")
13 | if (req.user.id == botdata.ownerID || botdata.coowners.includes(req.user.id)) {
14 | res.render("botlist/bot/bot-edit.ejs", {
15 | bot: global.Client,
16 | path: req.path,
17 | config: global.config,
18 | user: req.isAuthenticated() ? req.user : null,
19 | req: req,
20 | roles:global.config.server.roles,
21 | channels: global.config.server.channels,
22 | botdata: botdata
23 | })
24 | } else {
25 | res.redirect("/error?code=404&message=To edit this bot, you must be one of its owners.");
26 | }
27 | });
28 |
29 |
30 | app.post("/bot/:botID/edit", global.checkAuth, async (req, res) => {
31 | let rBody = req.body;
32 | let botdata = await botsdata.findOne({
33 | botID: req.params.botID
34 | })
35 | if (String(rBody['coowners']).split(',').length > 3) return res.redirect("?error=true&message=You can add up to 3 CO-Owners..")
36 | if (String(rBody['coowners']).split(',').includes(req.user.id)) return res.redirect("?error=true&message=You cannot add yourself to other CO-Owners.");
37 | await botsdata.findOneAndUpdate({
38 | botID: req.params.botID
39 | }, {
40 | $set: {
41 | botID: req.params.botID,
42 | ownerID: botdata.ownerID,
43 | prefix: rBody['prefix'],
44 | longDesc: rBody['longDesc'],
45 | shortDesc: rBody['shortDesc'],
46 | tags: rBody['tags'],
47 | github: rBody['github'],
48 | website: rBody['website'],
49 | support: rBody['support'],
50 | invite: rBody['invite'],
51 | coowners: String(rBody['coowners']).split(','),
52 | backURL: rBody['background'],
53 | }
54 | }, function(err, docs) {})
55 | client.users.fetch(req.params.botID).then(a => {
56 | client.channels.cache.get(channels.botlog).send(`<:edit:853596640710885406> <@${req.user.id}> edited **${a.tag}**`)
57 | res.redirect(`?success=true&message=Your bot has been successfully edited.&botID=${req.params.botID}`)
58 | })
59 | })
60 |
61 | module.exports = app;
--------------------------------------------------------------------------------
/src/routers/botlist/vote.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const botsdata = require("../../database/models/botlist/bots.js");
3 | const client = global.Client;
4 | const channels = global.config.server.channels;
5 |
6 | console.log("[disbots.xyz]: Botlist/Vote router loaded.");
7 |
8 | app.get("/bot/:botID/vote", async (req, res) => {
9 | let botdata = await botsdata.findOne({
10 | botID: req.params.botID
11 | });
12 | if (!botdata) return res.redirect("/error?code=404&message=You entered an invalid bot id.");
13 | if (req.user) {
14 | if (!req.user.id === botdata.ownerID || req.user.id.includes(botdata.coowners)) {
15 | if (botdata.status != "Approved") return res.redirect("/error?code=404&message=You entered an invalid bot id.");
16 | }
17 | }
18 | res.render("botlist/vote.ejs", {
19 | bot: global.Client,
20 | path: req.path,
21 | config: global.config,
22 | user: req.isAuthenticated() ? req.user : null,
23 | req: req,
24 | botdata: botdata,
25 | roles:global.config.server.roles,
26 | channels: global.config.server.channels
27 | })
28 | })
29 | app.post("/bot/:botID/vote", global.checkAuth, async (req, res) => {
30 | const votes = require("../../database/models/botlist/vote.js");
31 | let botdata = await botsdata.findOne({
32 | botID: req.params.botID
33 | });
34 | let x = await votes.findOne({
35 | user: req.user.id,
36 | bot: req.params.botID
37 | })
38 | if (x) return res.redirect("/error?code=400&message=You can vote every 12 hours.");
39 | await votes.findOneAndUpdate({
40 | bot: req.params.botID,
41 | user: req.user.id
42 | }, {
43 | $set: {
44 | Date: Date.now(),
45 | ms: 43200000
46 | }
47 | }, {
48 | upsert: true
49 | })
50 | await botsdata.findOneAndUpdate({
51 | botID: req.params.botID
52 | }, {
53 | $inc: {
54 | votes: 1
55 | }
56 | })
57 | client.channels.cache.get(channels.votes).send(`**${botdata.username}** just got **+1 Vote** from **${req.user.username}** **\`[Total Votes ${botdata.votes + 1}]\`**`)
58 | if(botdata.votes+1 == 100) {
59 | client.channels.cache.get(channels.votes).send(`Congrats ${botdata.ownerID}! Your bot **${botdata.username}** has reached 100 votes!!`)
60 | }
61 | if(botdata.votes+1 == 52) {
62 | client.channels.cache.get(channels.votes).send(`Congrats <@${botdata.ownerID}>! Your bot **${botdata.username}** has reached 52 votes!!`)
63 | }
64 | return res.redirect(`/bot/${req.params.botID}/vote?success=true&message=You voted successfully. You can vote again after 12 hours.`);
65 | })
66 |
67 |
68 | module.exports = app;
--------------------------------------------------------------------------------
/src/routers/servers/server/view.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const db = require("../../../database/models/servers/server.js");
3 | const botsdb = require("../../../database/models/botlist/bots.js");
4 | const client = global.clientSL;
5 | const channels = global.config.server.channels;
6 | const clientTwo = global.Client;
7 | console.log("[disbots.xyz/servers]: View router loaded.");
8 |
9 | app.get("/:guildID", async (req,res) => {
10 | let sdb = await db.findOne({ id: req.params.guildID });
11 | if(!req.params.guildID) return res.redirect('/servers');
12 | if(!sdb) return res.redirect('/servers');
13 | let page = req.query.page || 1;
14 | let data = sdb.rates || [];
15 | if ((page > Math.ceil(data.length / 5))) {
16 | page = 1;
17 | }
18 | if (Math.ceil(data.length / 5) < 1) {
19 | page = 1;
20 | };
21 | let checkGuild = global.clientSL.guilds.cache.get(req.params.guildID);
22 | if(!checkGuild) return res.redirect('/servers');
23 |
24 | let sdata = await db.findOne({ id: req.params.guildID });
25 | let rateAuthors = new Array();
26 | (sdata.rates || []).map(x => {
27 | rateAuthors.push(client.users.cache.get(x.author))
28 | })
29 | /* ANALYTICS */
30 | let referresURL = String(req.headers.referer).replace("undefined", "Unkown").split('.').join(',');
31 | await db.updateOne({
32 | id: req.params.guildID
33 | }, {
34 | $inc: {
35 | analytics_visitors: 1
36 | }
37 | })
38 |
39 | var getIP = require('ipware')().get_ip;
40 | var ipInfo = getIP(req);
41 | var geoip = require('geoip-lite');
42 | var ip = ipInfo.clientIp;
43 | var geo = geoip.lookup(ip);
44 |
45 | if (geo) {
46 | let CountryCode = geo.country || "TR"
47 | await db.updateOne({
48 | id: req.params.guildID
49 | }, {
50 | $inc: {
51 | [`country.${CountryCode}`]: 1
52 | }
53 | })
54 | }
55 | await db.updateOne({
56 | id: req.params.guildID
57 | }, {
58 | $inc: {
59 | [`analytics.${referresURL}`]: 1
60 | }
61 | })
62 |
63 | res.render("servers/server/view.ejs", {
64 | bot: global.clientSL,
65 | path: req.path,
66 | config: global.config,
67 | user: req.isAuthenticated() ? req.user : null,
68 | req: req,
69 | roles:global.config.server.roles,
70 | channels: global.config.server.channels,
71 | data: data,
72 | guildGet: checkGuild,
73 | page: page,
74 | sdb: sdb,
75 | rateAuthors: rateAuthors,
76 | moment: require("moment")
77 | })
78 | })
79 |
80 | module.exports = app;
--------------------------------------------------------------------------------
/src/views/botlist/apps/certificate-app.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../../parts/head', {bot, user, path}) %>
2 |
3 |
45 |
46 |
74 | <%- include('../../parts/foot') %>
75 |
--------------------------------------------------------------------------------
/src/servers/commands/profile.js:
--------------------------------------------------------------------------------
1 | const Discord = require('discord.js')
2 | const disbots = require("disbots-xyz");
3 | const botdata = require("../../database/models/botlist/bots.js")
4 | const serverdata = require("../../database/models/servers/server.js");
5 | const pdata = require("../../database/models/profile.js");
6 |
7 | module.exports.run = async (client, message, args) => {
8 | if (args[0]) {
9 | var users = message.mentions.users.first()
10 | let x = await botdata.find();
11 | let bots = await x.filter(a => a.ownerID ==users.id || a.coowners.includes(users.id))
12 | let y = await serverdata.find();
13 | let pd = await serverdata.find({ userID: users.id })
14 | let servers = await y.filter(b => b.ownerID == users.id)
15 | let pdatas = await pd.filter(ps => ps.userID == users.id)
16 | const embed = new Discord.MessageEmbed()
17 | .setTitle('Profile')
18 | .setAuthor(users.tag, users.avatarURL({ dynamic: true }))
19 | .setDescription(`\n[Click to View your Profile!](https://disbots.xyz/user/${users.id})\n\n**Analytics**\n You own **${bots.length || "0"} Bots** and **${servers.length} Servers**`)
20 | .setColor("#7289da")
21 | .addField("Bots [" + bots.length + "]", `${!bots ? "" : bots.map(a => "<@" + a.botID + "> **[**[View " + a.username + "](https://disbots.xyz/bot/" + a.botID + ")**]**").join("\n")}\n\n **Servers [${servers.length}]** \n${!servers ? "" : servers.map(b => b.name + " **[**[View " + b.name + "](https://disbots.xyz/server/" + b.id + ")**]**").join("\n")}`, true)
22 | .setThumbnail(users.avatarURL({ dynamic: true }))
23 | message.channel.send(embed)
24 | }
25 | if (!args[0]) {
26 | var users = message.author
27 | let x = await botdata.find();
28 | let bots = await x.filter(a => a.ownerID ==users.id || a.coowners.includes(users.id))
29 | let y = await serverdata.find();
30 | let pd = await serverdata.find({ userID: users.id })
31 | let servers = await y.filter(b => b.ownerID == users.id)
32 | let pdatas = await pd.filter(ps => ps.userID == users.id)
33 | const embed = new Discord.MessageEmbed()
34 | .setTitle('Profile')
35 | .setAuthor(users.tag, users.avatarURL({ dynamic: true }))
36 | .setDescription(`\n[Click to View your Profile!](https://disbots.xyz/user/${users.id})\n\n**Analytics**\n You own **${bots.length || "0"} Bots** and **${servers.length} Servers**`)
37 | .setColor("#7289da")
38 | .addField("Bots [" + bots.length + "]", `${!bots ? "" : bots.map(a => "<@" + a.botID + "> **[**[View " + a.username + "](https://disbots.xyz/bot/" + a.botID + ")**]**").join("\n")}\n\n **Servers [${servers.length}]** \n${!servers ? "" : servers.map(b => b.name + " **[**[View " + b.name + "](https://disbots.xyz/server/" + b.id + ")**]**").join("\n")}`, true)
39 | .setThumbnail(users.avatarURL({ dynamic: true }))
40 | message.channel.send(embed)
41 | }};
42 | exports.conf = {
43 | enabled: true,
44 | guildOnly: false,
45 | aliases: [],
46 | };
47 |
48 | exports.help = {
49 | name: "profile",
50 | description: "",
51 | usage: ""
52 | };
--------------------------------------------------------------------------------
/src/views/botlist/bot-rules.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../parts/head', {bot, user, path}) %>
2 |
3 |
Rules | Discord Bots
4 |
9 |
10 |
11 |
12 |
Bot Rules
13 |
14 | » 1. The conditions for adding bots are as follows;
15 | a. You have to choose a tag.
16 | b. You have to enter the bot ID correctly.
17 | c. The opening date of your bot must be 2 weeks before it is added.
18 | d. Your bot should not be a duplicate of other bots.
19 | e. Your bot's avatar must not belong to another bot.
20 | » 2. Bot page content that is not allowed;
21 | a. You should not redirect to any unrelated site.
22 | b. You should not put another bot list site as an iframe.
23 | c. You should not post pictures that contain nudity.
24 | d. You must provide detailed information about your bot.
25 | e. While giving detailed information about your bot, you should use it in the pictures.
26 | f. You must write the correct prefix.
27 | g. You have to put your bot's site as an iframe or write your bot's commands.
28 | » 3. Not allowed in bot commands;
29 | a. Another bot should not be advertised on your bot.
30 | b. There should be no emojis in any of your bot's commands that will cause an epilepsy crisis.
31 | c. Your bot's commands must be unique.
32 | d. There should be no batch-processing commands on your bot.
33 | e. Your bot should not have any prohibited commands.
34 | f. Your bot must have been opened at least 2 weeks ago.
35 | g. Your bot must be unique.
36 |
37 | » Prohibited Commands;
38 | 1. Give / Get Role For Everyone
39 | 2. Blast the Server
40 | 3. DM Announcement
41 | 4. Spam Message
42 | 5. Send a private message
43 |
44 |
45 |
46 |
47 |
48 | Apply your bot
49 |
50 |
51 |
52 | <%- include('../parts/foot') %>
53 |
--------------------------------------------------------------------------------
/src/views/admin/administrator/partners.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
6 |
20 |
21 | Owner ID*
22 |
23 |
24 |
25 | Background URL*
26 |
27 |
28 |
29 | Website*
30 |
31 |
32 | Submit
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
68 | <%- include('../static/foot.ejs') %>
69 |
--------------------------------------------------------------------------------
/src/routers/codeshare/view.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const codesSchema = require("../../database/models/codes.js");
3 | const client = global.Client;
4 |
5 | console.log("[disbots.xyz]: Code Share/View router loaded.");
6 |
7 | app.get("/view/:code", global.checkAuth, async (req, res) => {
8 | let kod = req.params.code;
9 | let koddata = await codesSchema.findOne({
10 | code: kod
11 | })
12 | if (!koddata) return res.redirect('/codes/list?error=true&message=You entered an invalid code.')
13 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id)) return res.redirect("/error?code=403&message=To do this, you have to join our discord server.");
14 | if (koddata.codeCategory == "javascript") {
15 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.javascript)) return res.redirect("/error?code=403&message=You is not competent to do this.");
16 | }
17 | if (koddata.codeCategory == "html") {
18 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.html)) return res.redirect("/error?code=403&message=You is not competent to do this.");
19 | }
20 | if (koddata.codeCategory == "subs") {
21 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.substructure)) return res.redirect("/error?code=403&message=You is not competent to do this.");
22 | }
23 | if (koddata.codeCategory == "5invites") {
24 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.fiveInvite)) return res.redirect("/error?code=403&message=You is not competent to do this.");
25 | }
26 | if (koddata.codeCategory == "10invites") {
27 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.tenInvite)) return res.redirect("/error?code=403&message=You is not competent to do this.");
28 | }
29 | if (koddata.codeCategory == "15invites") {
30 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.fifteenInvite)) return res.redirect("/error?code=403&message=You is not competent to do this.");
31 | }
32 | if (koddata.codeCategory == "20invites") {
33 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.twentyInvite)) return res.redirect("/error?code=403&message=You is not competent to do this.");
34 | }
35 | if (koddata.codeCategory == "bdfd") {
36 | if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id).roles.cache.get(config.server.roles.codeshare.bdfd)) return res.redirect("/error?code=403&message=You is not competent to do this.");
37 | }
38 | res.render("codeshare/codeview.ejs", {
39 | bot: global.Client,
40 | path: req.path,
41 | config: global.config,
42 | user: req.isAuthenticated() ? req.user : null,
43 | req: req,
44 | roles:global.config.server.roles,
45 | channels: global.config.server.channels,
46 | koddata: koddata
47 | });
48 | })
49 |
50 |
51 | module.exports = app;
--------------------------------------------------------------------------------
/src/routers/admin/maintence.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const maintenceSchema = require("../../database/models/maintence.js");
3 | const client = global.Client;
4 | const channels = global.config.server.channels,
5 | roles = global.config.server.roles;
6 |
7 | console.log("[disbots.xyz]: Admin/Maintence router loaded.");
8 |
9 | app.get("/admin/maintence", global.checkAuth, async (req, res) => {
10 | if (!config.bot.owners.includes(req.user.id)) return res.redirect('../admin');
11 | res.render("admin/administrator/maintence.ejs", {
12 | bot: global.Client,
13 | path: req.path,
14 | config: global.config,
15 | user: req.isAuthenticated() ? req.user : null,
16 | req: req,
17 | roles:global.config.server.roles,
18 | channels: global.config.server.channels
19 | })
20 | });
21 | app.post("/admin/maintence", global.checkAuth, async (req, res) => {
22 | if (!config.bot.owners.includes(req.user.id)) return res.redirect('../admin');
23 | let bakimdata = await maintenceSchema.findOne({
24 | server: config.server.id
25 | });
26 | if (bakimdata) return res.redirect('../admin/maintence?error=true&message=Maintenance mode has already been activated for this site.');
27 | client.channels.cache.get(global.config.server.channels.webstatus).send(`
DisBots has been switched to __Maintenance__ due to **${req.body.reason}** [||<@&861221279080120371>||]`).then(a => {
28 | new maintenceSchema({
29 | server: config.server.id,
30 | reason: req.body.reason,
31 | bakimmsg: a.id
32 | }).save();
33 | })
34 | return res.redirect('../admin/maintence?success=true&message=Maintence opened.');
35 | });
36 | app.post("/admin/unmaintence", global.checkAuth, async (req, res) => {
37 | const dc = require("discord.js");
38 | if (!config.bot.owners.includes(req.user.id)) return res.redirect('../admin');
39 | let bakimdata = await maintenceSchema.findOne({
40 | server: config.server.id
41 | });
42 | if (!bakimdata) return res.redirect('../admin/maintence?error=true&message=The website is not in maintenance mode anyway.');
43 | const bakimsonaerdikardesDisbots = new dc.MessageEmbed()
44 | .setAuthor("Disbots.xyz", client.user.avatarURL())
45 | .setThumbnail(client.user.avatarURL())
46 | .setColor("GREEN")
47 | .setDescription(` DisBots are **active** again!\n[Click to redirect website](https://disbots.xyz)`)
48 | .setFooter("Disbots © All rights reserved.");
49 | await client.channels.cache.get(channels.webstatus).messages.fetch(bakimdata.bakimmsg).then(a => {
50 | a.edit(`~~ Disbots has been switched to __maintance__ due to **${bakimdata.reason}** ~~`, bakimsonaerdikardesDisbots)
51 | })
52 | client.channels.cache.get(channels.webstatus).send(".").then(b => {
53 | b.delete({
54 | timeout: 500
55 | })
56 | })
57 | await maintenceSchema.deleteOne({
58 | server: config.server.id
59 | }, function(error, server) {
60 | if (error) console.log(error)
61 | });
62 | return res.redirect('../admin/maintence?success=true&message=Maintenance mode has been shut down successfully.');
63 | });
64 |
65 | module.exports = app;
--------------------------------------------------------------------------------
/src/views/botlist/search.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../parts/head', {bot, user, path}) %>
2 | <%- include('../parts/section') %>
3 |
4 |
5 |
6 |
Search results for "<%= req.query.q %>"
7 |
They are ranked according to the votes they received.
8 |
9 |
10 |
11 | <%
12 | for (let i = (page - 1) * 6; i < data.length; i++) {
13 | if (i === 6 * page) break;
14 | let a = data.sort((a, b) => b.votes - a.votes)[i]
15 | %>
16 | <% if(a.status === "Approved") { %>
17 | %>
18 |
19 |
20 |
21 |
);">
22 |
23 |
24 |
25 |
26 |
27 | <%= a.votes || "0" %>
28 | <%= a.serverCount || "N/A" %>
29 |
30 |
<%= a.username %>
31 | <% if(a.certificate === "Certified") { %>
32 |
33 | <% } %>
34 |
35 |
<%= a.shortDesc %>
36 |
37 |
41 |
42 |
43 |
44 | <% } %>
45 | <% } %>
46 |
47 |
48 |
49 |
50 | <%
51 | if (page != 1) {
52 | %>
53 |
54 |
55 |
56 | <% } else { %>
57 |
58 |
59 |
60 | <% } %>
61 |
62 | <%= page %>
63 |
64 | <%
65 | if (page != Math.ceil(data.length / 6) && data.length > 0) {
66 | %>
67 |
68 |
69 |
70 | <% } %>
71 |
72 |
73 | <%- include('../parts/foot') %>
74 |
--------------------------------------------------------------------------------
/src/views/admin/report-app.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot ID
22 | Reason
23 | Action
24 |
25 |
26 |
27 | <% apps.map(b => {%>
28 |
29 | <%= b.botID %>
30 | <%= b.reason %>
31 |
32 | Delete Bot
33 | Delete Report
34 |
35 |
36 | <% }) %>
37 |
38 |
39 |
40 | Bot ID
41 | Reason
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
77 |
78 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/serverapproved.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Action
24 |
25 |
26 |
27 | <% serverdata.filter(a => a.status === "Approved").map(b => {%>
28 |
29 | <%= b.name %>
30 | <%= b.ownerID %>
31 |
32 | Delete
33 |
34 |
35 | <% }) %>
36 |
37 |
38 |
39 | Server Name
40 | Owner
41 | Invite
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
77 |
78 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/botlist/vote.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../parts/head', {bot, user, path}) %>
2 |
3 |
Vote | <%= botdata.username %> | Discord Bots
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
<%= botdata.username %>#<%= botdata.discrim %>
17 | <% if(user) { %>
18 |
You can support the bot by voting this bot.
19 |
You can vote every 12 hours.
20 |
21 |
22 | Confirm to Vote
23 |
24 | <% } else { %>
25 |
46 | <% } %>
47 |
48 |
49 |
50 |
51 | Back to <%= botdata.username %>
52 |
53 |
54 |
55 |
87 | <%- include('../parts/foot') %>
88 |
--------------------------------------------------------------------------------
/src/views/admin/uptimes.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Username
22 | Link
23 | Uptime Code
24 | Action
25 |
26 |
27 |
28 | <% updata.map(b => {%>
29 |
30 | <%= b.userName %>
31 | <%= b.link %>
32 | <%= b.code %>
33 |
34 | Delete
35 |
36 |
37 | <% }) %>
38 |
39 |
40 |
41 | Username
42 | Link
43 | Uptime Code
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
79 |
80 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/premium-server.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Action
24 |
25 |
26 |
27 | <% serverdata.filter(a => a.status == "Approved").map(row => {%>
28 |
29 | <%= row.name %>
30 | <%= row.ownerID %>
31 |
32 | Give Premium
33 | Remove Premium
34 |
35 |
36 | <% }) %>
37 |
38 |
39 |
40 | Bot Name
41 | Owner
42 | Prefix
43 | Invite
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
79 |
80 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/premium-servers.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% serverdata.filter(a => a.status == "Approved").map(row => {%>
30 |
31 | <%= row.username %>
32 | <%= row.ownerName %>
33 | <%= row.prefix %>
34 |
35 | Give Premium
36 | Remove Premium
37 |
38 |
39 | <% }) %>
40 |
41 |
42 |
43 | Bot Name
44 | Owner
45 | Prefix
46 | Invite
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
82 |
83 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/news.ejs:
--------------------------------------------------------------------------------
1 | <%- include('parts/head', {bot, user, path}) %>
2 |
3 |
4 |
5 |
6 |
7 |
Official Disbots News
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
35 |
36 |
37 |
38 | News
39 |
40 |
41 |
42 | <% db.get(`news`).map(a => { %>
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | written by: <%= bot.users.cache.get(a.ownerID) ? bot.users.cache.get(a.ownerID).username : "undefined" %>#<%= bot.users.cache.get(a.ownerID) ? bot.users.cache.get(a.ownerID).discriminator : "0000" %>
53 |
54 |
55 |
56 | publish date: <%= a.date %>
57 |
58 |
<%= a.serverName %>
59 |
60 |
61 |
<%= a.description %>
62 |
63 |
64 |
65 |
66 | <% }) %>
67 |
68 |
69 |
70 |
75 |
Submit
79 | <%- include('parts/foot') %>
80 |
--------------------------------------------------------------------------------
/src/views/admin/administrator/user-ban.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Ban
9 |
10 |
11 |
21 |
22 | Ban
23 |
24 |
25 |
26 |
Unban
27 |
28 |
29 |
36 |
37 | UnBan
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | User
50 | Reason
51 | Authorized
52 |
53 |
54 |
55 |
56 | <% bandata.map(a => { %>
57 |
58 | <%= a.user %>
59 | <%= a.sebep %>
60 | <%= a.yetkili %>
61 |
62 | <% }) %>
63 |
64 |
65 |
66 | User
67 | Reason
68 | Authorized
69 |
70 |
71 |
72 |
73 |
74 |
75 |
103 |
104 | <%- include('../static/foot.ejs') %>
--------------------------------------------------------------------------------
/src/views/admin/certified-bots.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% botdata.filter(a => a.certificate == "Certified").map(row => {%>
30 |
31 | <%= row.username %>
32 | <%= row.ownerName %>
33 | <%= row.prefix %>
34 | Perm 0
35 | Perm 8
36 |
37 | Delete Certificate
38 |
39 |
40 | <% }) %>
41 |
42 |
43 |
44 | Bot Name
45 | Owner
46 | Prefix
47 | Invite
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
83 |
84 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/approved.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% botdata.filter(a => a.status === "Approved").map(b => {%>
30 |
31 | <%= b.username %>
32 | <%= b.ownerName %>
33 | <%= b.prefix %>
34 | Perm 0
35 | Perm 8
36 |
37 | Delete
38 |
39 |
40 | <% }) %>
41 |
42 |
43 |
44 | Bot Name
45 | Owner
46 | Prefix
47 | Invite
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
83 |
84 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/routers/servers/add.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const db = require("../../database/models/servers/server.js");
3 | const client = global.clientSL;
4 | const roles = global.config.server.roles;
5 | const channels = global.config.server.channels;
6 |
7 | console.log("[disbots.xyz/servers]: Add Server router loaded.");
8 |
9 | app.get("/add", global.checkAuth, async (req,res) => {
10 | if(!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id)) return res.redirect("/error?code=403&message=To do this, you have to join our discord server.");
11 | res.render("servers/add.ejs", {
12 | bot: global.clientSL,
13 | path: req.path,
14 | config: global.config,
15 | user: req.isAuthenticated() ? req.user : null,
16 | req: req,
17 | roles:global.config.server.roles,
18 | channels: global.config.server.channels
19 | })
20 | })
21 | app.post("/add", global.checkAuth, async (req,res) => {
22 | let { guildID, link, autoCreate, shortDesc, longDesc, tags } = req.body;
23 | const guild = client.guilds.cache.get(req.body.guildID);
24 | let checkGuild = await db.findOne({ id: guildID });
25 | if(checkGuild) return res.send({ error: true, message: "This server already exist system." });
26 | if(!guildID || !longDesc || !shortDesc || !tags) return res.send({ error: true, message: "Fill the must any blanks."});
27 | if(!link && !autoCreate) return res.send({ error: true, message: "Fill the must any blanks."});
28 | if (!guild) return res.send({ error: true, message: "You have to add me to that server first." });
29 | const member = guild.members.cache.get(req.user.id);
30 | if(!member){
31 | try{ await guild.members.fetch();
32 | member = guild.members.cache.get(req.user.id);
33 | } catch (err) {
34 | res.send({ error: true, message: `Couldn't fetch the members of ${guild.id}: ${err}`})
35 | }
36 | }
37 | if (!member) return res.send({ error: true, message: "You can only add servers with ADMINISTRATOR authorization." });
38 | if (!member.permissions.has("ADMINISTRATOR")) return res.send({ error: true, message: "You can only add servers with ADMINISTRATOR authorization." });
39 | await db.updateOne({
40 | id: guildID
41 | }, {
42 | $set:
43 | {
44 | id: guildID,
45 | name: guild.name,
46 | icon: guild.iconURL({ dynamic: true }),
47 | status: "Approved",
48 | premium: "None",
49 | ownerID: guild.owner.id ? guild.owner.id : req.user.id,
50 | longDesc: req.body.longDesc,
51 | shortDesc: req.body.shortDesc,
52 | tags: req.body.tags,
53 | votes: 0
54 | }
55 | }, { upsert: true })
56 |
57 | if(autoCreate === "true") {
58 | guild.fetchInvites().then(async fetchinvite => {
59 | fetchinvite.array().find(a => a.inviter.id === client.user.id)
60 | ? fetchinvite.array().find(a => a.inviter.id === client.user.id).code
61 | : await guild.channels.cache.random().createInvite({ maxAge: 0 });
62 | });
63 | guild.fetchInvites().then(async fetchinvite => {
64 | let inviteURL = fetchinvite
65 | .array()
66 | .find(a => a.inviter.id === client.user.id).url;
67 | await db.updateOne({
68 | id: req.params.guildID
69 | }, {
70 | $set: {
71 | link: inviteURL
72 | }
73 | }, { upsert: true })
74 | })
75 |
76 | } else {
77 | await db.updateOne({
78 | id: req.params.guildID
79 | }, {
80 | $set: {
81 | link: req.body.link
82 | }
83 | }, { upsert: true })
84 | }
85 | let checkGuilds = await db.findOne({ id: guildID });
86 | let guilda = client.guilds.cache.get(global.config.server.id)
87 | guilda.members.cache.get(checkGuilds.ownerID).roles.add(global.config.server.roles.botlist.ownerserver);
88 | client.channels.cache.get(global.config.server.channels.botlog).send(`<:add:853596640824655872> <@${checkGuilds.ownerID}> added **${guild.name}** \n https://disbots.xyz/server/${checkGuilds.id}/`)
89 | return res.send({ success: true, message: "Server succesfuly added." });
90 | })
91 |
92 | module.exports = app;
--------------------------------------------------------------------------------
/src/views/admin/boosted-bots.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% botdata.filter(a => a.status == "Approved").map(row => {%>
30 |
31 | <%= row.username %>
32 | <%= row.ownerName %>
33 | <%= row.prefix %>
34 | Perm 0
35 | Perm 8
36 |
37 | give boost
38 | remove boost
39 |
40 |
41 | <% }) %>
42 |
43 |
44 |
45 | Bot Name
46 | Owner
47 | Prefix
48 | Invite
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
84 |
85 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/promoted-bots.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% botdata.filter(a => a.status == "Approved").map(row => {%>
30 |
31 | <%= row.username %>
32 | <%= row.ownerName %>
33 | <%= row.prefix %>
34 | Perm 0
35 | Perm 8
36 |
37 | promote
38 | remove promote
39 |
40 |
41 | <% }) %>
42 |
43 |
44 |
45 | Bot Name
46 | Owner
47 | Prefix
48 | Invite
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
84 |
85 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/unapproved.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot Name
22 | Owner
23 | Prefix
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% botdata.filter(a => a.status === "UnApproved").map(b => {%>
30 |
31 | <%= b.username %>
32 | <%= b.ownerName %>
33 | <%= b.prefix %>
34 | Perm 0
35 | Custom Perm
36 |
37 | Confirm
38 | Delete
39 |
40 |
41 | <% }) %>
42 |
43 |
44 |
45 | Bot Name
46 | Owner
47 | Prefix
48 | Invite
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
84 |
85 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/views/admin/certificate-apps.ejs:
--------------------------------------------------------------------------------
1 | <%- include('static/head.ejs', { bot,user,path}) %>
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Bot ID
22 | Future
23 | 100+ servers?
24 | Invite
25 | Action
26 |
27 |
28 |
29 | <% apps.map(b => {%>
30 |
31 | <%= b.botID %>
32 | <%= b.future %>
33 | Yes
34 | Perm 0
35 | Perm 8
36 |
37 |
38 | Give Certificate
39 | Delete Certificate
40 |
41 |
42 | <% }) %>
43 |
44 |
45 |
46 | Bot ID
47 | Future
48 | 100+ servers?
49 | Invite
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
85 |
86 | <%- include('static/foot.ejs', { bot,user,path}) %>
--------------------------------------------------------------------------------
/src/routers/api/api.js:
--------------------------------------------------------------------------------
1 | const app = require('express').Router();
2 | const botsdata = require("../../database/models/botlist/bots.js");
3 | const channels = global.config.server.channels,
4 | roles = global.config.server.roles;
5 |
6 | console.log("[disbots.xyz]: Api router loaded.");
7 |
8 | app.get("/api", async (req, res) => {
9 | res.json({
10 | "Hello": "World",
11 | "Template By": "disbots.xyz"
12 | });
13 | });
14 | app.get("/api/bots/:botID", async (req, res) => {
15 | const botinfo = await botsdata.findOne({
16 | botID: req.params.botID
17 | })
18 | if (!botinfo) return res.json({
19 | "error": "You entered invalid bot id."
20 | })
21 | res.json({
22 | avatar: botinfo.avatar,
23 | botID: botinfo.botID,
24 | username: botinfo.username,
25 | discrim: botinfo.discrim,
26 | shortDesc: botinfo.shortDesc,
27 | prefix: botinfo.prefix,
28 | votes: botinfo.votes,
29 | ownerID: botinfo.ownerID,
30 | owner: botinfo.ownerName,
31 | coowners: botinfo.coowners,
32 | tags: botinfo.tags,
33 | longDesc: botinfo.longDesc,
34 | certificate: botinfo.certificate,
35 | github: botinfo.github,
36 | support: botinfo.support,
37 | website: botinfo.website,
38 | });
39 | });
40 | app.get("/api/bots/check/:userID", async (req, res) => {
41 | let token = req.header('Authorization');
42 | if (!token) return res.json({
43 | "error": "You must enter a bot token."
44 | })
45 | if (!req.params.userID) return res.json({
46 | "error": "You must enter a user id."
47 | })
48 | const botdata = await botsdata.findOne({
49 | token: token
50 | })
51 | if (!botdata) return res.json({
52 | "error": "You entered an invalid bot token."
53 | })
54 | const vote = await voteSchema.findOne({
55 | bot: botdata.botID,
56 | user: req.params.userID
57 | })
58 | if (vote) {
59 | res.json({
60 | voted: true
61 | });
62 | } else {
63 | res.json({
64 | voted: false
65 | });
66 | }
67 | });
68 | app.post("/api/bots/stats", async (req, res) => {
69 | let token = req.header('Authorization');
70 | if (!token) return res.json({
71 | "error": "You must enter a bot token."
72 | })
73 | const botdata = await botsdata.findOne({
74 | token: token
75 | })
76 | if (!botdata) return res.json({
77 | "error": "You entered an invalid bot token."
78 | })
79 | if (botdata) {
80 | await botsdata.updateOne({
81 | botID: botdata.botID
82 | }, {
83 | $set: {
84 | serverCount: req.header('serverCount')
85 | }
86 | })
87 | if (req.header('shardCount')) {
88 | await botsdata.updateOne({
89 | botID: botdata.botID
90 | }, {
91 | $set: {
92 | shardCount: req.header('shardCount')
93 | }
94 | })
95 | }
96 | }
97 | });
98 |
99 | app.post("/api/search", async (req, res) => {
100 | let key = req.body.key;
101 | if (key.length <= 0) return res.json({
102 | status: true,
103 | data: []
104 | });
105 | let bots = require("../../database/models/botlist/bots.js")
106 | let bot = await bots.find();
107 | let data = await bot.filter(d => d.status == "Approved" && d.username.toLowerCase().includes(key.toLowerCase())).sort((a,b) => b.votes - a.votes);
108 | res.json({
109 | status: true,
110 | data: data
111 | });
112 | });
113 | app.post("/api/search/servers", async (req, res) => {
114 | let key = req.body.key;
115 | if (key.length <= 0) return res.json({
116 | status: true,
117 | data: []
118 | });
119 | let servers = require("../../database/models/servers/server.js")
120 | let server = await servers.find();
121 | let data = await server.filter(d => global.clientSL.guilds.cache.get(d.id) && d.name.toLowerCase().includes(key.toLowerCase())).sort((a,b) => global.clientSL.guilds.cache.get(b).memberCount - global.clientSL.guilds.cache.get(a).memberCount);
122 | res.json({
123 | status: true,
124 | data: data
125 | });
126 | });
127 |
128 | module.exports = app;
--------------------------------------------------------------------------------
/src/views/botlist/bots.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../parts/head', {bot, user, path}) %>
2 | <%- include('../parts/section') %>
3 |
4 |
5 |
6 |
All Bots
7 |
They are ranked according to the votes they received.
8 |
9 |
10 |
11 | <%
12 | for (let i = (page - 1) * 6; i < data.length; i++) {
13 | if (i === 6 * page) break;
14 | let a = data.sort((a, b) => b.votes - a.votes)[i]
15 | %>
16 | <% if(a.status === "Approved") { %>
17 | %>
18 |
19 |
20 |
21 |
);">
22 |
23 |
24 |
25 |
26 |
27 | <%= a.votes || "0" %>
28 | <%= a.serverCount || "N/A" %>
29 |
30 |
<%= a.username %>
31 | <% if(a.certificate === "Certified") { %>
32 |
33 | <% } %>
34 |
35 |
<%= a.shortDesc %>
36 |
37 |
41 |
42 |
43 |
44 |
45 | <% } %>
46 | <% } %>
47 |
48 |
49 |
50 |
51 |
52 | <%
53 | if (page != 1) {
54 | %>
55 |
56 |
57 |
58 | <% } else { %>
59 |
60 |
61 |
62 | <% } %>
63 |
64 | <%= page %>
65 |
66 | <%
67 | if (page != Math.ceil(data.length / 6) && data.length > 0) {
68 | %>
69 |
70 |
71 |
72 | <% } %>
73 |
74 |
75 |
103 | <%- include('../parts/foot') %>
104 |
--------------------------------------------------------------------------------
/src/views/botlist/bots-certified.ejs:
--------------------------------------------------------------------------------
1 | <%- include('../parts/head', {bot, user, path}) %>
2 | <%- include('../parts/section') %>
3 |
4 |
5 |
6 |
Certified Bots
7 |
They are ranked according to the votes they received.
8 |
9 |
10 |
11 | <%
12 | for (let i = (page - 1) * 6; i < data.length; i++) {
13 | if (i === 6 * page) break;
14 | let a = data.filter(a => a.certificate === "Certified").sort((a, b) => b.votes - a.votes)[i]
15 | %>
16 |
17 |
18 |
);">
19 |
20 |
21 |
22 |
23 |
24 | <%= a.votes || "0" %>
25 | <%= a.serverCount || "N/A" %>
26 |
27 |
<%= a.username %>
28 | <% if(a.certificate === "Certified") { %>
29 |
30 | <% } %>
31 |
32 |
<%= a.shortDesc %>
33 |
34 |
38 |
39 |
40 | <% } %>
41 |
42 |
43 |
44 |
45 |
46 | <%
47 | if (page != 1) {
48 | %>
49 |
50 |
51 |
52 | <% } else { %>
53 |
54 |
55 |
56 | <% } %>
57 |
58 | <%= page %>
59 |
60 | <%
61 | if (page != Math.ceil(data.length / 6) && data.length > 0) {
62 | %>
63 |
64 |
65 |
66 | <% } %>
67 |
68 |
69 |
97 | <%- include('../parts/foot') %>
98 |
--------------------------------------------------------------------------------