From 25b324d8900da399626f7f05a2b9c9634bed3647 Mon Sep 17 00:00:00 2001 From: clau <76551996+iClaudette@users.noreply.github.com> Date: Fri, 9 Jul 2021 19:51:05 +0300 Subject: [PATCH] Add files via upload --- src/commands/botinfo.js | 43 +++++++++++++++ src/commands/bots.js | 24 +++++++++ src/commands/eval.js | 52 +++++++++++++++++++ src/commands/reboot.js | 19 +++++++ src/database/connect.js | 14 +++++ src/database/json/partners.json | 12 +++++ src/database/models/analytics-site.js | 7 +++ src/database/models/botlist/bots.js | 32 ++++++++++++ .../models/botlist/certificate-apps.js | 7 +++ src/database/models/botlist/vote.js | 8 +++ src/database/models/codes.js | 11 ++++ src/database/models/maintence.js | 8 +++ src/database/models/profile.js | 11 ++++ src/database/models/servers/server.js | 22 ++++++++ src/database/models/servers/user.js | 8 +++ src/database/models/site-ban.js | 8 +++ src/database/models/uptime.js | 10 ++++ 17 files changed, 296 insertions(+) create mode 100644 src/commands/botinfo.js create mode 100644 src/commands/bots.js create mode 100644 src/commands/eval.js create mode 100644 src/commands/reboot.js create mode 100644 src/database/connect.js create mode 100644 src/database/json/partners.json create mode 100644 src/database/models/analytics-site.js create mode 100644 src/database/models/botlist/bots.js create mode 100644 src/database/models/botlist/certificate-apps.js create mode 100644 src/database/models/botlist/vote.js create mode 100644 src/database/models/codes.js create mode 100644 src/database/models/maintence.js create mode 100644 src/database/models/profile.js create mode 100644 src/database/models/servers/server.js create mode 100644 src/database/models/servers/user.js create mode 100644 src/database/models/site-ban.js create mode 100644 src/database/models/uptime.js diff --git a/src/commands/botinfo.js b/src/commands/botinfo.js new file mode 100644 index 0000000..3ff4777 --- /dev/null +++ b/src/commands/botinfo.js @@ -0,0 +1,43 @@ +const Discord = require('discord.js'); +const client = new Discord.Client(); +const bots = require("../database/models/botlist/bots.js"); +module.exports.run = async (client,message,args) => { + if(!args[0]) return message.channel.send("Error: Please write bot id."); + let b = await bots.findOne({ botID: args[0] }); + if(!b) return message.channel.send("Invalid bot id.") + let website = b.website ? " | [Website]("+b.website+")" : ""; + let github = b.github ? " | [Github]("+b.github+")" : ""; + let discord = b.support ? " | [Support Server]("+b.support+")" : ""; + let coowner; + if(!b.coowners.length <= 0) { + coowner = b.coowners.map(a => "<@"+a+">").join("\n"); + } else { + coowner = ""; + } + const embed = new Discord.MessageEmbed() + .setThumbnail(b.avatar) + .setAuthor(b.username+"#"+b.discrim, b.avatar) + .setDescription("**[Vote for the bot named "+b.username+"#"+b.discrim+" in vCodes.](https://vcodes.xyz/bot/"+b.botID+"/vote)**") + .addField("ID", b.botID, true) + .addField("Username", b.username, true) + .addField("Discriminator", b.discrim, true) + .addField("Votes", b.votes, true) + .addField("Certificate", b.certificate, true) + .addField("Short Description", b.shortDesc, true) + .setColor("#7289da") + .addField("Server Count", `${b.serverCount || "N/A"}`, true) + .addField("Owner(s)", `<@${b.ownerID}>\n${coowner.replace("<@>", "")}`, true) + .addField("Links", `[Invite](https://discord.com/oauth2/authorize?client_id=${b.botID}&scope=bot&permissions=8)${website}${discord}${github}`, true) + message.channel.send(embed) +}; +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [], + }; + + exports.help = { + name: "botinfo", + description: "", + usage: "" + }; \ No newline at end of file diff --git a/src/commands/bots.js b/src/commands/bots.js new file mode 100644 index 0000000..163be48 --- /dev/null +++ b/src/commands/bots.js @@ -0,0 +1,24 @@ +const Discord = require('discord.js') +const vcodes = require("vcodes.js"); +const botdata = require("../database/models/botlist/bots.js") +module.exports.run = async (client,message,args) => { + let x = await botdata.find(); + let bots = await x.filter(a => a.ownerID == message.author.id || a.coowners.includes(message.author.id)) + const embed = new Discord.MessageEmbed() + .setAuthor(message.author.tag, message.author.avatarURL({dynamic: true})) + .setDescription(`**Total ${bots.length} bots found.**`) + .setColor("#7289da") + .addField("Bots", `${!bots ? "" : bots.map(a => "<@"+a.botID+">").join("\n")}`, true) + message.channel.send(embed) +}; +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [], + }; + + exports.help = { + name: "bots", + description: "", + usage: "" + }; \ No newline at end of file diff --git a/src/commands/eval.js b/src/commands/eval.js new file mode 100644 index 0000000..9889d66 --- /dev/null +++ b/src/commands/eval.js @@ -0,0 +1,52 @@ +const Discord = require('discord.js'); +const client = new Discord.Client(); +const bot = new Discord.Client(); +const { Client, Util } = require('discord.js'); +exports.run = async (client, message, args) => { + if(!global.config.bot.owners.includes(message.author.id)) return message.reply('could not be granted access permission.') + try { + var code = args.join(" "); + var evaled = eval(code); + + if (typeof evaled !== "string") + evaled = require("util").inspect(evaled); + let Embed = new Discord.MessageEmbed() + .addField("Code","```js\n" + code + "```") + .setDescription("```js\n" + clean(evaled) + "```") +if (Embed.description.length >= 2048) + Embed.description = Embed.description.substr(0, 2042) + "```..."; + return message.channel.send(Embed) + } catch (err) { + message.channel.send(`\`HATA\` \`\`\`xl\n${clean(err)}\n\`\`\``); + } +}; + +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [], + permLevel: 0 +}; + +exports.help = { + name: 'eval', + description: 'Kod denemek için kullanılır.', + usage: 'eval [kod]', + category: 'owner' +} + +const clean = text => { + if (typeof(text) === "string") + return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); + else + return text; +} +function makeToken(length) { + var result = ''; + var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + var charactersLength = characters.length; + for ( var i = 0; i < length; i++ ) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; + } \ No newline at end of file diff --git a/src/commands/reboot.js b/src/commands/reboot.js new file mode 100644 index 0000000..a597bd0 --- /dev/null +++ b/src/commands/reboot.js @@ -0,0 +1,19 @@ +const Discord = require('discord.js'); +const fetch = require("node-fetch"); +exports.run = (client, message, args) => { + if(!global.config.bot.owners.includes(message.author.id)) return message.reply('could not be granted access permission.') + message.channel.send("vCodes: Bot yeniden başlatılıyor.").then(msg => { + console.log(`BOT : Yeniden başlatılıyor...`); + process.exit(1); + }) +}; +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [] +}; +exports.help = { + name: 'reboot', + description: 'Botu Yeniden Başlatır.', + usage: 'reboot' +}; \ No newline at end of file diff --git a/src/database/connect.js b/src/database/connect.js new file mode 100644 index 0000000..4f73ccd --- /dev/null +++ b/src/database/connect.js @@ -0,0 +1,14 @@ +const config = require("../../config.js"); +const mongoose = require("mongoose") + +module.exports = async () => { + mongoose.connect(config.bot.mongourl, { + useNewUrlParser: true, + useUnifiedTopology: true, + useCreateIndex: true, + useFindAndModify: false, + autoIndex: false + }).then(() => { + console.log("[vcodes.xyz]: Mongoose successfully connected."); + }).catch(err => console.log("[vcodes.xyz]: An error occurred while connecting mongoose.", err)); +} \ No newline at end of file diff --git a/src/database/json/partners.json b/src/database/json/partners.json new file mode 100644 index 0000000..89f62ed --- /dev/null +++ b/src/database/json/partners.json @@ -0,0 +1,12 @@ +{ + "partners": [ + { + "code": "513946525426", + "ownerID": "615029465726320654", + "icon": "https://codeshare.xyz/public/img/logo.png", + "serverName": "Code Share", + "website": "https://codeshare.xyz", + "description": "The right place to share your own personal codes and find the code you are looking for.." + } + ] +} \ No newline at end of file diff --git a/src/database/models/analytics-site.js b/src/database/models/analytics-site.js new file mode 100644 index 0000000..c00b2ef --- /dev/null +++ b/src/database/models/analytics-site.js @@ -0,0 +1,7 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +id: String, +country: Array, +}); + +module.exports = mongoose.model("analytics", hm); diff --git a/src/database/models/botlist/bots.js b/src/database/models/botlist/bots.js new file mode 100644 index 0000000..214cadd --- /dev/null +++ b/src/database/models/botlist/bots.js @@ -0,0 +1,32 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +ownerID: String, +ownerName: String, +botID: String, +username: String, +discrim: String, +avatar: String, +prefix: String, +longDesc: String, +shortDesc: String, +tags: Array, +coowners: Array, +status: String, +website: String, +github: String, +support: String, +backURL: String, +Date: {type: Date, default: null}, +certificate: String, +votes: {type: Number, default: 0}, +token: String, +serverCount: Number, +shardCount: Number, +analytics: Object, +analytics_visitors: Number, +analytics_invites: Number, +country: Object, +rates: Object, +}); + +module.exports = mongoose.model("bots", hm); diff --git a/src/database/models/botlist/certificate-apps.js b/src/database/models/botlist/certificate-apps.js new file mode 100644 index 0000000..7628031 --- /dev/null +++ b/src/database/models/botlist/certificate-apps.js @@ -0,0 +1,7 @@ +const mongoose = require('mongoose') +const schema = new mongoose.Schema({ +botID: String, +hundred: String, +future: String, +}) +module.exports = mongoose.model('certificate-apps', schema) \ No newline at end of file diff --git a/src/database/models/botlist/vote.js b/src/database/models/botlist/vote.js new file mode 100644 index 0000000..baa47a2 --- /dev/null +++ b/src/database/models/botlist/vote.js @@ -0,0 +1,8 @@ +const mongoose = require('mongoose') +const schema = new mongoose.Schema({ +user: String, +bot: String, +ms: Number, +Date: Date +}) +module.exports = mongoose.model('votes', schema) \ No newline at end of file diff --git a/src/database/models/codes.js b/src/database/models/codes.js new file mode 100644 index 0000000..3709716 --- /dev/null +++ b/src/database/models/codes.js @@ -0,0 +1,11 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +code: String, +codeName: String, +codeCategory: String, +codeDesc: String, +main: { type: String, default: null }, +commands: { type: String, default: null }, +}); + +module.exports = mongoose.model("codes", hm); \ No newline at end of file diff --git a/src/database/models/maintence.js b/src/database/models/maintence.js new file mode 100644 index 0000000..2de10d5 --- /dev/null +++ b/src/database/models/maintence.js @@ -0,0 +1,8 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +server: String, +reason: String, +bakimmsg: String +}); + +module.exports = mongoose.model("bakim", hm); \ No newline at end of file diff --git a/src/database/models/profile.js b/src/database/models/profile.js new file mode 100644 index 0000000..db4d394 --- /dev/null +++ b/src/database/models/profile.js @@ -0,0 +1,11 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +userID: String, +biography: {type: String, default: null}, +website: {type: String, default: null}, +github: {type: String, default: null}, +twitter: {type: String, default: null}, +instagram: {type: String, default: null} +}); + +module.exports = mongoose.model("profiles", hm); \ No newline at end of file diff --git a/src/database/models/servers/server.js b/src/database/models/servers/server.js new file mode 100644 index 0000000..75b91c4 --- /dev/null +++ b/src/database/models/servers/server.js @@ -0,0 +1,22 @@ +const mongoose = require("mongoose"); +module.exports = mongoose.model("servers", + new mongoose.Schema({ + id: String, + name: String, + icon: String, + ownerID: String, + longDesc: String, + shortDesc: String, + tags: Array, + link: String, + createForMe: { type: String, defaults: 'Non-Create' }, + bump: {type: Date, default: null}, + votes: {type: Number, default: 0}, + bumps: {type: Number, default: 0}, + analytics: Object, + analytics_visitors: Number, + analytics_joins: Number, + country: Object, + rates: Object + }) +); diff --git a/src/database/models/servers/user.js b/src/database/models/servers/user.js new file mode 100644 index 0000000..1763e5f --- /dev/null +++ b/src/database/models/servers/user.js @@ -0,0 +1,8 @@ +const mongoose = require("mongoose"); +module.exports = mongoose.model("user-vote-servers", + new mongoose.Schema({ + id: String, + date: Date, + guild: String + }) +); diff --git a/src/database/models/site-ban.js b/src/database/models/site-ban.js new file mode 100644 index 0000000..ae8833d --- /dev/null +++ b/src/database/models/site-ban.js @@ -0,0 +1,8 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +user: String, +sebep: String, +yetkili: String +}); + +module.exports = mongoose.model("site-bans", hm); \ No newline at end of file diff --git a/src/database/models/uptime.js b/src/database/models/uptime.js new file mode 100644 index 0000000..e34c4d9 --- /dev/null +++ b/src/database/models/uptime.js @@ -0,0 +1,10 @@ +const mongoose = require("mongoose"); +let hm = new mongoose.Schema({ +userID: String, +userName: String, +link: String, +code: String, +server: String, +}); + +module.exports = mongoose.model("uptime-links", hm); \ No newline at end of file