diff --git a/commands/owner/Serverlist.js b/commands/owner/Serverlist.js new file mode 100644 index 0000000..956d3ba --- /dev/null +++ b/commands/owner/Serverlist.js @@ -0,0 +1,131 @@ +const Discord = require("discord.js"); +const ownerid = "612686200318459914"; + +module.exports = { + name: "serverlist", + aliases: ["slt"], + category: "owner", + description: "Zeigt die Liste der Server an!", + usage: " ", + + run: async (bot, message, args) => { + if (message.author.id == ownerid) { + if (!message.guild.me.hasPermission("ADMINISTRATOR")) + return message.channel + .send("Ich habe keine Berechtigungen") + .then(msg => msg.delete({ timeout: 5000 })); + + let i0 = 0; + let i1 = 10; + let page = 1; + + let description = + `Total Servers - ${bot.guilds.cache.size}\n\n` + + bot.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map(r => r) + .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} Members\nID - ${r.id}`) + .slice(0, 10) + .join("\n\n"); + + let embed = new Discord.MessageEmbed() + .setAuthor(bot.user.tag, bot.user.displayAvatarURL({dynamic : true})) + + .setColor("00FFFF") + .setFooter(`Page - ${page}/${Math.ceil(bot.guilds.cache.size / 10)}`) + .setDescription(description); + + let msg = await message.channel.send(embed); + + await msg.react("⬅"); + await msg.react("➡"); + await msg.react("❌"); + + let collector = msg.createReactionCollector( + (reaction, user) => user.id === message.author.id + ); + + collector.on("collect", async (reaction, user) => { + if (reaction._emoji.name === "⬅") { + // Updates variables + i0 = i0 - 10; + i1 = i1 - 10; + page = page - 1; + + // if there is no guild to display, delete the message + if (i0 + 1 < 0) { + console.log(i0) + return msg.delete(); + } + if (!i0 || !i1) { + return msg.delete(); + } + + description = + `Total Servers - ${bot.guilds.cache.size}\n\n` + + bot.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map(r => r) + .map( + (r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} Members\nID - ${r.id}`) + .slice(i0, i1) + .join("\n\n"); + + // Update the embed with new informations + embed + .setFooter( + `Page - ${page}/${Math.round(bot.guilds.cache.size / 10 + 1)}` + ) + .setDescription(description); + + // Edit the message + msg.edit(embed); + } + + if (reaction._emoji.name === "➡") { + // Updates variables + i0 = i0 + 10; + i1 = i1 + 10; + page = page + 1; + + // if there is no guild to display, delete the message + if (i1 > bot.guilds.cache.size + 10) { + return msg.delete(); + } + if (!i0 || !i1) { + return msg.delete(); + } + + description = + `Total Servers - ${bot.guilds.cache.size}\n\n` + + bot.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map(r => r) + .map( + (r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} Members\nID - ${r.id}`) + .slice(i0, i1) + .join("\n\n"); + + // Update the embed with new informations + embed + .setFooter( + `Page - ${page}/${Math.round(bot.guilds.cache.size / 10 + 1)}` + ) + .setDescription(description); + + // Edit the message + msg.edit(embed); + } + + if (reaction._emoji.name === "❌") { + return msg.delete(); + } + + // Remove the reaction when the user react to the message + await reaction.users.remove(message.author.id); + }); + } else { + return; + } + } +}; \ No newline at end of file diff --git a/commands/owner/eval.js b/commands/owner/eval.js new file mode 100644 index 0000000..a6d8f12 --- /dev/null +++ b/commands/owner/eval.js @@ -0,0 +1,43 @@ +const { MessageEmbed } = require('discord.js'); +const Discord = require('discord.js'); +const client = new Discord.Client() +module.exports = { + name: 'eval', + category: 'owner', + run: async (client, message, args) => { + if (message.author.id !== '612686200318459914') return message.channel.send("Sie haben keine Berechtigung, diesen Befehl zu verwenden!"); + const embed = new MessageEmbed() + .setTitle('Auswerten...') + const msg = await message.channel.send(embed); + try { + const data = eval(args.join(' ').replace(/```/g, '')); + const embed = new MessageEmbed() + .setTitle('output:') + .setDescription(await data) + .setColor('GREEN') + await msg.edit(embed) + await msg.react('✅') + await msg.react('❌') + const filter = (reaction, user) => (reaction.emoji.name === '❌' || reaction.emoji.name === '✅') && (user.id === message.author.id); + msg.awaitReactions(filter, { max: 1 }) + .then((collected) => { + collected.map((emoji) => { + switch (emoji._emoji.name) { + case '✅': + msg.reactions.removeAll(); + break; + case '❌': + msg.delete() + break; + } + }) + }) + } catch (e) { + const embed = new MessageEmbed() + .setTitle('error') + .setDescription(e) + .setColor("#FF0000") + return await msg.edit(embed); + } + } +} \ No newline at end of file diff --git a/commands/owner/getinv.js b/commands/owner/getinv.js new file mode 100644 index 0000000..d1732d7 --- /dev/null +++ b/commands/owner/getinv.js @@ -0,0 +1,46 @@ +const ownerid = "612686200318459914"; + +module.exports = { + name: "getinvite", + aliases: ['getinv', 'gi'], + category: "owner", + description: "Generiert eine Einladung an den betreffenden Server.", + usage: "[ID | name]", + + run: async(bot, message, args) => { + if (message.author.id === ownerid) { + let guild = null; + + if (!args[0]) return message.channel.send("Geben Sie den Gildennamen oder die Gilden-ID des gewünschten Einladungslinks ein.") + + if(args[0]){ + let fetched = bot.guilds.cache.find(g => g.name === args.join(" ")); + let found = bot.guilds.cache.get(args[0]); + if(!found) { + if(fetched) { + guild = fetched; + } + } else { + guild = found + } + } else { + return message.channel.send("Das ist der ungültige Gildenname"); + } + if(guild){ + let tChannel = guild.channels.cache.find(ch => ch.type == "text" && ch.permissionsFor(ch.guild.me).has("CREATE_INSTANT_INVITE")); + if(!tChannel) { + return message.channel.send("Tut mir leid, ich habe dort keine CREATE_INSTANT_INVITE-Berechtigung!"); + } + let invite = await tChannel.createInvite({ temporary: false, maxAge: 0 }).catch(err => { + return message.channel.send(`${err} ist aufgetreten!`); + }); + message.channel.send(invite.url); + } else { + return message.channel.send(`\`${args.join(' ')}\` - Ich bin nicht auf diesem Server.`); + } + } else { + return; + } + } + +} \ No newline at end of file diff --git a/commands/owner/lol b/commands/owner/lol new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/commands/owner/lol @@ -0,0 +1 @@ + diff --git a/commands/owner/stats.js b/commands/owner/stats.js new file mode 100644 index 0000000..e7555d4 --- /dev/null +++ b/commands/owner/stats.js @@ -0,0 +1,60 @@ +const { MessageEmbed } = require("discord.js"); +module.exports = { +name: "ainfo", +description: "`Detaillierte Statistiken des Bots anzeigen`", +category: "owner", +aliases: ["detail"], +run: async (client, message, args, level) => { +//command + if(message.author.id != 612686200318459914){ + const noperms = new MessageEmbed() + .setDescription("<:astroz_wrong:825598313499459605> Dieser Befehl wird nur von meinem Besitzer verwendet **NPG**") + .setColor("YELLOW"); + return message.channel.send(noperms) + } + +let servers_count = message.client.guilds.cache.size; +var myarray = []; +message.client.guilds.cache.keyArray().forEach(async function(item, index) { + +let guildMember = message.client.guilds.cache.get(item).memberCount; +myarray.push(guildMember) +}) +let sum = myarray.reduce(function (a, b) { +return a + b +}); + +let totalSeconds = message.client.uptime / 1000; +let days = Math.floor(totalSeconds / 86400); +totalSeconds %= 86400; +let hours = Math.floor(totalSeconds / 3600); +totalSeconds %= 3600; +let minutes = Math.floor(totalSeconds / 60); +let seconds = Math.floor(totalSeconds % 60); + +let uptime = `\`\`\`${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds\`\`\``; + +let embed = new MessageEmbed() + +.setTitle(`**[Support Server]**`) + .setDescription(`Hey, mein Name ist **${message.client.user.username}** und meine Arbeit ist Spaßmodus usw.`) + + .setTitle(`${message.client.user.username} Stats`) + .addFields( + { name: "<:servers:822736807883440161> Servers:", value: `\`\`\`${servers_count}\`\`\``, inline: true }, + { name: "<:users:822737049740247070> Users:", value: `\`\`\`${sum}\`\`\``, inline: true }, + { name: "<:astrozchannels:832228652569329665> Channels",value: `\`\`\`${message.client.channels.cache.size}\`\`\``, inline: true }, + { name: " Uptime: ", value: uptime , inline: true }, + { name: " Ping:",value: `\`\`\`${Math.round(message.client.ws.ping)} ms\`\`\``, inline: true }, + { name: "<:astroz_ram:822500018639994920> RAM: ", value: `\`\`\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB\`\`\``, inline: true }, + { name: " Bot Owner:",value: `\`\`\`NPG\`\`\``}, + ) + .setColor("3498DB") + .setFooter("Danke für die Wahl von Difficult-Knights BOT") + +return message.channel.send(embed); + return message.react("<:astroz_correct:825597747800309770>"); +} +}; + +console.log("Statistiken funktionieren") \ No newline at end of file