const Discord = require("discord.js"); const client = new Discord.Client(); const fs = require("fs"); const moment = require("moment"); const ayarlar = require("./ayarlar.json"); require("./util/eventLoader")(client); const db = require("quick.db"); const express = require("express"); const app = express(); const http = require("http"); app.get("/", (request, response) => { response.sendStatus(200); }); app.listen(process.env.PORT); setInterval(() => { http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`); }, 280000); let prefix = ayarlar.prefix; const log = message => { console.log(`[${moment().format("YYYY-MM-DD HH:mm:ss")}] ${message}`); }; client.commands = new Discord.Collection(); client.aliases = new Discord.Collection(); fs.readdir("./komutlar/", (err, files) => { if (err) console.error(err); log(`${files.length} komut yüklenecek...`); files.forEach(f => { let props = require(`./komutlar/${f}`); log(`Yüklenen komut: ${props.help.name}.`); client.commands.set(props.help.name, props); props.conf.aliases.forEach(alias => { client.aliases.set(alias, props.help.name); }); }); }); client.reload = command => { return new Promise((resolve, reject) => { try { delete require.cache[require.resolve(`./komutlar/${command}`)]; let cmd = require(`./komutlar/${command}`); client.commands.delete(command); client.aliases.forEach((cmd, alias) => { if (cmd === command) client.aliases.delete(alias); }); client.commands.set(command, cmd); cmd.conf.aliases.forEach(alias => { client.aliases.set(alias, cmd.help.name); }); resolve(); } catch (e) { reject(e); } }); }; client.load = command => { return new Promise((resolve, reject) => { try { let cmd = require(`./komutlar/${command}`); client.commands.set(command, cmd); cmd.conf.aliases.forEach(alias => { client.aliases.set(alias, cmd.help.name); }); resolve(); } catch (e) { reject(e); } }); }; client.unload = command => { return new Promise((resolve, reject) => { try { delete require.cache[require.resolve(`./komutlar/${command}`)]; let cmd = require(`./komutlar/${command}`); client.commands.delete(command); client.aliases.forEach((cmd, alias) => { if (cmd === command) client.aliases.delete(alias); }); resolve(); } catch (e) { reject(e); } }); }; client.elevation = message => { if (!message.guild) return message.author.send(); let permlvl = 0; if (message.member.permissions.has("BAN_MEMBERS")) permlvl = 2; if (message.member.permissions.has("ADMINISTRATOR")) permlvl = 3; if (message.author.id === ayarlar.sahip) permlvl = 4; return permlvl; }; client.login(process.env.TOKEN);