diff --git a/commands/bot/eval.js b/commands/bot/eval.js index e7ec15c..a8151d9 100644 --- a/commands/bot/eval.js +++ b/commands/bot/eval.js @@ -1,24 +1,36 @@ -const config = require("../../config.json"); - - module.exports = { - name: "eval", - category: "bot", - description: "Dangerous eval command", - run: async (client, message, args) => { - - if(message.author.id !== config.ownerid) return; - try { - const code = args.join(" "); - let evaled = eval(code); - - if (typeof evaled !== "string") - evaled = require("util").inspect(evaled); - - message.channel.sendCode("xl", evaled); - } catch (err) { - message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``); - } - - - } -} +const Discord = require("discord.js"); +const config = require("../../config.json"); +const ownerid = "348832732647784460"; +const { inspect } = require("util"); + + module.exports = { + name: "eval", + category: "bot", + description: "Dangerous eval command", + run: async (client, message, args) => { + + console.log(`working bot`) + if(message.author.id == ownerid){ + let toeval = args.join(" "); + let evaled = inspect(eval(toeval, { depth: 0 })) + try{ + if(toeval) { + let hrStart = process.hrtime() + let hrDiff; + hrDiff = process.hrtime(hrStart) + return message.channel.send(`Executed in ${hrDiff[0] > 0 ? `${hrDiff[0]}s`: ''}${hrDiff[1]/ 1000000}ms *\`\`\`javascrpit\n${evaled}\n\`\`\``, { maxLength: 1900}) + } else { + message.channel.send("Error while evaluating.") + } + } catch(e){ + message.channel.send(`Error while evaluating : \`${e.message}\``); + } + } else { + return message.reply("you dont have perission to use this command").then(m => m.delete(5000)); + } + + + + + } +} diff --git a/commands/fun/invite.js b/commands/fun/invite.js index 6d80cee..533f690 100644 --- a/commands/fun/invite.js +++ b/commands/fun/invite.js @@ -1,33 +1,17 @@ -const fs = require('fs'); -const Discord = require('discord.js'); -module.exports = { - name: "invite", - category: "fun", - description: "Sends you the invite link for bot and server", - run: async (client, message, args ) => { - let invitecode = "https://discord.gg/55rfDdK"; - let botinvitecode = "http://bit.ly/ethytgamingbot"; - - // let sEmbed = new Discord.RichEmbed() - // .setColor("RANDOM") - // .setTitle(`Here is the invite link for inviting to your server`) - // .setDescription(`${botinvitecode}`); - - // let Embed = new Discord.RichEmbed() - // .setColor("RANDOM") - // .setTitle(`Here is the invite code for joining bot's support server`) - // .setDescription(`${invitecode}`); - - // if(args[0] == 'bot') message.reply(sEmbed); - // if(args[0] == 'server') message.reply(Embed); - //message.reply(sEmbed); - //message.reply(Embed); - message.channel.send(`Here is the invite link for inviting to your server\n${botinvitecode}\nHere is the invite code for joining bot's support server\n${invitecode}`); - message.author.send(`Here is the invite link for inviting to your server\n${botinvitecode}\nHere is the invite code for joining bot's support server\n${invitecode}`); - //message.author.send(sEmbed); - //message.author.send(Embed); - console.error('Caught the promise rejections'); - } - -} -process.on('unhandledRejection', error => console.log('Uncaught Promise Rejection', error)); +const fs = require('fs'); +const Discord = require('discord.js'); +module.exports = { + name: "invite", + category: "fun", + description: "Sends you the invite link for bot and server", + run: async (client, message, args ) => { + let invitecode = "https://discord.gg/55rfDdK"; + let botinvitecode = "http://bit.ly/ethytgamingbot"; + + message.channel.send(`Here is the invite link for inviting to your server\n${botinvitecode}\nHere is the invite code for joining bot's support server\n${invitecode}`); + + // message.author.send(`Here is the invite link for inviting to your server\n${botinvitecode}\nHere is the invite code for joining bot's support server\n${invitecode}`); + + } + +} diff --git a/commands/fun/love.js b/commands/fun/love.js new file mode 100644 index 0000000..4dee860 --- /dev/null +++ b/commands/fun/love.js @@ -0,0 +1,31 @@ +const { RichEmbed } = require("discord.js"); +const { getMember } = require("../../functions.js"); + +module.exports = { + name: "love", + aliases: ["affinity"], + category: "fun", + description: "Calculates the love affinity you have for another person.", + usage: "[mention | id | username]", + run: async (client, message, args) => { + // Get a member from mention, id, or username + let person = getMember(message, args[0]); + + if (!person || message.author.id === person.id) { + person = message.guild.members + .filter(m => m.id !== message.author.id) + .random(); + } + + const love = Math.random() * 100; + const loveIndex = Math.floor(love / 10); + const loveLevel = "💖".repeat(loveIndex) + "💔".repeat(10 - loveIndex); + + const embed = new RichEmbed() + .setColor("#ffb6c1") + .addField(`☁ **${person.displayName}** loves **${message.member.displayName}** this much:`, + `💟 ${Math.floor(love)}%\n\n${loveLevel}`); + + message.channel.send(embed); + } +} \ No newline at end of file diff --git a/commands/fun/rps.js b/commands/fun/rps.js new file mode 100644 index 0000000..351fc1a --- /dev/null +++ b/commands/fun/rps.js @@ -0,0 +1,44 @@ +const { RichEmbed } = require("discord.js"); +const { promptMessage } = require("../../functions.js"); + +const chooseArr = ["🗻", "📰", "✂"]; + +module.exports = { + name: "rps", + category: "fun", + description: "Rock Paper Scissors game. React to one of the emojis to play the game.", + usage: "rps", + run: async (client, message, args) => { + const embed = new RichEmbed() + .setColor("#ffffff") + .setFooter(message.guild.me.displayName, client.user.displayAvatarURL) + .setDescription("Add a reaction to one of these emojis to play the game!") + .setTimestamp(); + + const m = await message.channel.send(embed); + const reacted = await promptMessage(m, message.author, 30, chooseArr); + + const botChoice = chooseArr[Math.floor(Math.random() * chooseArr.length)]; + + const result = await getResult(reacted, botChoice); + await m.clearReactions(); + + embed + .setDescription("") + .addField(result, `${reacted} vs ${botChoice}`); + + m.edit(embed); + + function getResult(me, clientChosen) { + if ((me === "🗻" && clientChosen === "✂") || + (me === "📰" && clientChosen === "🗻") || + (me === "✂" && clientChosen === "📰")) { + return "You won!"; + } else if (me === clientChosen) { + return "It's a tie!"; + } else { + return "You lost!"; + } + } + } +} \ No newline at end of file diff --git a/commands/fun/uptime.js b/commands/fun/uptime.js index 39e912a..45330c5 100644 --- a/commands/fun/uptime.js +++ b/commands/fun/uptime.js @@ -11,7 +11,7 @@ module.exports = { const min = Math.floor((ms / (1000 * 60)) % 60).toString() const hrs = Math.floor((ms / (1000 * 60 * 60)) % 60).toString() const days = Math.floor((ms / (1000 * 60 * 60 * 24)) % 60).toString() - return `${days.padStart(1, '0')} days, ${hrs.padStart(2, '0')} hours, ${min.padStart(2, '0')} minutes, ${sec.padStart(2, '0')} seconds, ` + return `${days.padStart(1, '0')} days, ${hrs.padStart(2, '0')} hours, ${min.padStart(2, '0')} minutes, ${sec.padStart(2, '0')} seconds!! ` } message.channel.send(`I have been online for: ${duration(bot.uptime)}`) diff --git a/commands/fun/write.js b/commands/fun/write.js index 7aa2912..2a25b56 100644 --- a/commands/fun/write.js +++ b/commands/fun/write.js @@ -1,27 +1,27 @@ -const fs = require('fs') - -module.exports = { - name: "write", - category: "fun", - description: "Save 1 message in our database", - run: async (client, message, args) => { - - // editedmessage = message.content.slice(6); - //console.log(args.join(" ")); - let save = args.join(" "); - - - let msgs = JSON.parse(fs.readFileSync("./message.json", "utf8")); - - msgs [message.guild.id]= {[message.author.id] : { - message: save - }}; - await fs.writeFile("./message.json", JSON.stringify(msgs,null,4), (err) => { - if (err) throw err; - console.log(err); - message.channel.send("message saved!") - }); - - } - -} +const fs = require('fs') + +module.exports = { + name: "write", + category: "fun", + description: "Save 1 message in our database", + run: async (client, message, args) => { + + // editedmessage = message.content.slice(6); + //console.log(args.join(" ")); + let save = args.join(" "); + + + let msgs = JSON.parse(fs.readFileSync("./message.json", "utf8")); + + msgs [message.guild.id]= {[message.author.id] : { + message: save + }}; + await fs.writeFile("./message.json", JSON.stringify(msgs,null,4), (err) => { + if (err) throw err; + console.log(err); + message.channel.send("message saved!") + }); + + } + +} diff --git a/commands/fun/xkcd.js b/commands/fun/xkcd.js new file mode 100644 index 0000000..43ff58f --- /dev/null +++ b/commands/fun/xkcd.js @@ -0,0 +1,37 @@ +const { RichEmbed } = require("discord.js"); +const fetch = require("node-fetch"); //npm i node-fetch + +module.exports = { + name: "xkcd", + description: "xkcd comics, get the latest or certain comic", + usage: " (id)", + category: "miscellaneous", + accessableby: "Members", + run: async (client, message, args) => { + if(!message.channel.nsfw) return message.channel.send("Please run this command in a `NSFW` channel."); + if((args[1] && isNaN(args[1])) || !["search", "latest"].includes(args[0])) return message.channel.send("`-xkcd (id)"); + + let search = args[1] ? `http://xkcd.com/${args[1]}/info.0.json` : "http://xkcd.com/info.0.json"; + try { + message.channel.send("checking and sending.......").then(msg => { + fetch(search).then(res => res.json()).then(res => { + if(!res) return msg.edit("No results found for this comic, sorry!"); + let { safe_title, img, day, month, year, num, alt} = res; + + let embed = new RichEmbed() + .setColor("RANDOM") + .setDescription(alt ? alt : "*crickets* - No Description") + .setAuthor(`XKCD | ${safe_title} [${num}]`) + .setImage(img) + .setFooter(`Published ${day}/${month}/${year}`) + + msg.edit(embed); + }) + + }) + } catch(e) { + console.log(e) + return message.channel.send("looks like ive broken! Try again."); + } + } +} \ No newline at end of file diff --git a/commands/game/csgo.js b/commands/game/csgo.js new file mode 100644 index 0000000..8eaa973 --- /dev/null +++ b/commands/game/csgo.js @@ -0,0 +1,78 @@ +const Discord = require('discord.js'); +var request = require('request'); +var cheerio = require('cheerio'); +const { stripIndents } = require("common-tags"); + +function getStatData(location , $){ + + var selector = $('.stats-stat .value').eq(location).text(); + + var stat_array = $.parseHTML(selector); + + var stat = 0; + + if(stat_array == null || stat_array.lengh == 0){ + return -1; + + }else{ + stat = stat_array[0].data; + } + + return stat; +} + +module.exports = { + name: "csgo", + description: "Displays a user's csgo stats!", + usage: "csgo ", + category: "game", + aliases: ["cs-go"] , + run: async (client, message, args) => { + var UR_L = "http://csgo.tracker.network/profile/" + args[0]; + + if(!args[0]){ + return message.channel.send("Please Enter a valid STEAMID64 or custom url"); + } + + request(UR_L, function(err, resp, body){ + + $ = cheerio.load(body); + + var KD = getStatData(0, $); + if(KD == -1){ + return message.channel.send("Invalid, make sure your profile is not private and you have entered a valid STEAMID64 or Custom URL!"); + } + + var WIN = getStatData(1, $); + var HS = getStatData(4, $); + var MONEY = getStatData(5, $); + var SCORE = getStatData(6, $); + var KILLS = getStatData(7, $); + var DEATHS = getStatData(8, $); + var MVP = getStatData(9, $); + var BS = getStatData(13, $); + var BD = getStatData(14, $); + var HR = getStatData(15, $); + + var embed = new Discord.RichEmbed() + .setTitle("__***CSGO Stats***__") + .setURL(UR_L) + .addField("Current stats",stripIndents` + Total KD: __**${KD}**__ + Total Win%: __**${WIN}**__ + Total MVPs: __**${MVP}**__ + Total Score: __**${SCORE}**__ + Total Kills: __**${KILLS}**__ + Total Deaths: __** ${DEATHS}**__ + Total Bombs Set: __** ${BS}**__ + Total Bombs Defused: __** ${BD}**__ + Total Headshots: __**${HS}**__ + Total Money Earned: __**${MONEY}**__ + Total Hostages Rescued: __**${HR}**__`, true) + .addField("Powered by:", `**[csgo.tracker.network](http://csgo.tracker.network)**`, false) + .setTimestamp() + .setColor("0x#FF0000"); + message.channel.send(embed); + } + )} +} diff --git a/commands/info/help.js b/commands/info/help.js index 3edd805..b6c2208 100644 --- a/commands/info/help.js +++ b/commands/info/help.js @@ -30,32 +30,34 @@ function getAll(client, message) { // let prefix = prefixes[message.guild.id].prefixes ; const embed = new RichEmbed() .setColor("RANDOM") - .setDescription(stripIndents`Server prefix is**\ \ \ \ . ** - **Game** + .setTimestamp() + .setDescription(`Server prefix is**\ \ \ \ . **`) + .addField("**FUN**",stripIndents` + - uptime + - write + - read + - invite + - meme + - xkcd`,true) + .addField(`**Game**`,stripIndents` - apex - fortnite - overwatch - r6stats - - steam - **INFO** + - steam`,true) + .addField("**INFO**",stripIndents` - serverinfo - help - ping - - whois - **FUN** - - uptime - - write - - read - - invite - - meme - **MODERATION** + - whois`,true) + .addField("**MODERATION**",stripIndents` - addrole - removerole - kick - ban - report - - logger - **NSFW** + - logger`,true) + .addField("**NSFW**",stripIndents` - 4k - anal - boobs @@ -71,20 +73,21 @@ function getAll(client, message) { - neko - ngif - pgif - - urban - **OWNER** + - urban`,true) + .addField("**OWNER**",stripIndents` - prefix - settings - welcome - - autorole - **UTIL** + - autorole`,true) + .addField("**UTIL**",stripIndents` - clean - - say - - To get more info on each command type help + - say`,true) + .addField("Note",stripIndents` + To get more info on each command type help example: suppose prefix is & then &help ping - it will give you more info on ping command`); + it will give you more info on ping command`) + .setFooter(`${client.user.username}`) // // Map all the commands not adding every command idk why // // with the specific category @@ -101,8 +104,8 @@ function getAll(client, message) { // .reduce((string, category) => string + "\n" + category); // return message.channel.send(embed.setDescription(info)); - message.channel.send("**Bot is in heavy development right now **\n") - message.channel.send(embed); + message.channel.send("**Bot is in heavy development right now **\n",embed) + // message.channel.send(embed); } function getCMD(client, message, input) { diff --git a/commands/info/rank.js b/commands/info/rank.js index 2d68035..ba3d937 100644 --- a/commands/info/rank.js +++ b/commands/info/rank.js @@ -1,11 +1,11 @@ -module.exports = { - name: "rank", - category: "info", - description: "Returns your rank in this server", - aliases: ["xp", "rankinfo","level"], - run: async (client, message, args) => { - - message.channel.send(`this command is in development it will be avalable soon`); - } - -} +module.exports = { + name: "rank", + category: "info", + description: "Returns your rank in this server", + aliases: ["xp", "rankinfo","level"], + run: async (client, message, args) => { + + message.channel.send(`this command is in development it will be avalable soon`); + } + +} diff --git a/commands/moderation/report.js b/commands/moderation/report.js index 33526bd..15c9b26 100644 --- a/commands/moderation/report.js +++ b/commands/moderation/report.js @@ -14,8 +14,8 @@ module.exports = { if (!rMember) return message.reply("Couldn't find that person?").then(m => m.delete(5000)); - // if (rMember.hasPermission("BAN_MEMBERS") || rMember.user.bot) - // return message.channel.send("Can't report that member").then(m => m.delete(5000)); + if (rMember.hasPermission("BAN_MEMBERS") || rMember.user.bot) + return message.channel.send("Can't report that member").then(m => m.delete(5000)); if (!args[1]) return message.channel.send("Please provide a reason for the report").then(m => m.delete(5000)); diff --git a/commands/nsfw/pvid.js b/commands/nsfw/pvid.js new file mode 100644 index 0000000..0f29a61 --- /dev/null +++ b/commands/nsfw/pvid.js @@ -0,0 +1,83 @@ +const Discord = require('discord.js'); + +module.exports = { + name: 'pvid', + group: 'nsfw', + description: 'Searches for sex videos', + format: 'pvid {query}', + aliases: [], + examples: ['pvid ass', 'pvid tits'], + clientpermissions: ['SEND_MESSAGES'], + userpermissions: [], + shortDescription: 'Videos', + run: async (client, message) => { + + const args = message.content.split(' ').slice(1); + + if (!message.channel.nsfw) return message.channel.send("The channel has to be NSFW!"); + if (args.length === 0) return message.channel.send("You have to decide what type of pornography you want to see"); + const Pornsearch = require('pornsearch'); + + try { + /* eslint no-undef: 0 */ + const Searcher = await Pornsearch.search(args.join(' ')).videos(); + + const result = Math.floor(Math.random() * Searcher.length); + + const { url } = Searcher[result - 1]; + const thumbnail = Searcher[result - 1].thumb; + const { title } = Searcher[result - 1]; + const { duration } = Searcher[result - 1]; + + const embed = new Discord.MessageEmbed() + .setImage(thumbnail) + .setURL(url) + .setDescription(`Duration: ${duration} minutes`) + .setColor('#ff0000') + .setFooter(url) + .setURL(url) + .setAuthor(title); + + return message.channel.send(embed); + } + catch (error) { + return message.reply("Could not find any videos to your request"); + } + + // const args = message.content.split(' ').slice(1); + + // if (!message.channel.nsfw) return message.channel.send("The channel has to be NSFW!"); + // if (args.length === 0) return message.channel.send("You have to decide what type of pornography you want to see"); + // const Pornsearch = require('pornsearch'); + + // try { + // /* eslint no-undef: 0 */ + // const Searcher = new Pornsearch(args.join(' '), 'sex'); + // const videos = await Searcher.videos(); + + // const result = Math.floor(Math.random() * videos.length); + + // const { url } = videos[result - 1]; + // const thumbnail = videos[result - 1].thumb; + // const { title } = videos[result - 1]; + // const { duration } = videos[result - 1]; + + // const embed = new Discord.MessageEmbed() + // .setImage(thumbnail) + // .setURL(url) + // .setDescription(`Duration: ${duration} minutes`) + // .setColor('#ff0000') + // .setFooter(url) + // .setURL(url) + // .setAuthor(title); + + // return message.channel.send(embed); + // } + // catch (error) { + // return message.reply("Could not find any videos to your request"); + // } + + + } + +} diff --git a/commands/owner/prefix.js b/commands/owner/prefix.js index 00a1ce2..475ae84 100644 --- a/commands/owner/prefix.js +++ b/commands/owner/prefix.js @@ -1,32 +1,32 @@ -const Discord = require("discord.js"); -const { stripIndents } = require("common-tags"); -const fs = require('fs'); - -module.exports = { - name: "prefix", - category: "owner", - description: "change prefix of the server ", - run: async (client, message, args) => { - if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); - if(!args[0]) return message.channel.send("please enter server prefix"); - message.channel.send(`sry for intrusion but this command is yet to be applied but it can save the prefix in our database`); - - let prefixes = JSON.parse(fs.readFileSync("./prefixsettings.json", "utf8")); - - prefixes[message.guild.id] = { - prefixes: args[0] - }; - await fs.writeFile("./prefixsettings.json", JSON.stringify(prefixes), (err) => { - if (err) throw err; - console.log(err); - }); - let sEmbed = new Discord.RichEmbed() - .setColor("e8a515") - .setTitle("Server prefix successfully changed") - .setDescription(`New server prefix is : " ${args[0]} "`); - - message.channel.send(sEmbed); - - - } +const Discord = require("discord.js"); +const { stripIndents } = require("common-tags"); +const fs = require('fs'); + +module.exports = { + name: "prefix", + category: "owner", + description: "change prefix of the server ", + run: async (client, message, args) => { + if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); + if(!args[0]) return message.channel.send("please enter server prefix"); + message.channel.send(`sry for intrusion but this command is yet to be applied but it can save the prefix in our database`); + + let prefixes = JSON.parse(fs.readFileSync("./prefixsettings.json", "utf8")); + + prefixes[message.guild.id] = { + prefixes: args[0] + }; + await fs.writeFile("./prefixsettings.json", JSON.stringify(prefixes), (err) => { + if (err) throw err; + console.log(err); + }); + let sEmbed = new Discord.RichEmbed() + .setColor("e8a515") + .setTitle("Server prefix successfully changed") + .setDescription(`New server prefix is : " ${args[0]} "`); + + message.channel.send(sEmbed); + + + } } \ No newline at end of file diff --git a/commands/owner/serverlist.js b/commands/owner/serverlist.js new file mode 100644 index 0000000..c6c82bc --- /dev/null +++ b/commands/owner/serverlist.js @@ -0,0 +1,14 @@ +const Discord = require("discord.js"); +const ownerid = "348832732647784460"; + +module.exports = { + name: "lists", + category: "owner", + description: "lists all the servers ", + run: async (client, message, args) => { + if(message.author.id != ownerid) return; + + message.channel.send(client.guilds.map(r => ` \`${r.name}\` | **${r.memberCount}** members |id:\`${r.id}\` `)) + + } +} \ No newline at end of file diff --git a/commands/owner/settings.js b/commands/owner/settings.js index 07868f6..84695c5 100644 --- a/commands/owner/settings.js +++ b/commands/owner/settings.js @@ -1,29 +1,29 @@ -const Discord = require("discord.js"); -const { stripIndents } = require("common-tags"); -const fs = require('fs'); -const config1 = require("../../config.json"); - - -module.exports = { - name: "settings", - category: "owner", - description: "Displays all the settings of the server ", - aliases: ["setting","setup"], - run: async (client, message) => { - // if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); - // if(!args[0]) return message.channel.send("please enter server prefix"); - - let prefixes = JSON.parse(fs.readFileSync("./prefixsettings.json", "utf8")); - let prefix = prefixes[message.guild.id].prefixes ; - let welcomes = JSON.parse(fs.readFileSync("./serversettings.json", "utf8")); - let welcome = welcomes[message.guild.id].welcomes; - - let sEmbed = new Discord.RichEmbed() - .setColor("RANDOM") - .setTitle("Server settings are") - .setDescription(`server prefix is \ \ \ \ ** ${prefix} ** and ** ${config1.prefix_mention} ** \nserver welcome channel is:${welcome} "`); - message.channel.send(sEmbed); - - - } +const Discord = require("discord.js"); +const { stripIndents } = require("common-tags"); +const fs = require('fs'); +const config1 = require("../../config.json"); + + +module.exports = { + name: "settings", + category: "owner", + description: "Displays all the settings of the server ", + aliases: ["setting","setup"], + run: async (client, message) => { + // if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); + // if(!args[0]) return message.channel.send("please enter server prefix"); + + let prefixes = JSON.parse(fs.readFileSync("./prefixsettings.json", "utf8")); + let prefix = prefixes[message.guild.id].prefixes ; + let welcomes = JSON.parse(fs.readFileSync("./serversettings.json", "utf8")); + let welcome = welcomes[message.guild.id].welcomes; + + let sEmbed = new Discord.RichEmbed() + .setColor("RANDOM") + .setTitle("Server settings are") + .setDescription(`server prefix is \ \ \ \ ** ${prefix} ** and ** ${config1.prefix_mention} ** \nserver welcome channel is:${welcome} "`); + message.channel.send(sEmbed); + + + } } \ No newline at end of file diff --git a/commands/owner/system.js b/commands/owner/system.js new file mode 100644 index 0000000..d9a6f6c --- /dev/null +++ b/commands/owner/system.js @@ -0,0 +1,30 @@ +const Discord = require("discord.js"); +const os = require('os'); +var memStat = require('mem-stat'); +var netStat = require('net-stat'); +var disk = require('diskusage'); +const ownerid = "348832732647784460"; + +module.exports = { + name: "system", + category: "owner", + description: "shows the statistics of the bot ", + run: async (client, message, args) => { + if(message.author.id != ownerid) return; + var cpu = os.loadavg(); + + disk.check('/', function(err, info) { + + const embed = new Discord.RichEmbed() + .setColor(0x00A2E8) + .setThumbnail(client.user.avatarURL) + .addField('**CPU Load**:', `${Math.ceil(cpu[1] * 100) / 10 + "%"}`, true) + .addField('**RAM**:', `Used: ${Math.round(memStat.total('MiB') - memStat.free('MiB')) + "MB | Total: " + Math.round(memStat.total('GiB')) + "GB"}`, true) + .addField('**SSD**:', `Used: ${Math.round(info.total / 1000000 / 1024) - Math.round(info.free / 1000000 / 1024) + "GB | Total: " + Math.round(info.total / 1000000 / 1024) + "GB"}`, true) + .addField('**NET**:', `Recevied: ${Math.round(netStat.totalRx({ iface: 'eth0', units: 'GiB' })) + "GB | Sent: " + Math.round(netStat.totalTx({ iface: 'eth0', units: 'GiB'})) + "GB"}`) + message.channel.send(embed); + + }); + + } +} \ No newline at end of file diff --git a/commands/owner/welcome.js b/commands/owner/welcome.js index fe3cbaa..8d48e05 100644 --- a/commands/owner/welcome.js +++ b/commands/owner/welcome.js @@ -1,33 +1,33 @@ -const Discord = require("discord.js"); -const { stripIndents } = require("common-tags"); -const fs = require('fs'); - -module.exports = { - name: "welcome", - category: "owner", - description: "change welcome channel of the server ", - run: (client, message, args) => { - if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); - if(!args[0]) return message.channel.send("please enter channel id or #"); - - let welcomes = JSON.parse(fs.readFileSync("./serversettings.json", "utf8")); - - - welcomes[message.guild.id] = { - welcomes: args[0] - }; - fs.writeFile("./serversettings.json", JSON.stringify(welcomes ,undefined , 4), (err) => { - if (err) throw err; - console.log(err); - }); - let sEmbed = new Discord.RichEmbed() - .setColor("e8a515") - .setTitle("Welcome channel successfully changed") - .setDescription(`New welcome channel is : " ${ welcomes[message.guild.id].welcomes} "`); - message.channel.send(sEmbed); - //console.log(welcomes); - message.channel.send(`sry or intrusion but this command is yet to be applied or having some problems so till then default channels are welcome and general`); - - - } +const Discord = require("discord.js"); +const { stripIndents } = require("common-tags"); +const fs = require('fs'); + +module.exports = { + name: "welcome", + category: "owner", + description: "change welcome channel of the server ", + run: (client, message, args) => { + if(!message.member.hasPermission('ADMINISTRATOR')) return message.require("you dont have admin rights contact server admin"); + if(!args[0]) return message.channel.send("please enter channel id or #"); + + let welcomes = JSON.parse(fs.readFileSync("./serversettings.json", "utf8")); + + + welcomes[message.guild.id] = { + welcomes: args[0] + }; + fs.writeFile("./serversettings.json", JSON.stringify(welcomes ,undefined , 4), (err) => { + if (err) throw err; + console.log(err); + }); + let sEmbed = new Discord.RichEmbed() + .setColor("e8a515") + .setTitle("Welcome channel successfully changed") + .setDescription(`New welcome channel is : " ${ welcomes[message.guild.id].welcomes} "`); + message.channel.send(sEmbed); + //console.log(welcomes); + message.channel.send(`sry or intrusion but this command is yet to be applied or having some problems so till then default channels are welcome and general`); + + + } } \ No newline at end of file diff --git a/commands/radio/leave.js b/commands/radio/leave.js new file mode 100644 index 0000000..b269199 --- /dev/null +++ b/commands/radio/leave.js @@ -0,0 +1,18 @@ +const Discord = require("discord.js"); +//const ffmpeg = require("ffmpeg-binaries"); +const opusscript = require("opusscript"); + +module.exports = { + name: "leave", + description: "plays audio", + usage: ".play ", + category: "music", + aliases: ["disconnect"], + run: async (client, message, args) => { + message.channel.send(`this command will be added soon.... :wink:`); + // if (message.member.voiceChannel) { + // message.member.voiceChannel.leave().then(message.reply('Left Voice Channel.')); + + // }; + } +} \ No newline at end of file diff --git a/commands/radio/play.js b/commands/radio/play.js new file mode 100644 index 0000000..3aa9ca8 --- /dev/null +++ b/commands/radio/play.js @@ -0,0 +1,67 @@ +const Discord = require("discord.js"); +// const ffmpeg = require("ffmpeg-binaries"); +const opusscript = require("opusscript"); +var playAudioURL = require('play-audio-url'); + +module.exports = { + name: "play", + description: "plays audio", + usage: ".play ", + category: "music", + aliases: ["p"], + run: async (client, message, args) => { + message.channel.send(`this command will be added soon.... :wink:`); +// if (args.length === 0) +// return message.reply("You never supplied a stream URL!"); + +// const streamURL = args.slice(0, args.length).join(" "); + +// if (message.member.voiceChannel) { +// message.member.voiceChannel.join() +// .then(connection => { +// // message.reply('Connected! Playing..'); +// require('http').get("http://radio.animenexus.mx:8000/animenexus", (res) => { +// connection.playStream(res); +// }) +// }) +// .catch(console.log); +// } else { +// message.reply('You are not in a voice channel!'); +// } + // message.member.voiceChannel.join().then(connection => { + // console.log('joined channel'); + + // playAudioURL({ url: 'http:\/\/peridot.streamguys.com:7150\/Mirchi' }, onPlay) + // player.start + // // When no packets left to sent leave the channel. + // }) + // // Handle error without crashing the app. + // .catch(console.error); + + + + // // You can also pass sampleRate here. + // // e.g.: { url: 'https://o.k/guy.mp3', sampleRate: 22050 } + + // // playAudioURL passes back an htmlPlayer if it was able to play + // // via an HTMLAudioElement, otherwise passes an AudioContext-based player. + // function onPlay(error, { htmlPlayer, bufferPlayer }) { + // if (error) { + // console.log(error); + // } else if (htmlPlayer) { + // setTimeout(player.pause, 10000); + // } else if (bufferPlayer) { + // setTimeout(bufferPlayer.stop, 10000); + // } + // } + } +} + + + + +exports.run = (client, message, args) => { + + + }; + \ No newline at end of file diff --git a/commands/radio/radio.json b/commands/radio/radio.json new file mode 100644 index 0000000..adf4ee7 --- /dev/null +++ b/commands/radio/radio.json @@ -0,0 +1,71 @@ +{ + "mirchi":"http://peridot.streamguys.com:7150/Mirchi", + "red fm":"http://104.238.99.1:8000/red967.mp3", + "Radio City":"http://prclive1.listenon.in:9960/;", + "fm rainbow":"http://51.15.208.163:8081/radio/fmrainbow/icecast.audio", + "Bombay Beats":"http://sc-bb.1.fm:8017/;", + "Radio Divya Jyoti":"http://s8.voscast.com:9280/stream/1/", + "Australian internet radio stations":"below", + "FM 106.7 FM":"http://eno.emit.com:8000/pbsfm_live_64.mp3", + "FBi Radio 94.5 FM":"https://stream.fbiradio.com/stream.mp3", + "Radio 96.5 FM":"http://stream2.cnmns.net/96five-mp3", + "Radio Metro 105.7 FM":"http://stream.radiometro.com.au:8888/stream/1/", + "Fresh 92.7":"http://live.fresh927.com.au/freshaac", + "Bangladesh radio":"below", + "Dhaka FM 90.4":"http://118.179.219.244:8000/;", + "Radio Aamar 88.4 FM":"http://78.129.193.27:15910/;", + "Jago FM 94.9":"http://192.240.102.133:12110/stream/1/", + "Radio Capital 94.8 FM":"http://str.radiocapital.fm:8000/stream", + "Spice FM 96.4":"https://api.webrad.io/data/streams/64/spice", + "Radio Amber 102.4 FM":"http://118.179.215.45:8000/;", + "China Internet Radio":"below", + "Foshan Radio FM94.6":"http://lhttp.qingting.fm/live/1265/64k.mp3", + "Guangdong Radio":"http://ctt5.rgd.com.cn/fm993", + "Lychee station":"http://ctt.rgd.com.cn/fm914", + "Yangcheng Traffic":"http://ctt.rgd.com.cn/fm1052", + "Hong Kong Internet Radio":"below", + "Radio 2":"http://stm.rthk.hk/radio2", + "China Electronics":"http://billboardradio.rastream.com/gfm-clubhkgfm", + "Apple FM":"http://sc.apple-fm.net:9020/;", + "Billboard Rock":"http://billboardradio.rastream.com/gfm-classicsrewind", + "Billboard Chill Out":"http://billboardradio.rastream.com/gfm-todaysmix", + "HKJ Radio":"http://listen.hkjradio.com:8009/live", + "Internet radio station from Indonesia":"Below", + "Indika 91.60 FM":"https://s2.radio.co/sf58a82d7d/listen", + "Hard Rock FM 87.6":"http://cloudstreaming.mramedia.com:8001/live", + "Radio Dangdut Indonesia 97.1 FM":"http://202.147.199.99:8000/stream/1/", + "RAS 95.5 FM Jakarta":"http://103.28.148.18:9006/;", + "Cosmopolitan 90.4 FM":"http://cloudstreaming.mramedia.com:8002/live", + "KLCBS 100.4 FM":"http://s3.vinhostmedia.com:1055/;", + "Radio 89.6 FM":"http://cloudstreaming.mramedia.com:8000/live", + "Visi 89.6 FM Medan":"http://103.28.148.18:8178/;", + "Internet radio stations from Israel":"below", + "FM 100 radius":"http://100fm.streamgates.net/Radios100Fm", + "Non-stop radio 103 FM":"http://103fm.live.streamgates.net/103fm_live/1multix/icecast.audio", + "Eco FM 99":"http://eco01.mediacast.co.il/ecolive/99fm_aac/icecast.audio", + "Tel Aviv Radio 102.0 FM":"http://102.livecdn.biz/102fm_aac", + "Red Sea Voice 102.0 FM":"http://eilat.cdnwz.net/102fm", + "Japanese internet radio station.":"below", + "Shonan Beach FM 78.9":"http://150.95.174.29:8000/by_the_sea ", + "Big B Radio #Jpop":"http://217.116.9.142:9141/stream/1/", + "FM Edagawa 84.3 FM":"http://musicbird.leanstream.co/JCB033-MP3", + "Radio Shonan FM83.1":"https://musicbird.leanstream.co/JCB101-MP3", + "Tokyo FM 80.0 FM":"http://tokyofmworld.leanstream.co/JOAUFM-MP3", + "JPHiP Radio":"http://radio.jphip.com:8800/;", + "Online radio from Malaysia":"below", + "Radio Era FM":"http://astro2.rastream.com/era", + "Hitz FM 92.9":"http://astro1.rastream.com/hitz", + "988 FM Radio":"http://starrfm.rastream.com/starrfm-988", + "Cats FM 99.3":"http://206.190.133.196:7111/stream/1/", + "My FM 101.8":"http://astro1.rastream.com/myfm", + "Melody FM":"http://astro3.rastream.com/melody", + "Durian FM Malaysia":"http://s3.voscast.com:7140/stream/1/", + "Online radio stations from Nepal":"below", + "Radio Kantipur 96.1 FM":"http://broadcast.radiokantipur.com:7248/stream/1/", + "Big FM 101.2 FM":"http://192.240.102.133:12406/stream/1/", + "Keeps 98.3 FM":"http://streaming.hamropatro.com:8385/;", + "Radio Thaha Sanchar 99.6 FM":"http://streaming.softnep.net:8025/stream/1/", + "RadioPMCNepal":"http://s8.voscast.com:8654/stream/1/", + "Live radio from New Zealand":"below", + "tobe continued":"visit https://radio.org.nz/ " +} \ No newline at end of file diff --git a/commands/util/clean.js b/commands/util/clean.js index 35425f0..acfc1b4 100644 --- a/commands/util/clean.js +++ b/commands/util/clean.js @@ -28,4 +28,4 @@ module.exports = { } } -process.on('unhandledRejection', error => console.log('Uncaught Promise Rejection', error)); \ No newline at end of file +process.on('unhandledRejection', error => console.log('Uncaught Promise Rejection', error)); diff --git a/commands/util/say.js b/commands/util/say.js index cee6bc8..69eabb8 100644 --- a/commands/util/say.js +++ b/commands/util/say.js @@ -1,18 +1,18 @@ -const { RichEmbed } = require("discord.js"); -const { stripIndents } = require("common-tags"); - -module.exports = { - name: "say", - category: "util", - description: "clean up to last 100 messages ", - usage: "", - run: async (client, message, args) => { - if(!message.member.hasPermission('MANAGE_MESSAGES')) return message.require("off.."); - if (args.length < 1) return message.channel.reply('nothing to say').then(m => m.delete(5000)); - let botmessage = args.join(" "); - message.delete().catch(); - message.channel.send(botmessage); - - - } +const { RichEmbed } = require("discord.js"); +const { stripIndents } = require("common-tags"); + +module.exports = { + name: "say", + category: "util", + description: "clean up to last 100 messages ", + usage: "", + run: async (client, message, args) => { + if(!message.member.hasPermission('MANAGE_MESSAGES')) return message.require("off.."); + if (args.length < 1) return message.channel.reply('nothing to say').then(m => m.delete(5000)); + let botmessage = args.join(" "); + message.delete().catch(); + message.channel.send(botmessage); + + + } } \ No newline at end of file diff --git a/events/userUpdate.js b/events/userUpdate.js new file mode 100644 index 0000000..fba5e4e --- /dev/null +++ b/events/userUpdate.js @@ -0,0 +1,26 @@ +const Discord = require("discord.js"); +var dateFormat = require('dateformat'); +module.exports = async (client,oldUser, newUser) => { + + if (newUser.bot) return; + if(oldUser.username === newUser.username) return ; + + + + var log = client.guild.channels.find(ch => ch.name.includes('member-log')) || client.guild.channels.find(ch => ch.name.includes('log')) ; + if (log != null) + var sEmbed = new Discord.RichEmbed() + .setColor("RANDOM") + .setTimestamp() + .setTitle(`:information_source: A User Updated his Username!`) + .setDescription(`**USER**\n<@${newUser.id}>`) + .addField(`**Before**`,` \`\`\`${oldUser.username}\`\`\` `) //what can i do to put oldMessage.cleanContent in codeblock + .addField(`**After**`,`\`\`\`${newUser.username}\`\`\`\ `); + log.send(sEmbed); + + + + + } + +