From 0f2233a529d80b242732bd40ebaecf3fbb56cecf Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 5 Jan 2020 14:19:48 -0500 Subject: removed eslint and fixes --- commands/invite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/invite.js b/commands/invite.js index b0d3ec3..38094b4 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -25,7 +25,7 @@ module.exports.run = async (client, message) => { title: "Invite Command", fields: [{ name: "Invite AleeBot", - value: "[Invite AleeBot to your server.](https://discordapp.com/api/oauth2/authorize?client_id=282547024547545109&permissions=2080375863&scope=bot)" + value: "[Invite AleeBot to your server.](https://top.gg/bot/282547024547545109)" }, { name: "Join the Alee Productions Community", -- cgit v1.2.3 From a06d70c730acbf81c8e9072ed9ce91681afd25e7 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 21 May 2020 16:41:01 -0400 Subject: Added embeds when booting the bot and addeed auto role --- bot_discord.js | 23 ++++++++++++++++++++--- commands/interrogate.js | 2 +- commands/jail.js | 2 +- commands/poweroff.js | 7 ++++++- run_linux.sh | 1 - run_win.bat | 2 +- 6 files changed, 29 insertions(+), 8 deletions(-) (limited to 'commands') diff --git a/bot_discord.js b/bot_discord.js index 4a9b109..340aee7 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -160,6 +160,11 @@ rl.on('line', function(cmd){ break; case "exit": console.log('[i] AleeBot will now exit!'.blue) + const embed = new Discord.RichEmbed() + .setAuthor("AleeBot Status", client.user.avatarURL) + .setDescription("AleeBot is now going offline...") + .setColor("#ff3333") + client.channels.find('id', '606602551634296968').send({embed}); client.destroy(); process.exit(0); break; @@ -198,7 +203,7 @@ client.on('ready', () => { 'Fighting AstralMod', ]; setInterval(() => { - dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); + dbl.postStats(client.guilds.size, client.shards.id, client.shards.total); }, 1800000); client.user.setPresence({ status: 'online', @@ -210,10 +215,22 @@ client.on('ready', () => { }); }, 200000); client.user.setStatus('online'); - client.channels.find('id', '606602551634296968').send("**AleeBot Status:** AleeBot has started."); + const embed = new Discord.RichEmbed() + .setAuthor("AleeBot Status", client.user.avatarURL) + .setDescription("AleeBot has started") + .setColor("#5cd65c") + client.channels.find('id', '606602551634296968').send({embed}); rl.prompt(); }); +client.on('guildMemberAdd', member => { + if (member.guild.id != '243022206437687296') return 0 + var role = member.guild.roles.find((role) => role.name === "Member"); + member.addRole(role); + log(`[i] ${member.user.username} joined Alee Productions.`.green); + log(`[i] I gave ${member.user.username} the "Member" role.`.green); +}); + client.on('guildCreate', guild => { log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); @@ -246,7 +263,7 @@ client.on('message', (msg) => { if (msg.content.toLowerCase().includes("shut") && msg.content.toLowerCase().includes("up")) { switch (Math.floor(Math.random() * 1000) % 3) { case 0: - msg.reply("Excuse me? Can you not speak to me in that tone...") + msg.reply("Hey, Can you not speak to me in that tone...") break; case 1: msg.reply("NO! I can talk as much I can!"); diff --git a/commands/interrogate.js b/commands/interrogate.js index 5630114..ea7de53 100644 --- a/commands/interrogate.js +++ b/commands/interrogate.js @@ -18,7 +18,7 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply ('This is a ACN exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply ('This is a ALP exclusive command.'); if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); diff --git a/commands/jail.js b/commands/jail.js index 18cbfb1..e1ba85f 100644 --- a/commands/jail.js +++ b/commands/jail.js @@ -18,7 +18,7 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply ('This is a ACN exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply ('This is a ALP exclusive command.'); if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); diff --git a/commands/poweroff.js b/commands/poweroff.js index f336bed..3af23b8 100644 --- a/commands/poweroff.js +++ b/commands/poweroff.js @@ -18,8 +18,13 @@ * * *************************************/ module.exports.run = async (client, message, args) => { + const Discord = require('discord.js'); if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - await client.channels.find('id', '606602551634296968').send("**AleeBot Status:** AleeBot is now going offline."); + const embed = new Discord.RichEmbed() + .setAuthor("AleeBot Status", client.user.avatarURL) + .setDescription("AleeBot is now going offline...") + .setColor("#ff3333") + await client.channels.find('id', '606602551634296968').send({embed}); await message.reply(':warning: AleeBot will now exit!'); client.destroy(); process.exit(0); diff --git a/run_linux.sh b/run_linux.sh index fedf8fb..4fe9b97 100644 --- a/run_linux.sh +++ b/run_linux.sh @@ -1,5 +1,4 @@ #!/bin/bash -echo 'Welcome to AleeBot!' for (( ; ; )) do git pull diff --git a/run_win.bat b/run_win.bat index b2d4974..b01fe26 100644 --- a/run_win.bat +++ b/run_win.bat @@ -5,7 +5,7 @@ echo Welcome to the AleeBot Console. echo If you want to self-host this bot, please continue by executing the following steps: echo 1. Create a tokens.json file and include the token of your bot user so that the bot does not error out when connecting to Discord Servers. echo 2. You will need to edit this file that you ran, and remove the 'git pull" line. This causes errors as it will try to pull from the AleeBot git. -echo 3. Finally, you must credit the developers (AleeCorp Developers will work fine). +echo 3. Finally, you must credit the developers (Alee Productions Developers will work fine). echo -------------------------------------------------------------------------------- echo To start the bot when you are ready, type in 'Yes/yes/y' or type in 'debug' to enter debug mode. set /p start=user@AleeBot:~$ -- cgit v1.2.3 From fc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 22 May 2020 20:36:26 -0400 Subject: Added more ALP exclusive logs & cleaning up code --- To be worked on/leave.js | 39 ++- To be worked on/play.js | 159 +++++---- To be worked on/queue.js | 48 ++- To be worked on/skip.js | 60 ++-- bot_discord.js | 790 ++++++++++++++++++++++++--------------------- commands/addquote.js | 46 +-- commands/ask.js | 63 ++-- commands/avatarurl.js | 10 +- commands/balance.js | 59 ++-- commands/ban.js | 32 +- commands/eval.js | 98 +++--- commands/git.js | 86 ++--- commands/help.js | 140 ++++---- commands/info.js | 47 ++- commands/interrogate.js | 39 ++- commands/invite.js | 62 ++-- commands/jail.js | 39 ++- commands/kick.js | 34 +- commands/leaveguild.js | 37 ++- commands/pay.js | 84 ++--- commands/ping.js | 66 ++-- commands/poweroff.js | 49 ++- commands/purge.js | 41 ++- commands/quote.js | 37 ++- commands/say.js | 39 ++- commands/setprefix.js | 59 ++-- commands/suggest.js | 53 ++- commands/suggestfeature.js | 1 + commands/uptime.js | 88 +++-- commands/userinfo.js | 50 ++- commands/vtquote.js | 95 +++--- deprecated/buy.js | 49 ++- deprecated/daily.js | 63 ++-- package.json | 1 + 34 files changed, 1342 insertions(+), 1321 deletions(-) (limited to 'commands') diff --git a/To be worked on/leave.js b/To be worked on/leave.js index e1584f0..6712a8d 100644 --- a/To be worked on/leave.js +++ b/To be worked on/leave.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Leave: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,29 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.'); + if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.'); - if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.') + if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.'); - if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...'); + if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...'); - message.guild.me.voiceChannel.leave(); + message.guild.me.voiceChannel.leave(); - message.channel.send("Leaving channel...") + message.channel.send('Leaving channel...'); +}; - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'leave', - description: 'Leaves voice chat.', - usage: 'leave', - category: '- Music Commands', - }; \ No newline at end of file +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'leave', + description: 'Leaves voice chat.', + usage: 'leave', + category: '- Music Commands', +}; diff --git a/To be worked on/play.js b/To be worked on/play.js index ddf80db..d885ee2 100644 --- a/To be worked on/play.js +++ b/To be worked on/play.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Play: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,108 +15,101 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args, ops) => { - const ytdl = require('ytdl-core'); + const ytdl = require('ytdl-core'); - if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...'); + if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...'); - if (!args[0]) return message.reply('Please input a url.'); + if (!args[0]) return message.reply('Please input a url.'); - let vaildate = await ytdl.validateURL(args[0]); + const vaildate = await ytdl.validateURL(args[0]); - if (!vaildate) return message.reply('Please input a **valid** url.'); + if (!vaildate) return message.reply('Please input a **valid** url.'); - let info = await ytdl.getInfo(args[0]); + const info = await ytdl.getInfo(args[0]); - let data = ops.active.get(message.guild.id) || {}; + const data = ops.active.get(message.guild.id) || {}; - if (!data.connection) data.connection = await message.member.voiceChannel.join(); - if (!data.queue) data.queue = []; - data.guildID = message.guild.id; + if (!data.connection) data.connection = await message.member.voiceChannel.join(); + if (!data.queue) data.queue = []; + data.guildID = message.guild.id; - data.queue.push({ - songTitle: info.title, - requester: message.author.tag, - url: args[0], - announceChannel: message.channel.id - }); - if (!data.dispatcher) play(client, ops, data); - else { - const { RichEmbed } = require('discord.js'); - const embed = new RichEmbed() - .setTitle('This music has been added to the queue!') - .setAuthor(info.title, client.user.avatarURL) + data.queue.push({ + songTitle: info.title, + requester: message.author.tag, + url: args[0], + announceChannel: message.channel.id, + }); + if (!data.dispatcher) play(client, ops, data); + else { + const {RichEmbed} = require('discord.js'); + const embed = new RichEmbed() + .setTitle('This music has been added to the queue!') + .setAuthor(info.title, client.user.avatarURL) + .setColor(0x00afff) + .setTimestamp() + .addField('Title', info.title) + .addField('Requested by:', message.author.tag) + .setFooter('AleeBot Music Player'); + + message.channel.send({embed}); + } + + ops.active.set(message.guild.id, data); +}; + +async function play(client, ops, data) { + const ytdl = require('ytdl-core'); + const {RichEmbed} = require('discord.js'); + const embed = new RichEmbed() + .setTitle('Now playing!') + .setAuthor(data.queue[0].songTitle, client.user.avatarURL) .setColor(0x00afff) .setTimestamp() - .addField('Title', info.title) - .addField('Requested by:', message.author.tag) + .addField('Title', data.queue[0].songTitle) + .addField('Requested by:', data.queue[0].requester) + // .addField('Link', info.url) + // .addField('Duration', time) .setFooter('AleeBot Music Player'); - - message.channel.send({embed}) - } - - ops.active.set(message.guild.id, data); - - }; - - async function play(client, ops, data) { - const ytdl = require('ytdl-core'); - const { RichEmbed } = require('discord.js'); - const embed = new RichEmbed() - .setTitle('Now playing!') - .setAuthor(data.queue[0].songTitle, client.user.avatarURL) - .setColor(0x00afff) - .setTimestamp() - .addField('Title', data.queue[0].songTitle) - .addField('Requested by:', data.queue[0].requester) - // .addField('Link', info.url) - // .addField('Duration', time) - .setFooter('AleeBot Music Player'); - - client.channels.get(data.queue[0].announceChannel).send({embed}) - - data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly'})); - data.dispatcher.guildID = data.guildID; - - data.dispatcher.once('finish', function () { - finish(client, ops, this); - }); - - }; - - function finish(client, ops, dispatcher) { - let fetched = ops.active.get(dispatcher.guildID); + client.channels.get(data.queue[0].announceChannel).send({embed}); - fetched.queue.shift(); + data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, {filter: 'audioonly'})); + data.dispatcher.guildID = data.guildID; - if (fetched.queue.length > 0) { + data.dispatcher.once('finish', function() { + finish(client, ops, this); + }); +}; - ops.active.set(dispatcher.guildID, fetched); +function finish(client, ops, dispatcher) { + const fetched = ops.active.get(dispatcher.guildID); - play(client, ops, fetched); + fetched.queue.shift(); - } else { - ops.active.delete(dispatcher.guildID); + if (fetched.queue.length > 0) { + ops.active.set(dispatcher.guildID, fetched); - let vc = client.guild.get(dispatcher.guildID).me.voiceChannel; + play(client, ops, fetched); + } else { + ops.active.delete(dispatcher.guildID); - if (vc) vc.leave(); + const vc = client.guild.get(dispatcher.guildID).me.voiceChannel; - } + if (vc) vc.leave(); + } +} - } - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'play', - description: 'Plays music.', - usage: 'play [url]', - category: '- Music Commands', - }; \ No newline at end of file +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'play', + description: 'Plays music.', + usage: 'play [url]', + category: '- Music Commands', +}; diff --git a/To be worked on/queue.js b/To be worked on/queue.js index 77d86b7..e1ef7c6 100644 --- a/To be worked on/queue.js +++ b/To be worked on/queue.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Queue: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,35 +15,33 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args, ops) => { - - let fetched = ops.active.get(message.guild.id); + const fetched = ops.active.get(message.guild.id); - if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); + if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); - let queue = fetched.queue - let nowPlaying = queue[0]; + const queue = fetched.queue; + const nowPlaying = queue[0]; - let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`; + let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`; - for (var i = 1; i < queue.length; i++) { - resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n` - } + for (let i = 1; i < queue.length; i++) { + resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n`; + } - message.channel.send(resp); + message.channel.send(resp); +}; - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'queue', - description: 'Checks what music is in queue.', - usage: 'queue', - category: '- Music Commands', - }; \ No newline at end of file +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'queue', + description: 'Checks what music is in queue.', + usage: 'queue', + category: '- Music Commands', +}; diff --git a/To be worked on/skip.js b/To be worked on/skip.js index 5a6d2b7..44880bd 100644 --- a/To be worked on/skip.js +++ b/To be worked on/skip.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Skip: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,48 +15,44 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args, ops) => { + const fetched = ops.active.get(message.guild.id); - let fetched = ops.active.get(message.guild.id); - - if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); - - if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.') - - let userCount = message.member.voiceChannel.members.size; + if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); - let required = Math.ceil(userCount/2); + if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.'); - if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = []; + const userCount = message.member.voiceChannel.members.size; - if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`) + const required = Math.ceil(userCount/2); - fetched.queue[0].voteSkips.push(message.member.id); + if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = []; - ops.active.set(message.guild.id, fetched); + if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); - if (fetched.queue[0].voteSkips.length >= required) { + fetched.queue[0].voteSkips.push(message.member.id); - message.channel.send('Successfully skipped song!'); + ops.active.set(message.guild.id, fetched); - return fetched.dispatcher.emit('finish'); + if (fetched.queue[0].voteSkips.length >= required) { + message.channel.send('Successfully skipped song!'); - } + return fetched.dispatcher.emit('finish'); + } - message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`) + message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); +}; - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'skip', - description: 'Skips a music.', - usage: 'skip', - category: '- Music Commands', - }; \ No newline at end of file +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'skip', + description: 'Skips a music.', + usage: 'skip', + category: '- Music Commands', +}; diff --git a/bot_discord.js b/bot_discord.js index 5380db6..5c437c9 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -1,366 +1,424 @@ -/**************************************** - * - * AleeBot: Made for discord servers - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -const Discord = require('discord.js'); -const moment = require('moment'); -const readline = require('readline'); -const colors = require('colors'); -const DBL = require("dblapi.js"); -const client = new Discord.Client({ - disableEveryone: true -}); -const settings = require('./storage/settings.json') -const fs = require('fs'); -const api = require('./tokens.json'); -const dbl = new DBL(api.dbltoken, client); -const active = new Map(); -const ownerID = "242775871059001344"; - -const log = message => { - - console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white); - -}; - -const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - prompt: '> '.gray -}); - -console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2020 Alee Productions`.gray); -console.log('This program comes with ABSOLUTELY NO WARRANTY; for details type `show w\'.'.gray); -console.log ('This is free software, and you are welcome to redistribute it'.gray); -console.log ('under certain conditions; type `show c\' for details.\n'.gray) - -if (process.argv.indexOf("--debug") == -1) { - console.log("Running AleeBot without --debug command line flag. Debug output disabled.\n".yellow); -} else { - console.log('[!] Entering debug mode...'.yellow) - client.on('debug', function(info) { - log(info.gray); - }); - client.on('warn', function(info) { - log(info.red); - }); -} - -if (process.argv.indexOf("--beta") == -1) { - client.login(api.abtoken).catch(function() { - console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); - process.exit(0); - }); - -} else { - client.login(api.abbtoken).catch(function() { - console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); - process.exit(0); - }); -} - -client.commands = new Discord.Collection(); -client.aliases = new Discord.Collection(); - -fs.readdir('./commands', (err, files) => { - if (err) console.error(err); - log(`[!] Attempting to load a total of ${files.length} commands into the memory.`.cyan); - files.forEach(file => { - try { - const command = require(`./commands/${file}`); - log(`[!] Attempting to load the command "${command.help.name}".`.cyan); - client.commands.set(command.help.name, command); - command.conf.aliases.forEach(alias => { - client.aliases.set(alias, command.help.name); - log(`[!] Attempting to load "${alias}" as an alias for "${command.help.name}"`.cyan); - }); - } - catch (err) { - log('[X] An error has occured trying to load a command. Here is the error.'.red); - console.log(err.stack); - } - }); - log('[>] Command Loading complete!'.green); - console.log('\n'); -}); - -rl.on('line', function(cmd){ - var args = cmd.split(" "); - switch(args[0]) { - case "guilds": - if (client.guilds.size === 0) { - console.log(('[!] No guilds found.'.yellow)); - } else { - console.log('[i] Here\'s the servers that AleeBot is connected to:') - for ([id, guild] of client.guilds) { - console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`.blue); - } - } - break; - case "channels": - if (!args[1]) { - console.log('[!] Please insert the guild\'s ID.'.yellow) - } else { - var guild = client.guilds.get(args[1]); - console.log('[i] Here\'s the channels that this guild have:'.blue) - for ([id, channel, guild] of guild && client.channels) { - console.log(` Channel: #${channel.name} - ID: ${channel.id}`.blue); - } - } - break; - case "leave": - if (!args[1]) { - console.log('[!] Please insert the guild\'s ID.'.yellow); - } else { - var guild = client.guilds.get(args[1]); - guild.leave(); - } - break; - case "broadcast": - if (!args[1]) { - console.log('[!] Usage: broadcast [guildID] [channelID].'.yellow); - } else { - let broadcast = args.join(" ").slice(48); - var guild = null; - guild = client.guilds.get(args[1]); - var channel = null; - channel = guild.channels.get(args[2]) - if (channel != null) { - channel.send(broadcast); - } - } - break; - case "uptime": - let uptime = parseInt(client.uptime); - uptime = Math.floor(uptime / 1000); - let uptimeMinutes = Math.floor(uptime / 60); - const minutes = uptime % 60; - let hours = 0; - while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; - } - const uptimeSeconds = minutes % 60; - console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue); - break; - case "exit": - console.log('[i] AleeBot will now exit!'.blue) - const embed = new Discord.RichEmbed() - .setAuthor("AleeBot Status", client.user.avatarURL) - .setDescription("AleeBot is now going offline...") - .setColor("#ff3333") - client.channels.find('id', '606602551634296968').send({embed}); - client.destroy(); - process.exit(0); - break; - case "help": - var msg = (`AleeBot `+ settings.abVersion +` Console Help\n\n`); - msg += (`guilds - Shows all guilds that AleeBot's on.\n`) - msg += (`channels - Shows all the channels that the guilds have.\n`) - msg += (`leave - Leaves a guild.\n`) - msg += (`broadcast - Broadcasts a message to a server.\n`) - msg += (`uptime - Shows the uptime for AleeBot.\n`) - msg += (`help - Shows this command.\n`) - msg += (`exit - Exits AleeBot.\n`) - console.log(msg.cyan); - break; - default: - console.log('Unknown command, type \'help\' to list the commands...'.yellow) - } - rl.prompt(); -}); - - -client.on('ready', () => { - log('[>] AleeBot is now ready!'.green); - log(`[i] Logged in as ${client.user.tag}`.green); - log(`[i] Default Prefix: ${settings.prefix}`.green) - log(`[i] Bot ID: ${client.user.id}`.green); - log(`[i] Token: ${api.abtoken}`.green); - log(`[i] Running version ${settings.abVersion} and in ${client.guilds.size} guilds`.green); - - client.setInterval(function() { - const games = [ - 'AleeBot ' + settings.abVersion + ' | ' + settings.prefix + 'help', - 'Annoying Alee', - 'Coding stuff', - 'Drawing shapes', - 'Fighting AstralMod', - ]; - setInterval(() => { - dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); - }, 1800000); - client.user.setPresence({ - status: 'online', - afk: false, - game: { - type: 0, - name: games[Math.floor(Math.random() * games.length)], - }, - }); - }, 200000); - client.user.setStatus('online'); - const embed = new Discord.RichEmbed() - .setAuthor("AleeBot Status", client.user.avatarURL) - .setDescription("AleeBot has started") - .setColor("#5cd65c") - client.channels.find('id', '606602551634296968').send({embed}); - rl.prompt(); -}); - -client.on('guildMemberAdd', member => { - if (member.guild.id != '243022206437687296') return 0 - var role = member.guild.roles.find((role) => role.name === "Member"); - member.addRole(role); - log(`[i] ${member.user.username} joined Alee Productions.`.green); - log(`[i] I gave ${member.user.username} the "Member" role.`.green); -}); - -client.on('messageUpdate', async(oldMessage, newMessage) => { - if (oldMessage.guild.id != '243022206437687296') return 0 - if (oldMessage.content === newMessage.content){ - return; - } - const logEmbed = new Discord.RichEmbed() - .setAuthor("AleeBot Logging", client.user.avatarURL) - .setDescription(`A message from ${oldMessage.author.username} was edited`) - .addField("Before: ", `\`\`\`${oldMessage.content}\`\`\``) - .addField("After: ", `\`\`\`${newMessage.content}\`\`\``) - .setColor("#ffff1a") - .setTimestamp() - - let editmessage = newMessage.guild.channels.find(ch => ch.name === "logs") - if(!editmessage) return; - - editmessage.send(logEmbed); - - -}) - -client.on('guildCreate', guild => { - - log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); - -}); - - -client.on('guildDelete', guild => { - - log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`.red); - -}); - -dbl.on('posted', () => { - log('Server count posted!'.blue); -}); - -dbl.on('error', e => { - log(`[X | DBL ERROR] ${e}`.red); -}); - -client.on('message', (msg) => { - if (msg.author.bot) return; - - if (msg.mentions != null && msg.mentions.users != null) { - if (msg.mentions.users.has("282547024547545109")){ - if (msg.content.toLowerCase().includes("hello") || (msg.content.toLowerCase().includes("hi"))) { - msg.reply(`Hello ${msg.author.username}!`); - } else { - if (msg.content.toLowerCase().includes("shut") && msg.content.toLowerCase().includes("up")) { - switch (Math.floor(Math.random() * 1000) % 3) { - case 0: - msg.reply("Hey, Can you not speak to me in that tone...") - break; - case 1: - msg.reply("NO! I can talk as much I can!"); - break; - case 2: - msg.reply("Nah I won't...."); - break; - } - } else if (msg.content.toLowerCase().includes("how") && msg.content.toLowerCase().includes("are") && msg.content.toLowerCase().includes("you")) { - msg.reply("I'm doing OK, I suppose..."); - } else if (msg.content.toLowerCase().includes("ok") && msg.content.toLowerCase().includes("google")) { - msg.reply("Erm... I am not google, if you want to use Google here's the link: https://www.google.com"); - } else if (msg.content.toLowerCase().includes("f") && msg.content.toLowerCase().includes("off")) { - msg.reply("Do you want a hammer? :hammer:"); - } else if (msg.content.toLowerCase().includes("aleearmy")) { - msg.reply("Oh yeah.. that thing Alee made..."); - } - } - } - }; - - - let prefixes = JSON.parse(fs.readFileSync("./storage/prefixes.json", "utf8")); - - if(!prefixes[msg.guild.id]){ - prefixes[msg.guild.id] = { - prefixes: settings.prefix - }; - } - - let prefix = prefixes[msg.guild.id].prefixes - - - if (!msg.content.startsWith(prefix)) return; - const args = msg.content.slice(prefix.length).trim().split(/ +/g); - const command = args.shift(); - let cmd; - - if (client.commands.has(command)) { - cmd = client.commands.get(command); - } else if (client.aliases.has(command)) { - cmd = client.commands.get(client.aliases.get(command)); - } - - if (cmd) { - if (cmd.conf.guildOnly == true) { - if (!msg.channel.guild) { - return msg.channel.createMessage('This command can only be ran in a guild.'); - } - } - try { - - let ops = { - ownerID: ownerID, - active: active - } - - cmd.run(client, msg, args, ops); - } - catch (e) { - console.error(e); - } - } -}); - -process.on('unhandledRejection', function(err, p) { - -log("[X | UNCAUGHT PROMISE] " + err.stack.red); - -}); -client.on('reconnecting', function() { - log("[!] AleeBot has disconnected from Discord and is now attempting to reconnect.".yellow); -}); - -client.on('disconnect', function() { - log("[X] AleeBot has disconnected from Discord and will not attempt to reconnect.".red); - console.log("At this point, you'll need to restart AleeBot.".red); - process.exit(0); -}); +/** ************************************** + * + * AleeBot: Made for discord servers + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +const Discord = require('discord.js'); +const moment = require('moment'); +const readline = require('readline'); +const colors = require('colors'); +const DBL = require('dblapi.js'); +const i18next = require('i18next'); +const client = new Discord.Client({ + disableEveryone: true, +}); +const settings = require('./storage/settings.json'); +const fs = require('fs'); +const api = require('./tokens.json'); +const dbl = new DBL(api.dbltoken, client); +const active = new Map(); +const ownerID = '242775871059001344'; + +const log = (message) => { + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white); +}; + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + prompt: '> '.gray, +}); + +console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2020 Alee Productions`.gray); +console.log('This program comes with ABSOLUTELY NO WARRANTY; for details type `show w\'.'.gray); +console.log('This is free software, and you are welcome to redistribute it'.gray); +console.log('under certain conditions; type `show c\' for details.\n'.gray); + +if (process.argv.indexOf('--debug') == -1) { + console.log('Running AleeBot without --debug command line flag. Debug output disabled.\n'.yellow); +} else { + console.log('[!] Entering debug mode...'.yellow); + client.on('debug', function(info) { + log(info.gray); + }); + client.on('warn', function(info) { + log(info.red); + }); +} + +if (process.argv.indexOf('--beta') == -1) { + client.login(api.abtoken).catch(function() { + console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); + process.exit(0); + }); +} else { + client.login(api.abbtoken).catch(function() { + console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); + process.exit(0); + }); +} + +client.commands = new Discord.Collection(); +client.aliases = new Discord.Collection(); + +fs.readdir('./commands', (err, files) => { + if (err) console.error(err); + log(`[!] Attempting to load a total of ${files.length} commands into the memory.`.cyan); + files.forEach((file) => { + try { + const command = require(`./commands/${file}`); + log(`[!] Attempting to load the command "${command.help.name}".`.cyan); + client.commands.set(command.help.name, command); + command.conf.aliases.forEach((alias) => { + client.aliases.set(alias, command.help.name); + log(`[!] Attempting to load "${alias}" as an alias for "${command.help.name}"`.cyan); + }); + } catch (err) { + log('[X] An error has occured trying to load a command. Here is the error.'.red); + console.log(err.stack); + } + }); + log('[>] Command Loading complete!'.green); + console.log('\n'); +}); + +rl.on('line', function(cmd) { + const args = cmd.split(' '); + switch (args[0]) { + case 'guilds': + if (client.guilds.size === 0) { + console.log(('[!] No guilds found.'.yellow)); + } else { + console.log('[i] Here\'s the servers that AleeBot is connected to:'); + for ([id, guild] of client.guilds) { + console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`.blue); + } + } + break; + case 'channels': + if (!args[1]) { + console.log('[!] Please insert the guild\'s ID.'.yellow); + } else { + var guild = client.guilds.get(args[1]); + console.log('[i] Here\'s the channels that this guild have:'.blue); + for ([id, channel, guild] of guild && client.channels) { + console.log(` Channel: #${channel.name} - ID: ${channel.id}`.blue); + } + } + break; + case 'leave': + if (!args[1]) { + console.log('[!] Please insert the guild\'s ID.'.yellow); + } else { + var guild = client.guilds.get(args[1]); + guild.leave(); + } + break; + case 'broadcast': + if (!args[1]) { + console.log('[!] Usage: broadcast [guildID] [channelID].'.yellow); + } else { + const broadcast = args.join(' ').slice(48); + var guild = null; + guild = client.guilds.get(args[1]); + var channel = null; + channel = guild.channels.get(args[2]); + if (channel != null) { + channel.send(broadcast); + } + } + break; + case 'uptime': + let uptime = parseInt(client.uptime); + uptime = Math.floor(uptime / 1000); + let uptimeMinutes = Math.floor(uptime / 60); + const minutes = uptime % 60; + let hours = 0; + while (uptimeMinutes >= 60) { + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + const uptimeSeconds = minutes % 60; + console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue); + break; + case 'exit': + console.log('[i] AleeBot will now exit!'.blue); + const asyncPowerOff = async () => { + const embed = new Discord.RichEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL) + .setDescription('AleeBot is now going offline...') + .setColor('#ff3333'); + await client.channels.find('id', '606602551634296968').send({embed}); + }; + asyncPowerOff(); + client.destroy(); + process.exit(0); + break; + case 'help': + let msg = (`AleeBot `+ settings.abVersion +` Console Help\n\n`); + msg += (`guilds - Shows all guilds that AleeBot's on.\n`); + msg += (`channels - Shows all the channels that the guilds have.\n`); + msg += (`leave - Leaves a guild.\n`); + msg += (`broadcast - Broadcasts a message to a server.\n`); + msg += (`uptime - Shows the uptime for AleeBot.\n`); + msg += (`help - Shows this command.\n`); + msg += (`exit - Exits AleeBot.\n`); + console.log(msg.cyan); + break; + default: + console.log('Unknown command, type \'help\' to list the commands...'.yellow); + } + rl.prompt(); +}); + + +client.on('ready', () => { + log('[>] AleeBot is now ready!'.green); + log(`[i] Logged in as ${client.user.tag}`.green); + log(`[i] Default Prefix: ${settings.prefix}`.green); + log(`[i] Bot ID: ${client.user.id}`.green); + log(`[i] Token: ${api.abtoken}`.green); + log(`[i] Running version ${settings.abVersion} and in ${client.guilds.size} guilds`.green); + + client.setInterval(function() { + const games = [ + 'AleeBot ' + settings.abVersion + ' | ' + settings.prefix + 'help', + 'Annoying Alee', + 'Coding stuff', + 'Drawing shapes', + 'Fighting AstralMod', + ]; + /* + setInterval(() => { + dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); + }, 1800000);*/ + client.user.setPresence({ + status: 'online', + afk: false, + game: { + type: 0, + name: games[Math.floor(Math.random() * games.length)], + }, + }); + }, 200000); + client.user.setStatus('online'); + const embed = new Discord.RichEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL) + .setDescription('AleeBot has started') + .setColor('#5cd65c'); + client.channels.find('id', '606602551634296968').send({embed}); + rl.prompt(); +}); + +client.on('guildMemberAdd', (member) => { + if (member.guild.id != '243022206437687296') return 0; + const role = member.guild.roles.find((role) => role.name === 'Member'); + member.addRole(role); + log(`[i] ${member.user.username} joined Alee Productions.`.green); + log(`[i] I gave ${member.user.username} the "Member" role.`.green); +}); + +client.on('messageUpdate', async (oldMessage, newMessage) => { + if (oldMessage.guild.id != '243022206437687296') return 0; + if (oldMessage.content === newMessage.content) { + return; + } + const logEmbed = new Discord.RichEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL) + .setDescription(`A message from ${oldMessage.author.username} was edited`) + .addField('Before: ', `\`\`\`${oldMessage.content}\`\`\``) + .addField('After: ', `\`\`\`${newMessage.content}\`\`\``) + .setColor('#ffff1a') + .setTimestamp() + .setFooter(`Author ID: ${oldMessage.author.id}`); + + const editMessage = newMessage.guild.channels.find((ch) => ch.name === 'logs'); + if (!editMessage) return; + + editMessage.send(logEmbed); +}); + +client.on('messageDelete', (message) => { + if (message.guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.RichEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL) + .setDescription(`A message from ${message.author.username} was deleted`) + .addField('Deleted Message: ', `\`\`\`${message.content}\`\`\``) + .setColor('#ff021b') + .setTimestamp() + .setFooter(`Author ID: ${message.author.id}`); + + const deleteMessage = message.guild.channels.find((ch) => ch.name === 'logs'); + if (!deleteMessage) return; + + deleteMessage.send(logEmbed); +}); + +client.on('guildBanAdd', (guild, user) => { + if (guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.RichEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL) + .setDescription(`This user got banned from ${guild.name}`) + .addField(`User:`, `${user.tag}`) + .addField(`User ID:`, `${user.id}`) + .setColor('#ff021b') + .setTimestamp(); + + const banMessage = guild.channels.find((ch) => ch.name === 'logs'); + if (!banMessage) return; + + banMessage.send(logEmbed); +}); + +client.on('guildBanRemove', (guild, user) => { + if (guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.RichEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL) + .setDescription(`This user got unbanned from ${guild.name}`) + .addField(`User:`, `${user.tag}`) + .addField(`User ID:`, `${user.id}`) + .setColor('#ff021b') + .setTimestamp(); + + const banMessage = guild.channels.find((ch) => ch.name === 'logs'); + if (!banMessage) return; + + banMessage.send(logEmbed); +}); + +client.on('guildCreate', (guild) => { + log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); + /* + const logEmbed = new Discord.RichEmbed() + .setAuthor("AleeBot", client.user.avatarURL) + .setDescription(`I got added to this server!`) + .addField(`Server Name:`, `${guild.name}`) + .addField(`Server ID:`, `${guild.id}`) + .setColor("#5cd65c") + + client.channels.find('id', '606602551634296968').send({logEmbed});*/ +}); + + +client.on('guildDelete', (guild) => { + log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`.red); + /* + const logEmbed = new Discord.RichEmbed() + .setAuthor("AleeBot", client.user.avatarURL) + .setDescription(`I got removed from server...`) + .addField(`Server Name:`, `${guild.name}`) + .addField(`Server ID:`, `${guild.id}`) + .setColor("#5cd65c") + + client.channels.find('id', '606602551634296968').send({logEmbed});*/ +}); + +dbl.on('posted', () => { + log('Server count posted!'.blue); +}); + +dbl.on('error', (e) => { + log(`[X | DBL ERROR] ${e}`.red); +}); + +client.on('message', (msg) => { + if (msg.author.bot) return; + + if (msg.mentions != null && msg.mentions.users != null) { + if (msg.mentions.users.has('282547024547545109')) { + if (msg.content.toLowerCase().includes('hello') || (msg.content.toLowerCase().includes('hi'))) { + msg.reply(`Hello ${msg.author.username}!`); + } else { + if (msg.content.toLowerCase().includes('shut') && msg.content.toLowerCase().includes('up')) { + switch (Math.floor(Math.random() * 1000) % 3) { + case 0: + msg.reply('Hey, Can you not speak to me in that tone...'); + break; + case 1: + msg.reply('NO! I can talk as much I can!'); + break; + case 2: + msg.reply('Nah I won\'t....'); + break; + } + } else if (msg.content.toLowerCase().includes('how') && msg.content.toLowerCase().includes('are') && msg.content.toLowerCase().includes('you')) { + msg.reply('I\'m doing OK, I suppose...'); + } else if (msg.content.toLowerCase().includes('ok') && msg.content.toLowerCase().includes('google')) { + msg.reply('Erm... I am not google, if you want to use Google here\'s the link: https://www.google.com'); + } else if (msg.content.toLowerCase().includes('f') && msg.content.toLowerCase().includes('off')) { + msg.reply('Do you want a hammer? :hammer:'); + } else if (msg.content.toLowerCase().includes('aleearmy')) { + msg.reply('Oh yeah.. that thing Alee made...'); + } + } + } + }; + + + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); + + if (!prefixes[msg.guild.id]) { + prefixes[msg.guild.id] = { + prefixes: settings.prefix, + }; + } + + const prefix = prefixes[msg.guild.id].prefixes; + + + if (!msg.content.startsWith(prefix)) return; + const args = msg.content.slice(prefix.length).trim().split(/ +/g); + const command = args.shift(); + let cmd; + + if (client.commands.has(command)) { + cmd = client.commands.get(command); + } else if (client.aliases.has(command)) { + cmd = client.commands.get(client.aliases.get(command)); + } + + if (cmd) { + if (cmd.conf.guildOnly == true) { + if (!msg.channel.guild) { + return msg.channel.createMessage('This command can only be ran in a guild.'); + } + } + try { + const ops = { + ownerID: ownerID, + active: active, + }; + + cmd.run(client, msg, args, ops); + } catch (e) { + console.error(e); + } + } +}); + +process.on('unhandledRejection', function(err, p) { + log('[X | UNCAUGHT PROMISE] ' + err.stack.red); +}); +client.on('reconnecting', function() { + log('[!] AleeBot has disconnected from Discord and is now attempting to reconnect.'.yellow); +}); + +client.on('disconnect', function() { + log('[X] AleeBot has disconnected from Discord and will not attempt to reconnect.'.red); + console.log('At this point, you\'ll need to restart AleeBot.'.red); + process.exit(0); +}); diff --git a/commands/addquote.js b/commands/addquote.js index 04df3f4..7782b91 100644 --- a/commands/addquote.js +++ b/commands/addquote.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * AddQuote: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,19 +15,19 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { /* const moment = require('moment'); const log = message => { - + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`); - + }; const fs = require('fs'); if(!args[0]) return message.reply(`Usage: ab:addquote [author] [authorImage] [quote] [year]`); - + let quotes = JSON.parse(fs.readFileSync("./storage/quotes.json", "utf8")); quotes = { @@ -36,25 +36,25 @@ module.exports.run = async (client, message, args) => { quote: args[2], year: args[3] }; - + fs.writeFile("./storage/quotes.json", JSON.stringify(quotes), (err) =>{ if (err) log(err) }) - + message.reply(`You just added a new quote!`); - log(`[i] A quote has been added to quotes.json...`) + log(`[i] A quote has been added to quotes.json...`) */ - message.reply('Command is broken for now'); - }; - - exports.conf = { - aliases: [], - guildOnly: true, - }; - exports.help = { - name: 'addquote', - description: 'Sets the guild prefix.', - usage: 'addquote [author] [authorImage] [quote] [year]', - category: '- Quote Commands', - }; - + message.reply('Command is broken for now'); +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; +exports.help = { + name: 'addquote', + description: 'Sets the guild prefix.', + usage: 'addquote [author] [authorImage] [quote] [year]', + category: '- Quote Commands', +}; + diff --git a/commands/ask.js b/commands/ask.js index db9e10e..0bc0761 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Ask: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,35 +15,34 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - let abaskanswer = [ - "Yes.", - "Nope. Just kidding :P", - "Definitely!", - "No.", - "Yep. Just kidding :P", - "I doubt it.", - "Maybe?", - "I don't know?", - "Hmm let me think :thinking:" - ]; - if (args[1]) { - message.channel.sendMessage(abaskanswer[Math.floor(Math.random() * abaskanswer.length)]); - } else { - message.channel.sendMessage("Sorry, I don't know what your saying.") - } - }; - - exports.conf = { - aliases: ['8ball'], - guildOnly: false, - }; - exports.help = { - name: 'ask', - description: 'Give AleeBot a question!', - usage: 'ask [args]', - category: '- Fun Commands', - }; - \ No newline at end of file + const abaskanswer = [ + 'Yes.', + 'Nope. Just kidding :P', + 'Definitely!', + 'No.', + 'Yep. Just kidding :P', + 'I doubt it.', + 'Maybe?', + 'I don\'t know?', + 'Hmm let me think :thinking:', + ]; + if (args[1]) { + message.channel.sendMessage(abaskanswer[Math.floor(Math.random() * abaskanswer.length)]); + } else { + message.channel.sendMessage('Sorry, I don\'t know what your saying.'); + } +}; + +exports.conf = { + aliases: ['8ball'], + guildOnly: false, +}; +exports.help = { + name: 'ask', + description: 'Give AleeBot a question!', + usage: 'ask [args]', + category: '- Fun Commands', +}; diff --git a/commands/avatarurl.js b/commands/avatarurl.js index 018bc7a..7f9c256 100644 --- a/commands/avatarurl.js +++ b/commands/avatarurl.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * AvatarURL: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,12 +15,12 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - message.reply(message.author.avatarURL); + message.reply(message.author.avatarURL); }; - + exports.conf = { aliases: [], guildOnly: false, diff --git a/commands/balance.js b/commands/balance.js index ae575cc..7b340b2 100644 --- a/commands/balance.js +++ b/commands/balance.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Balance: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,37 +15,36 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const db = require('quick.db'); - const { RichEmbed } = require('discord.js'); + const db = require('quick.db'); + const {RichEmbed} = require('discord.js'); + + const user = message.mentions.users.first() || message.author; - let user = message.mentions.users.first() || message.author; + let balance = await db.fetch(`userBalance_${user.id}`); - let balance = await db.fetch(`userBalance_${user.id}`); + if (balance === null) { + db.set(`userBalance_${message.author.id}`, 0); + balance = 0; + } + const embed = new RichEmbed() + .setDescription(`**AleeCorp Bank**`) + .addField('Account Holder: ', user.username, true) + .addField('Account Balance: ', balance, true) + .setColor('#1fd619'); - if (balance === null) { - db.set(`userBalance_${message.author.id}`, 0); - balance = 0; - } - const embed = new RichEmbed() - .setDescription(`**AleeCorp Bank**`) - .addField('Account Holder: ', user.username, true) - .addField('Account Balance: ', balance, true) - .setColor('#1fd619') + message.channel.send({embed}); +}; - message.channel.send({embed}) - }; - - exports.conf = { - aliases: ['bal', 'money'], - guildOnly: false, - }; - exports.help = { - name: 'balance', - description: 'Checks the balance of AleeBot', - usage: 'balance [@someone (optional)]', - category: '- Economy Commands', - }; - \ No newline at end of file +exports.conf = { + aliases: ['bal', 'money'], + guildOnly: false, +}; +exports.help = { + name: 'balance', + description: 'Checks the balance of AleeBot', + usage: 'balance [@someone (optional)]', + category: '- Economy Commands', +}; diff --git a/commands/ban.js b/commands/ban.js index 6331347..354dcaa 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Ban: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,22 +15,22 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - const Discord = require('discord.js'); - const mreason = args.join(" ").slice(22); - if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply("It looks like that you don't have the permissions to ban people.") - if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) return message.reply('Uhh... I don\'t have permission to ban members.'); - const member = message.mentions.members.first(); - if (!member) return message.reply("Uhh... Please mention a member first."); - member.ban(`Banned by ${message.author.tag} Reason: ` + mreason); - const embed = new Discord.RichEmbed() - .setTitle('User Banned!') - .setColor('#1fd619') - .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``) - await message.channel.send({ embed }); + const Discord = require('discord.js'); + const mreason = args.join(' ').slice(22); + if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.'); + if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) return message.reply('Uhh... I don\'t have permission to ban members.'); + const member = message.mentions.members.first(); + if (!member) return message.reply('Uhh... Please mention a member first.'); + member.ban(`Banned by ${message.author.tag} Reason: ` + mreason); + const embed = new Discord.RichEmbed() + .setTitle('User Banned!') + .setColor('#1fd619') + .addField('**User:**', `${member.user.tag}`) + .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embed}); }; exports.conf = { diff --git a/commands/eval.js b/commands/eval.js index 90b7030..2147376 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Eval: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions & jtsshieh + PokeWorld * @@ -15,72 +15,70 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - const { RichEmbed } = require('discord.js'); - const code = args.join(' '); - - let evaled; - let remove; - - try { - remove = text => { - if (typeof(text) === 'string') { - return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); - } else { - return text; - } - }; - - evaled = eval(code); - - if (typeof evaled !== 'string') { - evaled = require('util').inspect(evaled); + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const {RichEmbed} = require('discord.js'); + const code = args.join(' '); + + let evaled; + let remove; + + try { + remove = (text) => { + if (typeof(text) === 'string') { + return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + } else { + return text; } - - } catch (err) { - const embed = new RichEmbed() + }; + + evaled = eval(code); + + if (typeof evaled !== 'string') { + evaled = require('util').inspect(evaled); + } + } catch (err) { + const embed = new RichEmbed() .setAuthor('Eval Error') .setDescription('Eval\'s result') .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', client.user.avatarURL) .setColor('RED'); - return message.channel.send({ embed }); - } - - try { - const embed = new RichEmbed() + return message.channel.send({embed}); + } + + try { + const embed = new RichEmbed() .setAuthor('Eval Success') .setDescription('Eval\'s result') .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) .addField(':outbox_tray: Output:', `\`\`\`js\n${remove(evaled)}\n\`\`\``) .setFooter('Eval', client.user.avatarURL) .setColor('GREEN'); - - return message.channel.send({ embed }); - } catch (err) { - const embed = new RichEmbed() + + return message.channel.send({embed}); + } catch (err) { + const embed = new RichEmbed() .setAuthor('Eval Error') .setDescription('Eval\'s result') .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', client.user.avatarURL) .setColor('RED'); - return message.channel.send({ embed }); - } - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'eval', - description: 'Evalulates commands.', - usage: '', - category: '- Owners Only', - }; - \ No newline at end of file + return message.channel.send({embed}); + } +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'eval', + description: 'Evalulates commands.', + usage: '', + category: '- Owners Only', +}; diff --git a/commands/git.js b/commands/git.js index d6bed8b..cf754f4 100644 --- a/commands/git.js +++ b/commands/git.js @@ -1,43 +1,43 @@ -/**************************************** - * - * Git: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const git = require('git-last-commit'); - git.getLastCommit(function(err, commit) { - const embed = new Discord.RichEmbed() - .setTitle('GitHub Information') - .addField('**Repository:**', 'https://github.com/aleeproductions/AleeBot-JS') - .addField('**Last Commit:**', commit.subject) - .addField('**Commited By:**', commit.author.name) - .setColor('#1fd619') - message.channel.send({ embed }); - }) -}; - -exports.conf = { - aliases: [], - guildOnly: false, -}; -exports.help = { - name: 'git', - description: 'Get the git info.', - usage: 'git', - category: '- General Commands', -}; +/** ************************************** + * + * Git: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +module.exports.run = async (client, message) => { + const Discord = require('discord.js'); + const git = require('git-last-commit'); + git.getLastCommit(function(err, commit) { + const embed = new Discord.RichEmbed() + .setTitle('GitHub Information') + .addField('**Repository:**', 'https://github.com/aleeproductions/AleeBot-JS') + .addField('**Last Commit:**', commit.subject) + .addField('**Commited By:**', commit.author.name) + .setColor('#1fd619'); + message.channel.send({embed}); + }); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'git', + description: 'Get the git info.', + usage: 'git', + category: '- General Commands', +}; diff --git a/commands/help.js b/commands/help.js index eb53b40..9d94c80 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,70 +1,70 @@ -/**************************************** - * - * Help: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -const Discord = require('discord.js'); -const fs = require('fs'); -module.exports.run = async (client, message) => { - const categories = []; - const commands = Array.from(client.commands.keys()); - const settings = require('../storage/settings.json'); - commands.forEach(function(x) { - if (!categories.includes(client.commands.get(x).help.category)) { - categories.push(client.commands.get(x).help.category); - } - }); - - let prefixes = JSON.parse(fs.readFileSync("./storage/prefixes.json", "utf8")); - - if(!prefixes[message.guild.id]){ - prefixes[message.guild.id] = { - prefixes: settings.prefix - }; - } - - let prefix = prefixes[message.guild.id].prefixes - if (!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links please enable them to use the full help.'); - const embed = new Discord.RichEmbed() - .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help and on ${client.guilds.size} servers`, client.user.avatarURL) - .setDescription('Every command you input into AleeBot is `' + prefix + '`') - .setColor('#1fd619') - .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0'); - - categories.forEach(function(x) { - let cat = ''; - commands.forEach(function(command) { - if (client.commands.get(command).help.category == x) { - cat = cat + command + '\n'; - } - }); - embed.addField(x, cat, true); - }); - - await message.channel.send({ embed }); -}; - -exports.conf = { - aliases: ['h'], - guildOnly: false, -}; -exports.help = { - name: 'help', - description: 'Displays all the commands or a page with information for 1 command.', - usage: 'help (command:command-name)', - category: '- General Commands', -}; +/** ************************************** + * + * Help: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +const Discord = require('discord.js'); +const fs = require('fs'); +module.exports.run = async (client, message) => { + const categories = []; + const commands = Array.from(client.commands.keys()); + const settings = require('../storage/settings.json'); + commands.forEach(function(x) { + if (!categories.includes(client.commands.get(x).help.category)) { + categories.push(client.commands.get(x).help.category); + } + }); + + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); + + if (!prefixes[message.guild.id]) { + prefixes[message.guild.id] = { + prefixes: settings.prefix, + }; + } + + const prefix = prefixes[message.guild.id].prefixes; + if (!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links please enable them to use the full help.'); + const embed = new Discord.RichEmbed() + .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help and on ${client.guilds.size} servers`, client.user.avatarURL) + .setDescription('Every command you input into AleeBot is `' + prefix + '`') + .setColor('#1fd619') + .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0'); + + categories.forEach(function(x) { + let cat = ''; + commands.forEach(function(command) { + if (client.commands.get(command).help.category == x) { + cat = cat + command + '\n'; + } + }); + embed.addField(x, cat, true); + }); + + await message.channel.send({embed}); +}; + +exports.conf = { + aliases: ['h'], + guildOnly: false, +}; +exports.help = { + name: 'help', + description: 'Displays all the commands or a page with information for 1 command.', + usage: 'help (command:command-name)', + category: '- General Commands', +}; diff --git a/commands/info.js b/commands/info.js index 162a1cf..5487a14 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Info: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,29 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const os = require('os'); - const embed = new Discord.RichEmbed() + const Discord = require('discord.js'); + const os = require('os'); + const embed = new Discord.RichEmbed() .setTitle('Information on AleeBot\'s Host') - .addField('OS Hostname: ', os.hostname() , true) - .addField('NodeJS Version: ', process.versions.node , true) - .addField('OS Platform: ', os.platform() , true) - .addField('OS Version: ', os.release() , true) + .addField('OS Hostname: ', os.hostname(), true) + .addField('NodeJS Version: ', process.versions.node, true) + .addField('OS Platform: ', os.platform(), true) + .addField('OS Version: ', os.release(), true) .setColor('#1fd619'); - message.channel.send({embed}); - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'info', - description: 'Tells you information about the bot', - usage: 'info', - category: '- Information Commands', - }; - \ No newline at end of file + message.channel.send({embed}); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'info', + description: 'Tells you information about the bot', + usage: 'info', + category: '- Information Commands', +}; diff --git a/commands/interrogate.js b/commands/interrogate.js index ea7de53..c015f2c 100644 --- a/commands/interrogate.js +++ b/commands/interrogate.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Interrogate: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,29 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply ('This is a ALP exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); - if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); - if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); + if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); - const member = message.mentions.members.first(); - if (!member) return await message.reply('Uhh... Please mention a member first.'); + const member = message.mentions.members.first(); + if (!member) return await message.reply('Uhh... Please mention a member first.'); - member.addRole(message.guild.roles.find('name', 'Interrogation')); - message.reply(`Alright, I just interrogated ${member.user.tag}.`) + member.addRole(message.guild.roles.find('name', 'Interrogation')); + message.reply(`Alright, I just interrogated ${member.user.tag}.`); }; exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'interrogate', - description: 'Interrogates a member', - usage: 'interrogate [user]', - category: '- ALP Exclusive Commands', - }; - \ No newline at end of file + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'interrogate', + description: 'Interrogates a member', + usage: 'interrogate [user]', + category: '- ALP Exclusive Commands', +}; diff --git a/commands/invite.js b/commands/invite.js index 38094b4..a6ce5a8 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Invite: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,37 +15,37 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const embed = new Discord.RichEmbed() - message.channel.send({embed: { + const Discord = require('discord.js'); + const embed = new Discord.RichEmbed(); + message.channel.send({embed: { color: 2086425, - title: "Invite Command", + title: 'Invite Command', fields: [{ - name: "Invite AleeBot", - value: "[Invite AleeBot to your server.](https://top.gg/bot/282547024547545109)" - }, - { - name: "Join the Alee Productions Community", - value: "[If there's any bugs you can join Alee Community guild and explain the bug...](https://discord.gg/EFhRDqG)" - } + name: 'Invite AleeBot', + value: '[Invite AleeBot to your server.](https://top.gg/bot/282547024547545109)', + }, + { + name: 'Join the Alee Productions Community', + value: '[If there\'s any bugs you can join Alee Community guild and explain the bug...](https://discord.gg/EFhRDqG)', + }, ], - } -}); - - // message.channel.send('Want AleeBot in your server? Here\'s the link: https://discordapp.com/api/oauth2/authorize?client_id=282547024547545109&permissions=2080375863&scope=bot'); - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'invite', - description: 'Gives you an invite to the guild and the bot.', - usage: 'invite', - category: '- General Commands', - }; - + }, + }); + + // message.channel.send('Want AleeBot in your server? Here\'s the link: https://discordapp.com/api/oauth2/authorize?client_id=282547024547545109&permissions=2080375863&scope=bot'); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'invite', + description: 'Gives you an invite to the guild and the bot.', + usage: 'invite', + category: '- General Commands', +}; + diff --git a/commands/jail.js b/commands/jail.js index e1ba85f..199ae20 100644 --- a/commands/jail.js +++ b/commands/jail.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Jail: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,29 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply ('This is a ALP exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); - if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); - if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); + if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); - const member = message.mentions.members.first(); - if (!member) return await message.reply('Uhh... Please mention a member first.'); + const member = message.mentions.members.first(); + if (!member) return await message.reply('Uhh... Please mention a member first.'); - member.addRole(message.guild.roles.find('name', 'Jail')); - message.reply(`Alright, I just jailed ${member.user.tag}.`) + member.addRole(message.guild.roles.find('name', 'Jail')); + message.reply(`Alright, I just jailed ${member.user.tag}.`); }; exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'jail', - description: 'Jails a member', - usage: 'jail [user]', - category: '- ALP Exclusive Commands', - }; - \ No newline at end of file + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'jail', + description: 'Jails a member', + usage: 'jail [user]', + category: '- ALP Exclusive Commands', +}; diff --git a/commands/kick.js b/commands/kick.js index dbb1eb1..bfacd92 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Kick: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,23 +15,23 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - const Discord = require('discord.js'); - const mreason = args.join(" ").slice(22); - if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply("It looks like that you don't have the permissions to ban people."); - if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.'); - const member = message.mentions.members.first(); - if (!member) return message.reply("Uhh... Please mention a member first."); - member.kick(`Kicked by: ${message.author.tag} Reason: ` + mreason); - const embed = new Discord.RichEmbed() - .setTitle('User Kicked!') - .setColor('#1fd619') - .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``) - await message.channel.send({ embed }); - }; + const Discord = require('discord.js'); + const mreason = args.join(' ').slice(22); + if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.'); + if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.'); + const member = message.mentions.members.first(); + if (!member) return message.reply('Uhh... Please mention a member first.'); + member.kick(`Kicked by: ${message.author.tag} Reason: ` + mreason); + const embed = new Discord.RichEmbed() + .setTitle('User Kicked!') + .setColor('#1fd619') + .addField('**User:**', `${member.user.tag}`) + .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embed}); +}; exports.conf = { aliases: [], diff --git a/commands/leaveguild.js b/commands/leaveguild.js index 4a77b0c..fd77509 100644 --- a/commands/leaveguild.js +++ b/commands/leaveguild.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * LeaveGuild: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,22 +15,21 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.'); - message.channel.send('Alright, I\'m leaving the server now. Bye everyone!') - message.guild.leave(); - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'leaveguild', - description: 'Makes the bot leave the server', - usage: 'leaveguild', - category: '- Owners Only', - }; - \ No newline at end of file + if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.'); + message.channel.send('Alright, I\'m leaving the server now. Bye everyone!'); + message.guild.leave(); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'leaveguild', + description: 'Makes the bot leave the server', + usage: 'leaveguild', + category: '- Owners Only', +}; diff --git a/commands/pay.js b/commands/pay.js index 633e4db..2d0aa89 100644 --- a/commands/pay.js +++ b/commands/pay.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Pay: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,46 +15,46 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - const db = require('quick.db'); - if (!message.mentions.members.first()) return message.reply('Please mention a user...'); - - let targetMember = message.mentions.members.first(), - amount = parseInt(args.join(' ').replace(targetMember, '')); - - if (isNaN(amount)) return message.reply('Please define an amount.') - - let targetBalance = await db.fetch(`userBalance_${targetMember.id}`), - selfBalance = await db.fetch(`userBalance_${message.author.id}`); - - if (targetBalance === null) { - db.set(`userBalance_${targetMember.id}`, 0); - targetBalance = 0 - } - - if (selfBalance === null) { - db.set(`userBalance_${message.author.id}`, 0); - selfBalance = 0 - } - - if (amount > selfBalance) return message.reply('Sorry you don\'t have enough money.'); - - db.add(`userBalance_${targetMember.id}`, amount); - db.subtract(`userBalance_${message.author.id}`, amount); - - message.reply(`Successfully transfered $${amount} to ${targetMember.user}`) - }; - - exports.conf = { - aliases: ['transfer'], - guildOnly: false, - }; - exports.help = { - name: 'pay', - description: 'You can pay others!', - usage: 'pay [@user] [interger]', - category: '- Economy Commands', - }; \ No newline at end of file + const db = require('quick.db'); + if (!message.mentions.members.first()) return message.reply('Please mention a user...'); + + const targetMember = message.mentions.members.first(); + const amount = parseInt(args.join(' ').replace(targetMember, '')); + + if (isNaN(amount)) return message.reply('Please define an amount.'); + + let targetBalance = await db.fetch(`userBalance_${targetMember.id}`); + let selfBalance = await db.fetch(`userBalance_${message.author.id}`); + + if (targetBalance === null) { + db.set(`userBalance_${targetMember.id}`, 0); + targetBalance = 0; + } + + if (selfBalance === null) { + db.set(`userBalance_${message.author.id}`, 0); + selfBalance = 0; + } + + if (amount > selfBalance) return message.reply('Sorry you don\'t have enough money.'); + + db.add(`userBalance_${targetMember.id}`, amount); + db.subtract(`userBalance_${message.author.id}`, amount); + + message.reply(`Successfully transfered $${amount} to ${targetMember.user}`); +}; + +exports.conf = { + aliases: ['transfer'], + guildOnly: false, +}; +exports.help = { + name: 'pay', + description: 'You can pay others!', + usage: 'pay [@user] [interger]', + category: '- Economy Commands', +}; diff --git a/commands/ping.js b/commands/ping.js index fa1fd10..afb3807 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,33 +1,33 @@ -/**************************************** - * - * Ping: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -module.exports.run = async (client, message) => { - message.reply('**PONG!** :ping_pong: ' + Math.round(client.ping) + ' ms'); -}; - -exports.conf = { - aliases: [], - guildOnly: false, -}; -exports.help = { - name: 'ping', - description: 'Ping the bot.', - usage: 'ping', - category: '- General Commands', -}; +/** ************************************** + * + * Ping: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +module.exports.run = async (client, message) => { + message.reply('**PONG!** :ping_pong: ' + Math.round(client.ping) + ' ms'); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'ping', + description: 'Ping the bot.', + usage: 'ping', + category: '- General Commands', +}; diff --git a/commands/poweroff.js b/commands/poweroff.js index 3af23b8..3f60f8a 100644 --- a/commands/poweroff.js +++ b/commands/poweroff.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Poweroff: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,29 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { const Discord = require('discord.js'); - if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - const embed = new Discord.RichEmbed() - .setAuthor("AleeBot Status", client.user.avatarURL) - .setDescription("AleeBot is now going offline...") - .setColor("#ff3333") - await client.channels.find('id', '606602551634296968').send({embed}); - await message.reply(':warning: AleeBot will now exit!'); - client.destroy(); - process.exit(0); - }; - - exports.conf = { - aliases: ['reboot'], - guildOnly: false, - }; - exports.help = { - name: 'poweroff', - description: 'Turns off AleeBot.', - usage: 'poweroff', - category: '- Owners Only', - }; - \ No newline at end of file + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const embed = new Discord.RichEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL) + .setDescription('AleeBot is now going offline...') + .setColor('#ff3333'); + await client.channels.find('id', '606602551634296968').send({embed}); + await message.reply(':warning: AleeBot will now exit!'); + client.destroy(); + process.exit(0); +}; + +exports.conf = { + aliases: ['reboot'], + guildOnly: false, +}; +exports.help = { + name: 'poweroff', + description: 'Turns off AleeBot.', + usage: 'poweroff', + category: '- Owners Only', +}; diff --git a/commands/purge.js b/commands/purge.js index 9a510f9..6122083 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Purge: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,26 +15,25 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (!message.member.permissions.has('MANAGE_MESSAGES')) return message.reply("It looks like that you don't have the permissions to delete messages.") - if (isNaN(args[0])) return message.reply("Please put the valid number of messages to purge."); + if (!message.member.permissions.has('MANAGE_MESSAGES')) return message.reply('It looks like that you don\'t have the permissions to delete messages.'); + if (isNaN(args[0])) return message.reply('Please put the valid number of messages to purge.'); + + if (args[0] > 100) return message.channel.send('Please put a number less than 100.'); - if (args[0] > 100) return message.channel.send("Please put a number less than 100."); + message.channel.bulkDelete(args[0]) + .then( (messages) => message.channel.send(`Successfully deleted ${messages.size} messages.`)); +}; - message.channel.bulkDelete(args[0]) - .then( messages => message.channel.send(`Successfully deleted ${messages.size} messages.`)) - }; - - exports.conf = { - aliases: ['rm'], - guildOnly: false, - }; - exports.help = { - name: 'purge', - description: 'Removes messages in a bulk.', - usage: 'purge [number]', - category: '- Moderation Commands', - }; - \ No newline at end of file +exports.conf = { + aliases: ['rm'], + guildOnly: false, +}; +exports.help = { + name: 'purge', + description: 'Removes messages in a bulk.', + usage: 'purge [number]', + category: '- Moderation Commands', +}; diff --git a/commands/quote.js b/commands/quote.js index 9aa9be0..ce7b56a 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Quote: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,16 +15,16 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { -const Discord = require('discord.js'); + const Discord = require('discord.js'); -let NewQuote; + let NewQuote; function GetNewQuote(quoteNum = -1) { NewQuote = new Discord.RichEmbed(); - + let quo = require('../storage/quotes.json').quotes; if (quoteNum == -1) { @@ -47,19 +47,18 @@ let NewQuote; return NewQuote; } - const newquote = GetNewQuote(); - message.reply('Alright, here\'s your quote.') - message.channel.send(newquote); + const newquote = GetNewQuote(); + message.reply('Alright, here\'s your quote.'); + message.channel.send(newquote); }; exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'quote', - description: 'Tells you quotes', - usage: 'quote', - category: '- Quote Commands', - }; - \ No newline at end of file + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'quote', + description: 'Tells you quotes', + usage: 'quote', + category: '- Quote Commands', +}; diff --git a/commands/say.js b/commands/say.js index 4f25aec..774e9e3 100644 --- a/commands/say.js +++ b/commands/say.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Say: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,23 +15,22 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - let absay = args.join(" "); - message.delete().catch(); - message.channel.send(absay); - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'say', - description: 'You can control AleeBot now!', - usage: 'say [context]', - category: '- Owners Only', - }; - \ No newline at end of file + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const absay = args.join(' '); + message.delete().catch(); + message.channel.send(absay); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'say', + description: 'You can control AleeBot now!', + usage: 'say [context]', + category: '- Owners Only', +}; diff --git a/commands/setprefix.js b/commands/setprefix.js index f9aac08..1c53509 100644 --- a/commands/setprefix.js +++ b/commands/setprefix.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * SetPrefix: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,41 +15,38 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { const moment = require('moment'); - const log = message => { - + const log = (message) => { console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`); - }; - const fs = require('fs'); - if(!message.member.hasPermission("ADMINISTRATOR")) return message.reply('Sorry you need admin to set my prefix') - if(!args[0] || args[0 == "help"]) return message.reply(`Usage: setprefix `) + const fs = require('fs'); + if (!message.member.hasPermission('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix'); + if (!args[0] || args[0 == 'help']) return message.reply(`Usage: setprefix `); - let prefixes = JSON.parse(fs.readFileSync("./storage/prefixes.json", "utf8")); + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); - prefixes[message.guild.id] = { - prefixes: args[0] - }; + prefixes[message.guild.id] = { + prefixes: args[0], + }; - fs.writeFile("./storage/prefixes.json", JSON.stringify(prefixes), (err) =>{ - if (err) log(err) - }) + fs.writeFile('./storage/prefixes.json', JSON.stringify(prefixes), (err) =>{ + if (err) log(err); + }); - message.reply(`AleeBot's Prefix in this guild is now \`${args[0]}\``); - log(`[i] The guild ${message.guild.name} has changed AleeBot's prefix to ${args[0]}`) - }; - - exports.conf = { - aliases: [], - guildOnly: true, - }; - exports.help = { - name: 'setprefix', - description: 'Sets the guild prefix.', - usage: 'setprefix [prefix]', - category: '- Settings Commands', - }; - \ No newline at end of file + message.reply(`AleeBot's Prefix in this guild is now \`${args[0]}\``); + log(`[i] The guild ${message.guild.name} has changed AleeBot's prefix to ${args[0]}`); +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; +exports.help = { + name: 'setprefix', + description: 'Sets the guild prefix.', + usage: 'setprefix [prefix]', + category: '- Settings Commands', +}; diff --git a/commands/suggest.js b/commands/suggest.js index 1b2d814..6fb4289 100644 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Suggest: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,32 +15,31 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply ('This is a ALP exclusive command.'); - const { RichEmbed } = require('discord.js'); - client.channels.find('id', '427495678390960148').send( - new RichEmbed() - .setColor ('#1fd619') + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); + const {RichEmbed} = require('discord.js'); + client.channels.find('id', '427495678390960148').send( + new RichEmbed() + .setColor('#1fd619') .setTitle('Suggestion') .setDescription(`This is a suggestion from `+ message.author.username +` please react to it using the following emojis.`) - .addField('Suggestion Contents', args.join(' ')) - ).then(message => { - message.react('\u2705'); - message.react('\u274E'); - }); - message.reply("Your suggestion has been shown in the suggestions channel.") - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'suggest', - description: 'Suggest a feature in ACN.', - usage: 'suggest [suggestion]', - category: '- ALP Exclusive Commands', - }; - \ No newline at end of file + .addField('Suggestion Contents', args.join(' ')), + ).then((message) => { + message.react('\u2705'); + message.react('\u274E'); + }); + message.reply('Your suggestion has been shown in the suggestions channel.'); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'suggest', + description: 'Suggest a feature in ACN.', + usage: 'suggest [suggestion]', + category: '- ALP Exclusive Commands', +}; diff --git a/commands/suggestfeature.js b/commands/suggestfeature.js index 95e1c2d..fac82a6 100644 --- a/commands/suggestfeature.js +++ b/commands/suggestfeature.js @@ -19,6 +19,7 @@ * *************************************/ module.exports.run = async (client, message, args) => { const { RichEmbed } = require('discord.js'); + client.channels.find('id', '427495678390960148').send( new RichEmbed() .setColor ('#1fd619') diff --git a/commands/uptime.js b/commands/uptime.js index 7c8d9fe..8f97d02 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -1,45 +1,43 @@ -/**************************************** - * - * Uptime: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions & OfficialRain - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -module.exports.run = async (client, message) => { - - let uptime = parseInt(client.uptime); - uptime = Math.floor(uptime / 1000); - let uptimeMinutes = Math.floor(uptime / 60); - const minutes = uptime % 60; - let hours = 0; - while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; - } - const uptimeSeconds = minutes % 60; - message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); - -}; - -exports.conf = { - aliases: [], - guildOnly: false, -}; -exports.help = { - name: 'uptime', - description: 'Displays Uptime.', - usage: 'uptime', - category: '- General Commands', -}; +/** ************************************** + * + * Uptime: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions & OfficialRain + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +module.exports.run = async (client, message) => { + let uptime = parseInt(client.uptime); + uptime = Math.floor(uptime / 1000); + let uptimeMinutes = Math.floor(uptime / 60); + const minutes = uptime % 60; + let hours = 0; + while (uptimeMinutes >= 60) { + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + const uptimeSeconds = minutes % 60; + message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'uptime', + description: 'Displays Uptime.', + usage: 'uptime', + category: '- General Commands', +}; diff --git a/commands/userinfo.js b/commands/userinfo.js index 2eebd8b..3b79beb 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * UserInfo: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,30 +15,28 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - var embed = new Discord.RichEmbed() - .setAuthor(message.author.tag, message.author.avatarURL) - .setDescription("User Information") - .setThumbnail(message.author.avatarURL) - .addField("Names", "**Username:** " + message.author.username + "\n**Current Nickname:** " + message.member.displayName) - .addField("Identity", `**User ID:** ${message.author.id} `) - .addField("Create and Join Times", "**Created At:** " + message.member.user.createdAt.toUTCString() + "\n**Joined Guild At:** " + message.member.joinedAt.toUTCString()) - .setColor('#1fd619') - message.channel.send({embed}); + const Discord = require('discord.js'); + const embed = new Discord.RichEmbed() + .setAuthor(message.author.tag, message.author.avatarURL) + .setDescription('User Information') + .setThumbnail(message.author.avatarURL) + .addField('Names', '**Username:** ' + message.author.username + '\n**Current Nickname:** ' + message.member.displayName) + .addField('Identity', `**User ID:** ${message.author.id} `) + .addField('Create and Join Times', '**Created At:** ' + message.member.user.createdAt.toUTCString() + '\n**Joined Guild At:** ' + message.member.joinedAt.toUTCString()) + .setColor('#1fd619'); + message.channel.send({embed}); +}; - }; - - exports.conf = { - aliases: ['uinfo'], - guildOnly: false, - }; - exports.help = { - name: 'userinfo', - description: 'Tells your info.', - usage: 'userinfo', - category: '- Information Commands', - }; - \ No newline at end of file +exports.conf = { + aliases: ['uinfo'], + guildOnly: false, +}; +exports.help = { + name: 'userinfo', + description: 'Tells your info.', + usage: 'userinfo', + category: '- Information Commands', +}; diff --git a/commands/vtquote.js b/commands/vtquote.js index e21db08..7d1ccd0 100644 --- a/commands/vtquote.js +++ b/commands/vtquote.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * VTQuote: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,51 +15,50 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - - let VictorQuote; - - function GetVictorQuote(quoteNum = -1) { - VictorQuote = new Discord.RichEmbed(); - - let quo = require('../storage/vtquotes.json').quotes - - if (quoteNum == -1) { - quoteNum = Math.floor(Math.random() * 1000) % quo.length; - quo=quo[quoteNum]; - } - - const author = quo.author; - const authorImage = quo.authorImage; - const quote = quo.quote; - const year = quo.year; - const url = quo.url; - - VictorQuote.setAuthor(author, authorImage); - VictorQuote.setColor('#1fd619'); - VictorQuote.setDescription(quote); - VictorQuote.setFooter('- ' + year); - VictorQuote.setURL(url); - - return VictorQuote; - } - - const victorquote = GetVictorQuote(); - message.reply('Alright, here\'s your Victor quote.') - message.channel.send(victorquote); - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'vtquote', - description: 'Tells you quotes when victor accidentaly swore.', - usage: 'vtquote', - category: '- Quote Commands', - }; - \ No newline at end of file + const Discord = require('discord.js'); + + let VictorQuote; + + function GetVictorQuote(quoteNum = -1) { + VictorQuote = new Discord.RichEmbed(); + + let quo = require('../storage/vtquotes.json').quotes; + + if (quoteNum == -1) { + quoteNum = Math.floor(Math.random() * 1000) % quo.length; + quo=quo[quoteNum]; + } + + const author = quo.author; + const authorImage = quo.authorImage; + const quote = quo.quote; + const year = quo.year; + const url = quo.url; + + VictorQuote.setAuthor(author, authorImage); + VictorQuote.setColor('#1fd619'); + VictorQuote.setDescription(quote); + VictorQuote.setFooter('- ' + year); + VictorQuote.setURL(url); + + return VictorQuote; + } + + const victorquote = GetVictorQuote(); + message.reply('Alright, here\'s your Victor quote.'); + message.channel.send(victorquote); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'vtquote', + description: 'Tells you quotes when victor accidentaly swore.', + usage: 'vtquote', + category: '- Quote Commands', +}; diff --git a/deprecated/buy.js b/deprecated/buy.js index e5b8fee..8e52f08 100644 --- a/deprecated/buy.js +++ b/deprecated/buy.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Buy: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message, args) => { /* @@ -23,27 +23,27 @@ const Discord = require('discord.js'); const fs = require('fs') const db = require('quick.db'); const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); - - let categories = []; - if (!args.join(" ")) { + let categories = []; + + if (!args.join(" ")) { + + + for (var i in items) { - - for (var i in items) { - if (!categories.includes(items[i].type)) { categories.push(items[i].type) } } - + const embed = new Discord.RichEmbed() .setDescription(`Available Items`) .setColor('#1fd619') - for (var i = 0; i < categories.length; i++) { + for (var i = 0; i < categories.length; i++) { var tempDesc = ''; @@ -60,7 +60,7 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); } - + return message.channel.send({ embed }); @@ -72,15 +72,15 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); let itemPrice = 0; let itemDesc = ''; - for (var i in items) { - if (args.join(" ").trim().toUpperCase() === items[i].name.toUpperCase()) { + for (var i in items) { + if (args.join(" ").trim().toUpperCase() === items[i].name.toUpperCase()) { itemName = items[i].name; itemPrice = items[i].price; itemDesc = items[i].desc; } } - + if (itemName === '') { return message.channel.send(`Item ${args.join(" ").trim()} not found.`) } @@ -90,10 +90,10 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); if (selfBalance === null) { db.set(`userBalance_${message.author.id}`, 0); selfBalance = 0 - } + } if (itemPrice > selfBalance) return message.reply('You don\'t have enough money for this item.') - + db.subtract(`userBalance_${message.author.id}`, itemPrice); if (itemName === 'Programmer Role') { @@ -102,17 +102,16 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); message.channel.send('You bought ' + itemName + '!'); */ - message.reply('Command is broken for now'); + message.reply('Command is broken for now'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'buy', - description: 'Buy things.', - usage: 'buy [item]', - category: '- Economy Commands', + name: 'buy', + description: 'Buy things.', + usage: 'buy [item]', + category: '- Economy Commands', }; - \ No newline at end of file diff --git a/deprecated/daily.js b/deprecated/daily.js index 0d844a2..efb6c2e 100644 --- a/deprecated/daily.js +++ b/deprecated/daily.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Daily: Command for AleeBot * Copyright (C) 2018 AleeCorp * @@ -15,45 +15,42 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ const db = require('quick.db'); - ms = require('parse-ms'); +ms = require('parse-ms'); module.exports.run = async (client, message) => { + const cooldown = 8.64e+7; + const amount = 100; - let cooldown = 8.64e+7, - amount = 100; - - let lastDaily = await db.fetch(`lastDaily_${message.author.id}`); - - if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) { - let timeObj = ms(cooldown - (Date.now() - lastDaily)); + const lastDaily = await db.fetch(`lastDaily_${message.author.id}`); - message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`) - } else { - message.channel.send(`You have successfully collected $${amount} dollars!`); + if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) { + const timeObj = ms(cooldown - (Date.now() - lastDaily)); - let balance = await db.fetch(`userBalance_${message.author.id}`); + message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`); + } else { + message.channel.send(`You have successfully collected $${amount} dollars!`); - if (balance == null) { - db.set(`userBalance_${message.author.id}`, 0); - } + const balance = await db.fetch(`userBalance_${message.author.id}`); - db.set(`lastDaily_${message.author.id}`, Date.now()); - db.add(`userBalance_${message.author.id}`, 100); + if (balance == null) { + db.set(`userBalance_${message.author.id}`, 0); } - }; - - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'daily', - description: 'This gives you money everyday.', - usage: 'daily', - category: '- Economy Commands', - }; - \ No newline at end of file + db.set(`lastDaily_${message.author.id}`, Date.now()); + db.add(`userBalance_${message.author.id}`, 100); + } +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'daily', + description: 'This gives you money everyday.', + usage: 'daily', + category: '- Economy Commands', +}; diff --git a/package.json b/package.json index 9631ca5..c982509 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "discord.js": "^11.3.1", "fs": "0.0.1-security", "git-last-commit": "^0.3.0", + "i18next": "^19.4.4", "moment": "^2.21.0", "node-opus": "^0.3.0", "os": "^0.1.1", -- cgit v1.2.3 From ed456ef581c5acd852a924d9cc274a259b2d8ce5 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 23 Jul 2020 11:41:02 -0400 Subject: Converted to Discord.JS v12, starting database --- To be worked on/leave.js | 22 +- To be worked on/play.js | 136 +++++----- To be worked on/queue.js | 30 +-- To be worked on/skip.js | 40 +-- bot_discord.js | 635 +++++++++++++++++++++++---------------------- commands/addquote.js | 16 +- commands/ask.js | 44 ++-- commands/avatarurl.js | 16 +- commands/balance.js | 50 ---- commands/ban.js | 38 +-- commands/eval.js | 104 ++++---- commands/git.js | 34 +-- commands/help.js | 74 +++--- commands/info.js | 32 +-- commands/interrogate.js | 26 +- commands/invite.js | 44 ++-- commands/jail.js | 26 +- commands/kick.js | 38 +-- commands/leaveguild.js | 18 +- commands/pay.js | 60 ----- commands/ping.js | 14 +- commands/poweroff.js | 38 +-- commands/purge.js | 22 +- commands/quote.js | 60 ++--- commands/reload.js | 55 ++++ commands/say.js | 20 +- commands/setprefix.js | 44 ++-- commands/setup.js | 45 ++++ commands/suggest.js | 38 +-- commands/suggestfeature.js | 40 +-- commands/uptime.js | 34 +-- commands/userinfo.js | 32 +-- commands/vtquote.js | 64 ----- deprecated/balance.js | 50 ++++ deprecated/buy.js | 17 +- deprecated/daily.js | 42 +-- deprecated/pay.js | 60 +++++ package.json | 11 +- storage/items.json | 20 -- 39 files changed, 1104 insertions(+), 1085 deletions(-) delete mode 100644 commands/balance.js delete mode 100644 commands/pay.js create mode 100644 commands/reload.js create mode 100644 commands/setup.js delete mode 100644 commands/vtquote.js create mode 100644 deprecated/balance.js create mode 100644 deprecated/pay.js delete mode 100644 storage/items.json (limited to 'commands') diff --git a/To be worked on/leave.js b/To be worked on/leave.js index 63915c8..da0b4cc 100644 --- a/To be worked on/leave.js +++ b/To be worked on/leave.js @@ -19,24 +19,24 @@ * *************************************/ module.exports.run = async (client, message, args) => { - if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.'); + if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.'); - if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.'); + if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.'); - if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...'); + if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...'); - message.guild.me.voiceChannel.leave(); + message.guild.me.voiceChannel.leave(); - message.channel.send('Leaving channel...'); + message.channel.send('Leaving channel...'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'leave', - description: 'Leaves voice chat.', - usage: 'leave', - category: '- Music Commands', + name: 'leave', + description: 'Leaves voice chat.', + usage: 'leave', + category: '- Music Commands', }; diff --git a/To be worked on/play.js b/To be worked on/play.js index 71112e1..abebc8b 100644 --- a/To be worked on/play.js +++ b/To be worked on/play.js @@ -19,97 +19,97 @@ * *************************************/ module.exports.run = async (client, message, args, ops) => { - const ytdl = require('ytdl-core'); + const ytdl = require('ytdl-core'); - if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...'); + if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...'); - if (!args[0]) return message.reply('Please input a url.'); + if (!args[0]) return message.reply('Please input a url.'); - const vaildate = await ytdl.validateURL(args[0]); + const vaildate = await ytdl.validateURL(args[0]); - if (!vaildate) return message.reply('Please input a **valid** url.'); + if (!vaildate) return message.reply('Please input a **valid** url.'); - const info = await ytdl.getInfo(args[0]); + const info = await ytdl.getInfo(args[0]); - const data = ops.active.get(message.guild.id) || {}; + const data = ops.active.get(message.guild.id) || {}; - if (!data.connection) data.connection = await message.member.voiceChannel.join(); - if (!data.queue) data.queue = []; - data.guildID = message.guild.id; + if (!data.connection) data.connection = await message.member.voiceChannel.join(); + if (!data.queue) data.queue = []; + data.guildID = message.guild.id; - data.queue.push({ - songTitle: info.title, - requester: message.author.tag, - url: args[0], - announceChannel: message.channel.id, - }); - if (!data.dispatcher) play(client, ops, data); - else { - const {RichEmbed} = require('discord.js'); - const embed = new RichEmbed() - .setTitle('This music has been added to the queue!') - .setAuthor(info.title, client.user.avatarURL) - .setColor(0x00afff) - .setTimestamp() - .addField('Title', info.title) - .addField('Requested by:', message.author.tag) - .setFooter('AleeBot Music Player'); + data.queue.push({ + songTitle: info.title, + requester: message.author.tag, + url: args[0], + announceChannel: message.channel.id, + }); + if (!data.dispatcher) play(client, ops, data); + else { + const {MessageEmbed} = require('discord.js'); + const embed = new MessageEmbed() + .setTitle('This music has been added to the queue!') + .setAuthor(info.title, client.user.avatarURL()) + .setColor(0x00afff) + .setTimestamp() + .addField('Title', info.title) + .addField('Requested by:', message.author.tag) + .setFooter('AleeBot Music Player'); - message.channel.send({embed}); - } + message.channel.send({embed}); + } - ops.active.set(message.guild.id, data); + ops.active.set(message.guild.id, data); }; async function play(client, ops, data) { - const ytdl = require('ytdl-core'); - const {RichEmbed} = require('discord.js'); - const embed = new RichEmbed() - .setTitle('Now playing!') - .setAuthor(data.queue[0].songTitle, client.user.avatarURL) - .setColor(0x00afff) - .setTimestamp() - .addField('Title', data.queue[0].songTitle) - .addField('Requested by:', data.queue[0].requester) - // .addField('Link', info.url) - // .addField('Duration', time) - .setFooter('AleeBot Music Player'); - - client.channels.get(data.queue[0].announceChannel).send({embed}); - - data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, {filter: 'audioonly'})); - data.dispatcher.guildID = data.guildID; - - data.dispatcher.once('finish', function() { - finish(client, ops, this); - }); -}; + const ytdl = require('ytdl-core'); + const {MessageEmbed} = require('discord.js'); + const embed = new MessageEmbed() + .setTitle('Now playing!') + .setAuthor(data.queue[0].songTitle, client.user.avatarURL()) + .setColor(0x00afff) + .setTimestamp() + .addField('Title', data.queue[0].songTitle) + .addField('Requested by:', data.queue[0].requester) + // .addField('Link', info.url) + // .addField('Duration', time) + .setFooter('AleeBot Music Player'); + + client.channels.get(data.queue[0].announceChannel).send({embed}); + + data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, {filter: 'audioonly'})); + data.dispatcher.guildID = data.guildID; + + data.dispatcher.once('finish', function() { + finish(client, ops, this); + }); +} function finish(client, ops, dispatcher) { - const fetched = ops.active.get(dispatcher.guildID); + const fetched = ops.active.get(dispatcher.guildID); - fetched.queue.shift(); + fetched.queue.shift(); - if (fetched.queue.length > 0) { - ops.active.set(dispatcher.guildID, fetched); + if (fetched.queue.length > 0) { + ops.active.set(dispatcher.guildID, fetched); - play(client, ops, fetched); - } else { - ops.active.delete(dispatcher.guildID); + play(client, ops, fetched); + } else { + ops.active.delete(dispatcher.guildID); - const vc = client.guild.get(dispatcher.guildID).me.voiceChannel; + const vc = client.guild.get(dispatcher.guildID).me.voiceChannel; - if (vc) vc.leave(); - } + if (vc) vc.leave(); + } } exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'play', - description: 'Plays music.', - usage: 'play [url]', - category: '- Music Commands', + name: 'play', + description: 'Plays music.', + usage: 'play [url]', + category: '- Music Commands', }; diff --git a/To be worked on/queue.js b/To be worked on/queue.js index f5f0ae9..1208ddf 100644 --- a/To be worked on/queue.js +++ b/To be worked on/queue.js @@ -19,29 +19,29 @@ * *************************************/ module.exports.run = async (client, message, args, ops) => { - const fetched = ops.active.get(message.guild.id); + const fetched = ops.active.get(message.guild.id); - if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); + if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); - const queue = fetched.queue; - const nowPlaying = queue[0]; + const queue = fetched.queue; + const nowPlaying = queue[0]; - let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`; + let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`; - for (let i = 1; i < queue.length; i++) { - resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n`; - } + for (let i = 1; i < queue.length; i++) { + resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n`; + } - message.channel.send(resp); + message.channel.send(resp); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'queue', - description: 'Checks what music is in queue.', - usage: 'queue', - category: '- Music Commands', + name: 'queue', + description: 'Checks what music is in queue.', + usage: 'queue', + category: '- Music Commands', }; diff --git a/To be worked on/skip.js b/To be worked on/skip.js index 965b013..371e7e7 100644 --- a/To be worked on/skip.js +++ b/To be worked on/skip.js @@ -19,40 +19,40 @@ * *************************************/ module.exports.run = async (client, message, args, ops) => { - const fetched = ops.active.get(message.guild.id); + const fetched = ops.active.get(message.guild.id); - if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); + if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.'); - if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.'); + if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.'); - const userCount = message.member.voiceChannel.members.size; + const userCount = message.member.voiceChannel.members.size; - const required = Math.ceil(userCount/2); + const required = Math.ceil(userCount/2); - if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = []; + if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = []; - if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); + if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); - fetched.queue[0].voteSkips.push(message.member.id); + fetched.queue[0].voteSkips.push(message.member.id); - ops.active.set(message.guild.id, fetched); + ops.active.set(message.guild.id, fetched); - if (fetched.queue[0].voteSkips.length >= required) { - message.channel.send('Successfully skipped song!'); + if (fetched.queue[0].voteSkips.length >= required) { + message.channel.send('Successfully skipped song!'); - return fetched.dispatcher.emit('finish'); - } + return fetched.dispatcher.emit('finish'); + } - message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); + message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'skip', - description: 'Skips a music.', - usage: 'skip', - category: '- Music Commands', + name: 'skip', + description: 'Skips a music.', + usage: 'skip', + category: '- Music Commands', }; diff --git a/bot_discord.js b/bot_discord.js index 5c437c9..dfaf6fc 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -19,12 +19,13 @@ * *************************************/ const Discord = require('discord.js'); const moment = require('moment'); +const Sequelize = require('sequelize'); const readline = require('readline'); const colors = require('colors'); const DBL = require('dblapi.js'); const i18next = require('i18next'); const client = new Discord.Client({ - disableEveryone: true, + disableEveryone: true, }); const settings = require('./storage/settings.json'); const fs = require('fs'); @@ -32,15 +33,18 @@ const api = require('./tokens.json'); const dbl = new DBL(api.dbltoken, client); const active = new Map(); const ownerID = '242775871059001344'; +var autoRole = true; +var logChannel = '318874545593384970'; +let statusChannelID = '606602551634296968'; const log = (message) => { - console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white); + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white); }; const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - prompt: '> '.gray, + input: process.stdin, + output: process.stdout, + prompt: '> '.gray, }); console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2020 Alee Productions`.gray); @@ -49,376 +53,373 @@ console.log('This is free software, and you are welcome to redistribute it'.gray console.log('under certain conditions; type `show c\' for details.\n'.gray); if (process.argv.indexOf('--debug') == -1) { - console.log('Running AleeBot without --debug command line flag. Debug output disabled.\n'.yellow); + console.log('Running AleeBot without --debug command line flag. Debug output disabled.\n'.yellow); } else { - console.log('[!] Entering debug mode...'.yellow); - client.on('debug', function(info) { - log(info.gray); - }); - client.on('warn', function(info) { - log(info.red); - }); + console.log('[!] Entering debug mode...'.yellow); + client.on('debug', function(info) { + log(info.gray); + }); + client.on('warn', function(info) { + log(info.red); + }); } if (process.argv.indexOf('--beta') == -1) { - client.login(api.abtoken).catch(function() { - console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); - process.exit(0); - }); + client.login(api.abtoken).catch(function() { + console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); + process.exit(0); + }); } else { - client.login(api.abbtoken).catch(function() { - console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); - process.exit(0); - }); + client.login(api.abbtoken).catch(function() { + console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red); + process.exit(0); + }); } client.commands = new Discord.Collection(); client.aliases = new Discord.Collection(); fs.readdir('./commands', (err, files) => { - if (err) console.error(err); - log(`[!] Attempting to load a total of ${files.length} commands into the memory.`.cyan); - files.forEach((file) => { - try { - const command = require(`./commands/${file}`); - log(`[!] Attempting to load the command "${command.help.name}".`.cyan); - client.commands.set(command.help.name, command); - command.conf.aliases.forEach((alias) => { - client.aliases.set(alias, command.help.name); - log(`[!] Attempting to load "${alias}" as an alias for "${command.help.name}"`.cyan); - }); - } catch (err) { - log('[X] An error has occured trying to load a command. Here is the error.'.red); - console.log(err.stack); - } - }); - log('[>] Command Loading complete!'.green); - console.log('\n'); + if (err) console.error(err); + log(`[!] Attempting to load a total of ${files.length} commands into the memory.`.cyan); + files.forEach((file) => { + try { + const command = require(`./commands/${file}`); + log(`[!] Attempting to load the command "${command.help.name}".`.cyan); + client.commands.set(command.help.name, command); + command.conf.aliases.forEach((alias) => { + client.aliases.set(alias, command.help.name); + log(`[!] Attempting to load "${alias}" as an alias for "${command.help.name}"`.cyan); + }); + } catch (err) { + log('[X] An error has occured trying to load a command. Here is the error.'.red); + console.log(err.stack); + } + }); + log('[>] Command Loading complete!'.green); + console.log('\n'); }); rl.on('line', function(cmd) { - const args = cmd.split(' '); - switch (args[0]) { - case 'guilds': - if (client.guilds.size === 0) { - console.log(('[!] No guilds found.'.yellow)); - } else { - console.log('[i] Here\'s the servers that AleeBot is connected to:'); - for ([id, guild] of client.guilds) { - console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`.blue); - } - } - break; - case 'channels': - if (!args[1]) { - console.log('[!] Please insert the guild\'s ID.'.yellow); - } else { - var guild = client.guilds.get(args[1]); - console.log('[i] Here\'s the channels that this guild have:'.blue); - for ([id, channel, guild] of guild && client.channels) { - console.log(` Channel: #${channel.name} - ID: ${channel.id}`.blue); - } - } - break; - case 'leave': - if (!args[1]) { - console.log('[!] Please insert the guild\'s ID.'.yellow); - } else { - var guild = client.guilds.get(args[1]); - guild.leave(); - } - break; - case 'broadcast': - if (!args[1]) { - console.log('[!] Usage: broadcast [guildID] [channelID].'.yellow); - } else { - const broadcast = args.join(' ').slice(48); - var guild = null; - guild = client.guilds.get(args[1]); - var channel = null; - channel = guild.channels.get(args[2]); - if (channel != null) { - channel.send(broadcast); - } - } - break; - case 'uptime': - let uptime = parseInt(client.uptime); - uptime = Math.floor(uptime / 1000); - let uptimeMinutes = Math.floor(uptime / 60); - const minutes = uptime % 60; - let hours = 0; - while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; - } - const uptimeSeconds = minutes % 60; - console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue); - break; - case 'exit': - console.log('[i] AleeBot will now exit!'.blue); - const asyncPowerOff = async () => { - const embed = new Discord.RichEmbed() - .setAuthor('AleeBot Status', client.user.avatarURL) - .setDescription('AleeBot is now going offline...') - .setColor('#ff3333'); - await client.channels.find('id', '606602551634296968').send({embed}); - }; - asyncPowerOff(); - client.destroy(); - process.exit(0); - break; - case 'help': - let msg = (`AleeBot `+ settings.abVersion +` Console Help\n\n`); - msg += (`guilds - Shows all guilds that AleeBot's on.\n`); - msg += (`channels - Shows all the channels that the guilds have.\n`); - msg += (`leave - Leaves a guild.\n`); - msg += (`broadcast - Broadcasts a message to a server.\n`); - msg += (`uptime - Shows the uptime for AleeBot.\n`); - msg += (`help - Shows this command.\n`); - msg += (`exit - Exits AleeBot.\n`); - console.log(msg.cyan); - break; - default: - console.log('Unknown command, type \'help\' to list the commands...'.yellow); - } - rl.prompt(); + const args = cmd.split(' '); + switch (args[0]) { + case 'guilds': + if (client.guilds.size === 0) { + console.log(('[!] No guilds found.'.yellow)); + } else { + console.log('[i] Here\'s the servers that AleeBot is connected to:'); + for ([id, guild] of client.guilds) { + console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`.blue); + } + } + break; + case 'channels': + if (!args[1]) { + console.log('[!] Please insert the guild\'s ID.'.yellow); + } else { + var guild = client.guilds.get(args[1]); + console.log('[i] Here\'s the channels that this guild have:'.blue); + for ([id, channel, guild] of guild && client.channels) { + console.log(` Channel: #${channel.name} - ID: ${channel.id}`.blue); + } + } + break; + case 'leave': + if (!args[1]) { + console.log('[!] Please insert the guild\'s ID.'.yellow); + } else { + var guild = client.guilds.get(args[1]); + guild.leave(); + } + break; + case 'broadcast': + if (!args[1]) { + console.log('[!] Usage: broadcast [guildID] [channelID].'.yellow); + } else { + const broadcast = args.join(' ').slice(48); + var guild = null; + guild = client.guilds.get(args[1]); + var channel = null; + channel = guild.channels.get(args[2]); + if (channel != null) { + channel.send(broadcast); + } + } + break; + case 'uptime': + let uptime = parseInt(client.uptime); + uptime = Math.floor(uptime / 1000); + let uptimeMinutes = Math.floor(uptime / 60); + const minutes = uptime % 60; + let hours = 0; + while (uptimeMinutes >= 60) { + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + const uptimeSeconds = minutes % 60; + console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue); + break; + case 'exit': + console.log('[i] AleeBot will now exit!'.blue); + const asyncPowerOff = async () => { + const readyEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL()) + .setDescription('AleeBot is now going offline...') + .setColor('#ff3333'); + let statusChannel = client.channels.cache.get(statusChannelID); + if (!statusChannel) return console.error('The status channel does not exist! Skipping.'); + await statusChannel.send(readyEmbed); + }; + asyncPowerOff(); + client.destroy(); + process.exit(0); + break; + case 'help': + let msg = ('AleeBot '+ settings.abVersion +' Console Help\n\n'); + msg += ('guilds - Shows all guilds that AleeBot\'s on.\n'); + msg += ('channels - Shows all the channels that the guilds have.\n'); + msg += ('leave - Leaves a guild.\n'); + msg += ('broadcast - Broadcasts a message to a server.\n'); + msg += ('uptime - Shows the uptime for AleeBot.\n'); + msg += ('help - Shows this command.\n'); + msg += ('exit - Exits AleeBot.\n'); + console.log(msg.cyan); + break; + default: + console.log('Unknown command, type \'help\' to list the commands...'.yellow); + } + rl.prompt(); +}); + +const sequelize = new Sequelize('database', 'user', 'password', { + host: 'localhost', + dialect: 'sqlite', + logging: false, + // SQLite only + storage: 'database.sqlite', }); client.on('ready', () => { - log('[>] AleeBot is now ready!'.green); - log(`[i] Logged in as ${client.user.tag}`.green); - log(`[i] Default Prefix: ${settings.prefix}`.green); - log(`[i] Bot ID: ${client.user.id}`.green); - log(`[i] Token: ${api.abtoken}`.green); - log(`[i] Running version ${settings.abVersion} and in ${client.guilds.size} guilds`.green); - - client.setInterval(function() { - const games = [ - 'AleeBot ' + settings.abVersion + ' | ' + settings.prefix + 'help', - 'Annoying Alee', - 'Coding stuff', - 'Drawing shapes', - 'Fighting AstralMod', - ]; - /* + log('[>] AleeBot is now ready!'.green); + log(`[i] Logged in as ${client.user.tag}`.green); + log(`[i] Default Prefix: ${settings.prefix}`.green); + log(`[i] Bot ID: ${client.user.id}`.green); + log(`[i] Token: ${api.abtoken}`.green); + log(`[i] Running version ${settings.abVersion} and in ${client.guilds.cache.size} guilds`.green); + + client.setInterval(function() { + const games = [ + 'AleeBot ' + settings.abVersion + ' | ' + settings.prefix + 'help', + 'Coding stuff', + 'Drawing shapes', + 'Fighting AstralMod', + ]; + /* setInterval(() => { dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); }, 1800000);*/ - client.user.setPresence({ - status: 'online', - afk: false, - game: { - type: 0, - name: games[Math.floor(Math.random() * games.length)], - }, - }); - }, 200000); - client.user.setStatus('online'); - const embed = new Discord.RichEmbed() - .setAuthor('AleeBot Status', client.user.avatarURL) - .setDescription('AleeBot has started') - .setColor('#5cd65c'); - client.channels.find('id', '606602551634296968').send({embed}); - rl.prompt(); + client.user.setPresence({ + status: 'online', + afk: false, + game: { + type: 0, + name: games[Math.floor(Math.random() * games.length)], + }, + }); + }, 200000); + client.user.setStatus('online'); + const readyEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL()) + .setDescription('AleeBot has started') + .addField('Prefix', `\`${settings.prefix}\``, true) + .setColor('#5cd65c'); + let statusChannel = client.channels.cache.get(statusChannelID); + if (!statusChannel) return console.error('The status channel does not exist! Skipping.'); + statusChannel.send(readyEmbed); + client.user.setStatus('online'); + rl.prompt(); }); client.on('guildMemberAdd', (member) => { - if (member.guild.id != '243022206437687296') return 0; - const role = member.guild.roles.find((role) => role.name === 'Member'); - member.addRole(role); - log(`[i] ${member.user.username} joined Alee Productions.`.green); - log(`[i] I gave ${member.user.username} the "Member" role.`.green); + if (autoRole = true) { + if (member.guild.id != '243022206437687296') return 0; + const role = member.guild.roles.cache.get('657426918416580614'); + member.roles.add(role); + log(`[i] ${member.user.username} joined Alee Productions.`.green); + log(`[i] I gave ${member.user.username} the "Member" role.`.green); + } else { + return; + } }); +/* +client.on('guildMemberRemove', (member) =>{ + +}) +*/ client.on('messageUpdate', async (oldMessage, newMessage) => { - if (oldMessage.guild.id != '243022206437687296') return 0; - if (oldMessage.content === newMessage.content) { - return; - } - const logEmbed = new Discord.RichEmbed() - .setAuthor('AleeBot Logging', client.user.avatarURL) - .setDescription(`A message from ${oldMessage.author.username} was edited`) - .addField('Before: ', `\`\`\`${oldMessage.content}\`\`\``) - .addField('After: ', `\`\`\`${newMessage.content}\`\`\``) - .setColor('#ffff1a') - .setTimestamp() - .setFooter(`Author ID: ${oldMessage.author.id}`); - - const editMessage = newMessage.guild.channels.find((ch) => ch.name === 'logs'); - if (!editMessage) return; - - editMessage.send(logEmbed); + if (oldMessage.guild.id != '243022206437687296') return 0; + if (oldMessage.content === newMessage.content) { + return; + } + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL()) + .setDescription(`A message from ${oldMessage.author.username} was edited`) + .addField('Before: ', `\`\`\`${oldMessage.content}\`\`\``) + .addField('After: ', `\`\`\`${newMessage.content}\`\`\``) + .setColor('#ffff1a') + .setTimestamp() + .setFooter(`Author ID: ${oldMessage.author.id}`); + + let editMessage = client.channels.cache.get(logChannel); + if (!editMessage) return; + + editMessage.send(logEmbed); }); client.on('messageDelete', (message) => { - if (message.guild.id != '243022206437687296') return 0; - const logEmbed = new Discord.RichEmbed() - .setAuthor('AleeBot Logging', client.user.avatarURL) - .setDescription(`A message from ${message.author.username} was deleted`) - .addField('Deleted Message: ', `\`\`\`${message.content}\`\`\``) - .setColor('#ff021b') - .setTimestamp() - .setFooter(`Author ID: ${message.author.id}`); - - const deleteMessage = message.guild.channels.find((ch) => ch.name === 'logs'); - if (!deleteMessage) return; - - deleteMessage.send(logEmbed); + if (message.guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL()) + .setDescription(`A message from ${message.author.username} was deleted`) + .addField('Deleted Message: ', `\`\`\`${message.content}\`\`\``) + .setColor('#ff021b') + .setTimestamp() + .setFooter(`Author ID: ${message.author.id}`); + + let deleteMessage = client.channels.cache.get(logChannel); + if (!deleteMessage) return; + + deleteMessage.send(logEmbed); }); client.on('guildBanAdd', (guild, user) => { - if (guild.id != '243022206437687296') return 0; - const logEmbed = new Discord.RichEmbed() - .setAuthor('AleeBot Logging', client.user.avatarURL) - .setDescription(`This user got banned from ${guild.name}`) - .addField(`User:`, `${user.tag}`) - .addField(`User ID:`, `${user.id}`) - .setColor('#ff021b') - .setTimestamp(); - - const banMessage = guild.channels.find((ch) => ch.name === 'logs'); - if (!banMessage) return; - - banMessage.send(logEmbed); + if (guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL()) + .setDescription(`This user got banned from ${guild.name}`) + .addField('User:', `${user.tag}`) + .addField('User ID:', `${user.id}`) + .setColor('#ff021b') + .setTimestamp(); + + let banMessage = client.channels.cache.get(logChannel); + if (!banMessage) return; + + banMessage.send(logEmbed); }); client.on('guildBanRemove', (guild, user) => { - if (guild.id != '243022206437687296') return 0; - const logEmbed = new Discord.RichEmbed() - .setAuthor('AleeBot Logging', client.user.avatarURL) - .setDescription(`This user got unbanned from ${guild.name}`) - .addField(`User:`, `${user.tag}`) - .addField(`User ID:`, `${user.id}`) - .setColor('#ff021b') - .setTimestamp(); - - const banMessage = guild.channels.find((ch) => ch.name === 'logs'); - if (!banMessage) return; - - banMessage.send(logEmbed); + if (guild.id != '243022206437687296') return 0; + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Logging', client.user.avatarURL()) + .setDescription(`This user got unbanned from ${guild.name}`) + .addField('User:', `${user.tag}`) + .addField('User ID:', `${user.id}`) + .setColor('#ff021b') + .setTimestamp(); + + let banMessage = client.channels.cache.get(logChannel); + if (!banMessage) return; + + banMessage.send(logEmbed); }); client.on('guildCreate', (guild) => { - log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); - /* - const logEmbed = new Discord.RichEmbed() - .setAuthor("AleeBot", client.user.avatarURL) - .setDescription(`I got added to this server!`) - .addField(`Server Name:`, `${guild.name}`) - .addField(`Server ID:`, `${guild.id}`) - .setColor("#5cd65c") - - client.channels.find('id', '606602551634296968').send({logEmbed});*/ + log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot', client.user.avatarURL()) + .setDescription('I got added to a server!') + .addField('Server Name:', `${guild.name}`, true) + .addField('Server ID:', `${guild.id}`, true) + .addField('Members', guild.memberCount, true) + .setColor('#5cd65c') + .setFooter(`We now run on ${client.guilds.cache.size} guilds.`); + + let statusChannel = client.channels.cache.get(statusChannelID); + if (!statusChannel) return; + statusChannel.send(logEmbed); }); client.on('guildDelete', (guild) => { - log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`.red); - /* - const logEmbed = new Discord.RichEmbed() - .setAuthor("AleeBot", client.user.avatarURL) - .setDescription(`I got removed from server...`) - .addField(`Server Name:`, `${guild.name}`) - .addField(`Server ID:`, `${guild.id}`) - .setColor("#5cd65c") - - client.channels.find('id', '606602551634296968').send({logEmbed});*/ + log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`.red); + const logEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot', client.user.avatarURL()) + .setDescription('I got removed from a server...') + .addField('Server Name:', `${guild.name}`, true) + .addField('Server ID:', `${guild.id}`, true) + .setColor('#ff021b') + .setFooter(`We now run on ${client.guilds.cache.size} guilds.`); + + let statusChannel = client.channels.cache.get(statusChannelID); + if (!statusChannel) return; + statusChannel.send(logEmbed); }); dbl.on('posted', () => { - log('Server count posted!'.blue); + log('Server count posted!'.blue); }); dbl.on('error', (e) => { - log(`[X | DBL ERROR] ${e}`.red); + log(`[X | DBL ERROR] ${e}`.red); }); client.on('message', (msg) => { - if (msg.author.bot) return; - - if (msg.mentions != null && msg.mentions.users != null) { - if (msg.mentions.users.has('282547024547545109')) { - if (msg.content.toLowerCase().includes('hello') || (msg.content.toLowerCase().includes('hi'))) { - msg.reply(`Hello ${msg.author.username}!`); - } else { - if (msg.content.toLowerCase().includes('shut') && msg.content.toLowerCase().includes('up')) { - switch (Math.floor(Math.random() * 1000) % 3) { - case 0: - msg.reply('Hey, Can you not speak to me in that tone...'); - break; - case 1: - msg.reply('NO! I can talk as much I can!'); - break; - case 2: - msg.reply('Nah I won\'t....'); - break; - } - } else if (msg.content.toLowerCase().includes('how') && msg.content.toLowerCase().includes('are') && msg.content.toLowerCase().includes('you')) { - msg.reply('I\'m doing OK, I suppose...'); - } else if (msg.content.toLowerCase().includes('ok') && msg.content.toLowerCase().includes('google')) { - msg.reply('Erm... I am not google, if you want to use Google here\'s the link: https://www.google.com'); - } else if (msg.content.toLowerCase().includes('f') && msg.content.toLowerCase().includes('off')) { - msg.reply('Do you want a hammer? :hammer:'); - } else if (msg.content.toLowerCase().includes('aleearmy')) { - msg.reply('Oh yeah.. that thing Alee made...'); - } - } - } - }; - - - const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); - - if (!prefixes[msg.guild.id]) { - prefixes[msg.guild.id] = { - prefixes: settings.prefix, - }; - } - - const prefix = prefixes[msg.guild.id].prefixes; - - - if (!msg.content.startsWith(prefix)) return; - const args = msg.content.slice(prefix.length).trim().split(/ +/g); - const command = args.shift(); - let cmd; - - if (client.commands.has(command)) { - cmd = client.commands.get(command); - } else if (client.aliases.has(command)) { - cmd = client.commands.get(client.aliases.get(command)); - } - - if (cmd) { - if (cmd.conf.guildOnly == true) { - if (!msg.channel.guild) { - return msg.channel.createMessage('This command can only be ran in a guild.'); - } - } - try { - const ops = { - ownerID: ownerID, - active: active, - }; - - cmd.run(client, msg, args, ops); - } catch (e) { - console.error(e); - } - } + if (msg.author.bot) return; + + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); + + if (!prefixes[msg.guild.id]) { + prefixes[msg.guild.id] = { + prefixes: settings.prefix, + }; + } + + const prefix = prefixes[msg.guild.id].prefixes; + + + if (!msg.content.startsWith(prefix)) return; + const args = msg.content.slice(prefix.length).trim().split(/ +/g); + const command = args.shift(); + let cmd; + + if (client.commands.has(command)) { + cmd = client.commands.get(command); + } else if (client.aliases.has(command)) { + cmd = client.commands.get(client.aliases.get(command)); + } + + if (cmd) { + if (cmd.conf.guildOnly == true) { + if (!msg.channel.guild) { + return msg.channel.createMessage('This command can only be ran in a guild.'); + } + } + try { + const ops = { + ownerID: ownerID, + active: active, + autoRole: autoRole, + }; + + cmd.run(client, msg, args, ops); + } catch (e) { + console.error(e); + } + } }); process.on('unhandledRejection', function(err, p) { - log('[X | UNCAUGHT PROMISE] ' + err.stack.red); + log('[X | UNCAUGHT PROMISE] ' + err.stack.red); }); client.on('reconnecting', function() { - log('[!] AleeBot has disconnected from Discord and is now attempting to reconnect.'.yellow); + log('[!] AleeBot has disconnected from Discord and is now attempting to reconnect.'.yellow); }); client.on('disconnect', function() { - log('[X] AleeBot has disconnected from Discord and will not attempt to reconnect.'.red); - console.log('At this point, you\'ll need to restart AleeBot.'.red); - process.exit(0); + log('[X] AleeBot has disconnected from Discord and will not attempt to reconnect.'.red); + console.log('At this point, you\'ll need to restart AleeBot.'.red); + process.exit(0); }); diff --git a/commands/addquote.js b/commands/addquote.js index 7782b91..7b7221e 100644 --- a/commands/addquote.js +++ b/commands/addquote.js @@ -18,7 +18,7 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - /* + /* const moment = require('moment'); const log = message => { @@ -44,17 +44,17 @@ module.exports.run = async (client, message, args) => { message.reply(`You just added a new quote!`); log(`[i] A quote has been added to quotes.json...`) */ - message.reply('Command is broken for now'); + message.reply('Command is broken for now'); }; exports.conf = { - aliases: [], - guildOnly: true, + aliases: [], + guildOnly: true, }; exports.help = { - name: 'addquote', - description: 'Sets the guild prefix.', - usage: 'addquote [author] [authorImage] [quote] [year]', - category: '- Quote Commands', + name: 'addquote', + description: 'Sets the guild prefix.', + usage: 'addquote [author] [authorImage] [quote] [year]', + category: '- Quote Commands', }; diff --git a/commands/ask.js b/commands/ask.js index 0bc0761..3b1efd5 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -18,31 +18,31 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - const abaskanswer = [ - 'Yes.', - 'Nope. Just kidding :P', - 'Definitely!', - 'No.', - 'Yep. Just kidding :P', - 'I doubt it.', - 'Maybe?', - 'I don\'t know?', - 'Hmm let me think :thinking:', - ]; - if (args[1]) { - message.channel.sendMessage(abaskanswer[Math.floor(Math.random() * abaskanswer.length)]); - } else { - message.channel.sendMessage('Sorry, I don\'t know what your saying.'); - } + const abaskanswer = [ + 'Yes.', + 'Nope. Just kidding :P', + 'Definitely!', + 'No.', + 'Yep. Just kidding :P', + 'I doubt it.', + 'Maybe?', + 'I don\'t know?', + 'Hmm let me think :thinking:', + ]; + if (args[1]) { + message.channel.send(abaskanswer[Math.floor(Math.random() * abaskanswer.length)]); + } else { + message.channel.send('Sorry, I don\'t know what your saying.'); + } }; exports.conf = { - aliases: ['8ball'], - guildOnly: false, + aliases: ['8ball'], + guildOnly: false, }; exports.help = { - name: 'ask', - description: 'Give AleeBot a question!', - usage: 'ask [args]', - category: '- Fun Commands', + name: 'ask', + description: 'Give AleeBot a question!', + usage: 'ask [args]', + category: '- Fun Commands', }; diff --git a/commands/avatarurl.js b/commands/avatarurl.js index 7f9c256..293a1a4 100644 --- a/commands/avatarurl.js +++ b/commands/avatarurl.js @@ -1,6 +1,6 @@ /** ************************************** * - * AvatarURL: Command for AleeBot + * avatarurl: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * * This program is free software: you can redistribute it and/or modify @@ -18,16 +18,16 @@ * * *************************************/ module.exports.run = async (client, message) => { - message.reply(message.author.avatarURL); + message.reply(message.author.avatarURL()); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'avatarurl', - description: 'Sends you your avatar picture.', - usage: 'avatarurl', - category: '- Fun Commands', + name: 'avatarurl', + description: 'Sends you your avatar picture.', + usage: 'avatarurl', + category: '- Fun Commands', }; diff --git a/commands/balance.js b/commands/balance.js deleted file mode 100644 index 7b340b2..0000000 --- a/commands/balance.js +++ /dev/null @@ -1,50 +0,0 @@ -/** ************************************** - * - * Balance: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -module.exports.run = async (client, message) => { - const db = require('quick.db'); - const {RichEmbed} = require('discord.js'); - - const user = message.mentions.users.first() || message.author; - - let balance = await db.fetch(`userBalance_${user.id}`); - - if (balance === null) { - db.set(`userBalance_${message.author.id}`, 0); - balance = 0; - } - const embed = new RichEmbed() - .setDescription(`**AleeCorp Bank**`) - .addField('Account Holder: ', user.username, true) - .addField('Account Balance: ', balance, true) - .setColor('#1fd619'); - - message.channel.send({embed}); -}; - -exports.conf = { - aliases: ['bal', 'money'], - guildOnly: false, -}; -exports.help = { - name: 'balance', - description: 'Checks the balance of AleeBot', - usage: 'balance [@someone (optional)]', - category: '- Economy Commands', -}; diff --git a/commands/ban.js b/commands/ban.js index 354dcaa..0f2f011 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -18,28 +18,28 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - const Discord = require('discord.js'); - const mreason = args.join(' ').slice(22); - if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.'); - if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) return message.reply('Uhh... I don\'t have permission to ban members.'); - const member = message.mentions.members.first(); - if (!member) return message.reply('Uhh... Please mention a member first.'); - member.ban(`Banned by ${message.author.tag} Reason: ` + mreason); - const embed = new Discord.RichEmbed() - .setTitle('User Banned!') - .setColor('#1fd619') - .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); - await message.channel.send({embed}); + const Discord = require('discord.js'); + const mreason = args.join(' ').slice(22); + if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.'); + if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) return message.reply('Uhh... I don\'t have permission to ban members.'); + const member = message.mentions.members.first(); + if (!member) return message.reply('Uhh... Please mention a member first.'); + member.ban(`Banned by ${message.author.tag} Reason: ` + mreason); + const embed = new Discord.MessageEmbed() + .setTitle('User Banned!') + .setColor('#1fd619') + .addField('**User:**', `${member.user.tag}`) + .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embed}); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'ban', - description: 'Bans a member', - usage: 'ban [user] [reason]', - category: '- Moderation Commands', + name: 'ban', + description: 'Bans a member', + usage: 'ban [user] [reason]', + category: '- Moderation Commands', }; diff --git a/commands/eval.js b/commands/eval.js index 2147376..ef8fc97 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -18,67 +18,67 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - const {RichEmbed} = require('discord.js'); - const code = args.join(' '); + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const {MessageEmbed} = require('discord.js'); + const code = args.join(' '); - let evaled; - let remove; + let evaled; + let remove; - try { - remove = (text) => { - if (typeof(text) === 'string') { - return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); - } else { - return text; - } - }; + try { + remove = (text) => { + if (typeof(text) === 'string') { + return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + } else { + return text; + } + }; - evaled = eval(code); + evaled = eval(code); - if (typeof evaled !== 'string') { - evaled = require('util').inspect(evaled); - } - } catch (err) { - const embed = new RichEmbed() - .setAuthor('Eval Error') - .setDescription('Eval\'s result') - .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) - .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) - .setFooter('Eval', client.user.avatarURL) - .setColor('RED'); - return message.channel.send({embed}); - } + if (typeof evaled !== 'string') { + evaled = require('util').inspect(evaled); + } + } catch (err) { + const embed = new MessageEmbed() + .setAuthor('Eval Error') + .setDescription('Eval\'s result') + .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) + .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) + .setFooter('Eval', client.user.avatarURL()) + .setColor('RED'); + return message.channel.send({embed}); + } - try { - const embed = new RichEmbed() - .setAuthor('Eval Success') - .setDescription('Eval\'s result') - .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) - .addField(':outbox_tray: Output:', `\`\`\`js\n${remove(evaled)}\n\`\`\``) - .setFooter('Eval', client.user.avatarURL) - .setColor('GREEN'); + try { + const embed = new MessageEmbed() + .setAuthor('Eval Success') + .setDescription('Eval\'s result') + .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) + .addField(':outbox_tray: Output:', `\`\`\`js\n${remove(evaled)}\n\`\`\``) + .setFooter('Eval', client.user.avatarURL()) + .setColor('GREEN'); - return message.channel.send({embed}); - } catch (err) { - const embed = new RichEmbed() - .setAuthor('Eval Error') - .setDescription('Eval\'s result') - .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) - .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) - .setFooter('Eval', client.user.avatarURL) - .setColor('RED'); - return message.channel.send({embed}); - } + return message.channel.send({embed}); + } catch (err) { + const embed = new MessageEmbed() + .setAuthor('Eval Error') + .setDescription('Eval\'s result') + .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``) + .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) + .setFooter('Eval', client.user.avatarURL()) + .setColor('RED'); + return message.channel.send({embed}); + } }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'eval', - description: 'Evalulates commands.', - usage: '', - category: '- Owners Only', + name: 'eval', + description: 'Evalulates commands.', + usage: '', + category: '- Owners Only', }; diff --git a/commands/git.js b/commands/git.js index cf754f4..ed98ebf 100644 --- a/commands/git.js +++ b/commands/git.js @@ -18,26 +18,26 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const git = require('git-last-commit'); - git.getLastCommit(function(err, commit) { - const embed = new Discord.RichEmbed() - .setTitle('GitHub Information') - .addField('**Repository:**', 'https://github.com/aleeproductions/AleeBot-JS') - .addField('**Last Commit:**', commit.subject) - .addField('**Commited By:**', commit.author.name) - .setColor('#1fd619'); - message.channel.send({embed}); - }); + const Discord = require('discord.js'); + const git = require('git-last-commit'); + git.getLastCommit(function(err, commit) { + const embed = new Discord.MessageEmbed() + .setTitle('GitHub Information') + .addField('**Repository:**', 'https://github.com/aleeproductions/AleeBot') + .addField('**Last Commit:**', commit.subject) + .addField('**Commited By:**', commit.author.name) + .setColor('#1fd619'); + message.channel.send({embed}); + }); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'git', - description: 'Get the git info.', - usage: 'git', - category: '- General Commands', + name: 'git', + description: 'Get the git info.', + usage: 'git', + category: '- General Commands', }; diff --git a/commands/help.js b/commands/help.js index 9d94c80..36d4630 100644 --- a/commands/help.js +++ b/commands/help.js @@ -20,51 +20,51 @@ const Discord = require('discord.js'); const fs = require('fs'); module.exports.run = async (client, message) => { - const categories = []; - const commands = Array.from(client.commands.keys()); - const settings = require('../storage/settings.json'); - commands.forEach(function(x) { - if (!categories.includes(client.commands.get(x).help.category)) { - categories.push(client.commands.get(x).help.category); - } - }); + const categories = []; + const commands = Array.from(client.commands.keys()); + const settings = require('../storage/settings.json'); + commands.forEach(function(x) { + if (!categories.includes(client.commands.get(x).help.category)) { + categories.push(client.commands.get(x).help.category); + } + }); - const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); - if (!prefixes[message.guild.id]) { - prefixes[message.guild.id] = { - prefixes: settings.prefix, - }; - } + if (!prefixes[message.guild.id]) { + prefixes[message.guild.id] = { + prefixes: settings.prefix, + }; + } - const prefix = prefixes[message.guild.id].prefixes; - if (!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links please enable them to use the full help.'); - const embed = new Discord.RichEmbed() - .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help and on ${client.guilds.size} servers`, client.user.avatarURL) - .setDescription('Every command you input into AleeBot is `' + prefix + '`') - .setColor('#1fd619') - .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0'); + const prefix = prefixes[message.guild.id].prefixes; + if (!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links please enable them to use the full help.'); + const embed = new Discord.MessageEmbed() + .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help and on ${client.guilds.cache.size} servers`, client.user.avatarURL()) + .setDescription('Every command you input into AleeBot is `' + prefix + '`') + .setColor('#1fd619') + .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0'); - categories.forEach(function(x) { - let cat = ''; - commands.forEach(function(command) { - if (client.commands.get(command).help.category == x) { - cat = cat + command + '\n'; - } - }); - embed.addField(x, cat, true); - }); + categories.forEach(function(x) { + let cat = ''; + commands.forEach(function(command) { + if (client.commands.get(command).help.category == x) { + cat = cat + command + '\n'; + } + }); + embed.addField(x, cat, true); + }); - await message.channel.send({embed}); + await message.channel.send({embed}); }; exports.conf = { - aliases: ['h'], - guildOnly: false, + aliases: ['h'], + guildOnly: false, }; exports.help = { - name: 'help', - description: 'Displays all the commands or a page with information for 1 command.', - usage: 'help (command:command-name)', - category: '- General Commands', + name: 'help', + description: 'Displays all the commands or a page with information for 1 command.', + usage: 'help (command:command-name)', + category: '- General Commands', }; diff --git a/commands/info.js b/commands/info.js index 5487a14..3de7ecd 100644 --- a/commands/info.js +++ b/commands/info.js @@ -18,25 +18,25 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const os = require('os'); - const embed = new Discord.RichEmbed() - .setTitle('Information on AleeBot\'s Host') - .addField('OS Hostname: ', os.hostname(), true) - .addField('NodeJS Version: ', process.versions.node, true) - .addField('OS Platform: ', os.platform(), true) - .addField('OS Version: ', os.release(), true) - .setColor('#1fd619'); - message.channel.send({embed}); + const Discord = require('discord.js'); + const os = require('os'); + const embed = new Discord.MessageEmbed() + .setTitle('Information on AleeBot\'s Host') + .addField('OS Hostname: ', os.hostname(), true) + .addField('NodeJS Version: ', process.versions.node, true) + .addField('OS Platform: ', os.platform(), true) + .addField('OS Version: ', os.release(), true) + .setColor('#1fd619'); + message.channel.send({embed}); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'info', - description: 'Tells you information about the bot', - usage: 'info', - category: '- Information Commands', + name: 'info', + description: 'Tells you information about the bot', + usage: 'info', + category: '- Information Commands', }; diff --git a/commands/interrogate.js b/commands/interrogate.js index c015f2c..54e8cb2 100644 --- a/commands/interrogate.js +++ b/commands/interrogate.js @@ -18,25 +18,25 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); - if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); - if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); + if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); - const member = message.mentions.members.first(); - if (!member) return await message.reply('Uhh... Please mention a member first.'); + const member = message.mentions.members.first(); + if (!member) return await message.reply('Uhh... Please mention a member first.'); - member.addRole(message.guild.roles.find('name', 'Interrogation')); - message.reply(`Alright, I just interrogated ${member.user.tag}.`); + member.roles.add(message.guild.roles.cache.get('431973193608200193')); + message.reply(`Alright, I just interrogated ${member.user.tag}.`); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'interrogate', - description: 'Interrogates a member', - usage: 'interrogate [user]', - category: '- ALP Exclusive Commands', + name: 'interrogate', + description: 'Interrogates a member', + usage: 'interrogate [user]', + category: '- ALP Exclusive Commands', }; diff --git a/commands/invite.js b/commands/invite.js index a6ce5a8..e6f538f 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -18,34 +18,32 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const embed = new Discord.RichEmbed(); - message.channel.send({embed: { - color: 2086425, - title: 'Invite Command', - fields: [{ - name: 'Invite AleeBot', - value: '[Invite AleeBot to your server.](https://top.gg/bot/282547024547545109)', - }, - { - name: 'Join the Alee Productions Community', - value: '[If there\'s any bugs you can join Alee Community guild and explain the bug...](https://discord.gg/EFhRDqG)', - }, - ], - }, - }); + message.channel.send({embed: { + color: 2086425, + title: 'Invite Command', + fields: [{ + name: 'Invite AleeBot', + value: '[Invite AleeBot to your server.](https://top.gg/bot/282547024547545109)', + }, + { + name: 'Join the Alee Productions Community', + value: '[Discord Server](https://discord.gg/EFhRDqG)', + }, + ], + }, + }); - // message.channel.send('Want AleeBot in your server? Here\'s the link: https://discordapp.com/api/oauth2/authorize?client_id=282547024547545109&permissions=2080375863&scope=bot'); + // message.channel.send('Want AleeBot in your server? Here\'s the link: https://discordapp.com/api/oauth2/authorize?client_id=282547024547545109&permissions=2080375863&scope=bot'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'invite', - description: 'Gives you an invite to the guild and the bot.', - usage: 'invite', - category: '- General Commands', + name: 'invite', + description: 'Gives you an invite to the guild and the bot.', + usage: 'invite', + category: '- General Commands', }; diff --git a/commands/jail.js b/commands/jail.js index 199ae20..432f60a 100644 --- a/commands/jail.js +++ b/commands/jail.js @@ -18,25 +18,25 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); - if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); - if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); + if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); - const member = message.mentions.members.first(); - if (!member) return await message.reply('Uhh... Please mention a member first.'); + const member = message.mentions.members.first(); + if (!member) return await message.reply('Uhh... Please mention a member first.'); - member.addRole(message.guild.roles.find('name', 'Jail')); - message.reply(`Alright, I just jailed ${member.user.tag}.`); + member.roles.add(message.guild.roles.cache.get('428205205155217418')); + message.reply(`Alright, I just jailed ${member.user.tag}.`); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'jail', - description: 'Jails a member', - usage: 'jail [user]', - category: '- ALP Exclusive Commands', + name: 'jail', + description: 'Jails a member', + usage: 'jail [user]', + category: '- ALP Exclusive Commands', }; diff --git a/commands/kick.js b/commands/kick.js index bfacd92..3cbaaf8 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -18,28 +18,28 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - const Discord = require('discord.js'); - const mreason = args.join(' ').slice(22); - if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.'); - if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.'); - const member = message.mentions.members.first(); - if (!member) return message.reply('Uhh... Please mention a member first.'); - member.kick(`Kicked by: ${message.author.tag} Reason: ` + mreason); - const embed = new Discord.RichEmbed() - .setTitle('User Kicked!') - .setColor('#1fd619') - .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); - await message.channel.send({embed}); + const Discord = require('discord.js'); + const mreason = args.join(' ').slice(22); + if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to kick people.'); + if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.'); + const member = message.mentions.members.first(); + if (!member) return message.reply('Uhh... Please mention a member first.'); + member.kick(`Kicked by: ${message.author.tag} Reason: ` + mreason); + const embed = new Discord.MessageEmbed() + .setTitle('User Kicked!') + .setColor('#1fd619') + .addField('**User:**', `${member.user.tag}`) + .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embed}); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'kick', - description: 'Kicks a member', - usage: 'kick [user]', - category: '- Moderation Commands', + name: 'kick', + description: 'Kicks a member', + usage: 'kick [user]', + category: '- Moderation Commands', }; diff --git a/commands/leaveguild.js b/commands/leaveguild.js index fd77509..5108436 100644 --- a/commands/leaveguild.js +++ b/commands/leaveguild.js @@ -18,18 +18,18 @@ * * *************************************/ module.exports.run = async (client, message) => { - if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.'); - message.channel.send('Alright, I\'m leaving the server now. Bye everyone!'); - message.guild.leave(); + if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.'); + message.channel.send('Alright, I\'m leaving the server now. Bye everyone!'); + message.guild.leave(); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'leaveguild', - description: 'Makes the bot leave the server', - usage: 'leaveguild', - category: '- Owners Only', + name: 'leaveguild', + description: 'Makes the bot leave the server', + usage: 'leaveguild', + category: '- Owners Only', }; diff --git a/commands/pay.js b/commands/pay.js deleted file mode 100644 index 2d0aa89..0000000 --- a/commands/pay.js +++ /dev/null @@ -1,60 +0,0 @@ -/** ************************************** - * - * Pay: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ - -module.exports.run = async (client, message, args) => { - const db = require('quick.db'); - if (!message.mentions.members.first()) return message.reply('Please mention a user...'); - - const targetMember = message.mentions.members.first(); - const amount = parseInt(args.join(' ').replace(targetMember, '')); - - if (isNaN(amount)) return message.reply('Please define an amount.'); - - let targetBalance = await db.fetch(`userBalance_${targetMember.id}`); - let selfBalance = await db.fetch(`userBalance_${message.author.id}`); - - if (targetBalance === null) { - db.set(`userBalance_${targetMember.id}`, 0); - targetBalance = 0; - } - - if (selfBalance === null) { - db.set(`userBalance_${message.author.id}`, 0); - selfBalance = 0; - } - - if (amount > selfBalance) return message.reply('Sorry you don\'t have enough money.'); - - db.add(`userBalance_${targetMember.id}`, amount); - db.subtract(`userBalance_${message.author.id}`, amount); - - message.reply(`Successfully transfered $${amount} to ${targetMember.user}`); -}; - -exports.conf = { - aliases: ['transfer'], - guildOnly: false, -}; -exports.help = { - name: 'pay', - description: 'You can pay others!', - usage: 'pay [@user] [interger]', - category: '- Economy Commands', -}; diff --git a/commands/ping.js b/commands/ping.js index afb3807..b8d2779 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -18,16 +18,16 @@ * * *************************************/ module.exports.run = async (client, message) => { - message.reply('**PONG!** :ping_pong: ' + Math.round(client.ping) + ' ms'); + message.reply('**PONG!** :ping_pong: ' + Math.round(client.ws.ping) + ' ms'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'ping', - description: 'Ping the bot.', - usage: 'ping', - category: '- General Commands', + name: 'ping', + description: 'Ping the bot.', + usage: 'ping', + category: '- General Commands', }; diff --git a/commands/poweroff.js b/commands/poweroff.js index 3f60f8a..8067c5f 100644 --- a/commands/poweroff.js +++ b/commands/poweroff.js @@ -17,26 +17,30 @@ * along with this program. If not, see . * * *************************************/ -module.exports.run = async (client, message, args) => { - const Discord = require('discord.js'); - if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - const embed = new Discord.RichEmbed() - .setAuthor('AleeBot Status', client.user.avatarURL) - .setDescription('AleeBot is now going offline...') - .setColor('#ff3333'); - await client.channels.find('id', '606602551634296968').send({embed}); - await message.reply(':warning: AleeBot will now exit!'); - client.destroy(); - process.exit(0); +module.exports.run = async (client, message) => { + const Discord = require('discord.js'); + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const stopEmbed = new Discord.MessageEmbed() + .setAuthor('AleeBot Status', client.user.avatarURL()) + .setDescription('AleeBot is now going offline...') + .setColor('#ff3333'); + + let statusChannel = client.channels.cache.get('606602551634296968'); + if (!statusChannel) return console.error('The status channel does not exist! Skipping.'); + await statusChannel.send(stopEmbed); + await message.reply(':warning: AleeBot will now exit!'); + console.log('[i] AleeBot will now exit!'.blue); + client.destroy(); + process.exit(0); }; exports.conf = { - aliases: ['reboot'], - guildOnly: false, + aliases: ['reboot'], + guildOnly: false, }; exports.help = { - name: 'poweroff', - description: 'Turns off AleeBot.', - usage: 'poweroff', - category: '- Owners Only', + name: 'poweroff', + description: 'Turns off AleeBot.', + usage: 'poweroff', + category: '- Owners Only', }; diff --git a/commands/purge.js b/commands/purge.js index 6122083..97c1be6 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -18,22 +18,22 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (!message.member.permissions.has('MANAGE_MESSAGES')) return message.reply('It looks like that you don\'t have the permissions to delete messages.'); - if (isNaN(args[0])) return message.reply('Please put the valid number of messages to purge.'); + if (!message.member.permissions.has('MANAGE_MESSAGES')) return message.reply('It looks like that you don\'t have the permissions to delete messages.'); + if (isNaN(args[0])) return message.reply('Please put the valid number of messages to purge.'); - if (args[0] > 100) return message.channel.send('Please put a number less than 100.'); + if (args[0] > 100) return message.channel.send('Please put a number less than 100.'); - message.channel.bulkDelete(args[0]) - .then( (messages) => message.channel.send(`Successfully deleted ${messages.size} messages.`)); + message.channel.bulkDelete(args[0]) + .then( (messages) => message.channel.send(`Successfully deleted ${messages.size} messages.`)); }; exports.conf = { - aliases: ['rm'], - guildOnly: false, + aliases: ['rm'], + guildOnly: false, }; exports.help = { - name: 'purge', - description: 'Removes messages in a bulk.', - usage: 'purge [number]', - category: '- Moderation Commands', + name: 'purge', + description: 'Removes messages in a bulk.', + usage: 'purge [number]', + category: '- Moderation Commands', }; diff --git a/commands/quote.js b/commands/quote.js index ce7b56a..149fe37 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -18,47 +18,47 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); + const Discord = require('discord.js'); - let NewQuote; + let NewQuote; - function GetNewQuote(quoteNum = -1) { - NewQuote = new Discord.RichEmbed(); + function GetNewQuote(quoteNum = -1) { + NewQuote = new Discord.MessageEmbed(); - let quo = require('../storage/quotes.json').quotes; + let quo = require('../storage/quotes.json').quotes; - if (quoteNum == -1) { - quoteNum = Math.floor(Math.random() * 1000) % quo.length; - quo=quo[quoteNum]; - } + if (quoteNum == -1) { + quoteNum = Math.floor(Math.random() * 1000) % quo.length; + quo=quo[quoteNum]; + } - const author = quo.author; - const authorImage = quo.authorImage; - const quote = quo.quote; - const year = quo.year; - const url = quo.url; + const author = quo.author; + const authorImage = quo.authorImage; + const quote = quo.quote; + const year = quo.year; + const url = quo.url; - NewQuote.setAuthor(author, authorImage); - NewQuote.setColor('#1fd619'); - NewQuote.setDescription(quote); - NewQuote.setFooter('- ' + year); - NewQuote.setURL(url); + NewQuote.setAuthor(author, authorImage); + NewQuote.setColor('#1fd619'); + NewQuote.setDescription(quote); + NewQuote.setFooter('- ' + year); + NewQuote.setURL(url); - return NewQuote; - } + return NewQuote; + } - const newquote = GetNewQuote(); - message.reply('Alright, here\'s your quote.'); - message.channel.send(newquote); + const newquote = GetNewQuote(); + message.reply('Alright, here\'s your quote.'); + message.channel.send(newquote); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'quote', - description: 'Tells you quotes', - usage: 'quote', - category: '- Quote Commands', + name: 'quote', + description: 'Tells you quotes', + usage: 'quote', + category: '- Quote Commands', }; diff --git a/commands/reload.js b/commands/reload.js new file mode 100644 index 0000000..118aae4 --- /dev/null +++ b/commands/reload.js @@ -0,0 +1,55 @@ +/** ************************************** + * + * Invite: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +// eslint-disable-next-line no-unused-vars +module.exports.run = async (client, message, args) => { + /* + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + if (!args.length) return message.channel.send(`You didn't pass any command to reload, ${message.author}!`); + const commandName = args[0].toLowerCase(); + const command = message.client.commands.get(commandName) + || message.client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); + + if (!command) return message.channel.send(`There is no command with name or alias \`${commandName}\`, ${message.author}!`); + delete require.cache[require.resolve(`./${command.name}.js`)]; + try { + const newCommand = require(`./${command.name}.js`); + message.client.commands.set(newCommand.name, newCommand); + } catch (error) { + console.log(error); + message.channel.send(`There was an error while reloading a command \`${command.name}\`:\n\`${error.message}\``); + } + message.channel.send(`Command \`${command.name}\` was reloaded!`);*/ + + message.reply('Coming soon.'); + +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'reload', + description: 'Reloads command.', + usage: 'reload [command]', + category: '- Owners Only', +}; + + \ No newline at end of file diff --git a/commands/say.js b/commands/say.js index 774e9e3..fe17b42 100644 --- a/commands/say.js +++ b/commands/say.js @@ -18,19 +18,19 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); - const absay = args.join(' '); - message.delete().catch(); - message.channel.send(absay); + if (!['242775871059001344'].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.'); + const absay = args.join(' '); + message.delete().catch(); + message.channel.send(absay); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'say', - description: 'You can control AleeBot now!', - usage: 'say [context]', - category: '- Owners Only', + name: 'say', + description: 'You can control AleeBot now!', + usage: 'say [context]', + category: '- Owners Only', }; diff --git a/commands/setprefix.js b/commands/setprefix.js index 1c53509..edb42c9 100644 --- a/commands/setprefix.js +++ b/commands/setprefix.js @@ -18,35 +18,35 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - const moment = require('moment'); - const log = (message) => { - console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`); - }; - const fs = require('fs'); - if (!message.member.hasPermission('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix'); - if (!args[0] || args[0 == 'help']) return message.reply(`Usage: setprefix `); + const moment = require('moment'); + const log = (message) => { + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`); + }; + const fs = require('fs'); + if (!message.member.hasPermission('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix'); + if (!args[0] || args[0 == 'help']) return message.reply('Usage: setprefix '); - const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); - prefixes[message.guild.id] = { - prefixes: args[0], - }; + prefixes[message.guild.id] = { + prefixes: args[0], + }; - fs.writeFile('./storage/prefixes.json', JSON.stringify(prefixes), (err) =>{ - if (err) log(err); - }); + fs.writeFile('./storage/prefixes.json', JSON.stringify(prefixes), (err) =>{ + if (err) log(err); + }); - message.reply(`AleeBot's Prefix in this guild is now \`${args[0]}\``); - log(`[i] The guild ${message.guild.name} has changed AleeBot's prefix to ${args[0]}`); + message.reply(`AleeBot's Prefix in this guild is now \`${args[0]}\``); + log(`[i] The guild ${message.guild.name} has changed AleeBot's prefix to ${args[0]}`); }; exports.conf = { - aliases: [], - guildOnly: true, + aliases: [], + guildOnly: true, }; exports.help = { - name: 'setprefix', - description: 'Sets the guild prefix.', - usage: 'setprefix [prefix]', - category: '- Settings Commands', + name: 'setprefix', + description: 'Sets the guild prefix.', + usage: 'setprefix [prefix]', + category: '- Settings Commands', }; diff --git a/commands/setup.js b/commands/setup.js new file mode 100644 index 0000000..c45fbae --- /dev/null +++ b/commands/setup.js @@ -0,0 +1,45 @@ +/**************************************** + * + * Setup: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ + +module.exports.run = async (client, message) => { + if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply(':warning: You must be a server owner or be the creator of the bot to access this command.'); + message.reply('Look at your DMs.'); + //message.reply("This feature is coming soon. Stay tuned!"); + const Discord = require('discord.js'); + const setupEmbed = new Discord.MessageEmbed() + .setTitle('AleeBot Setup', client.user.avatarURL()) + .setDescription('Select the options') + .addField('Chat Logs', 'placeholder', true) + .addField('Chat Logs', 'placeholder', true) + .addField('Chat Logs', 'placeholder', true); + + message.author.send(setupEmbed); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'setup', + description: 'Setting up AleeBot.', + usage: 'setup', + category: '- Settings Commands', +}; \ No newline at end of file diff --git a/commands/suggest.js b/commands/suggest.js index 6fb4289..3adaa31 100644 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -18,28 +18,28 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); - const {RichEmbed} = require('discord.js'); - client.channels.find('id', '427495678390960148').send( - new RichEmbed() - .setColor('#1fd619') - .setTitle('Suggestion') - .setDescription(`This is a suggestion from `+ message.author.username +` please react to it using the following emojis.`) - .addField('Suggestion Contents', args.join(' ')), - ).then((message) => { - message.react('\u2705'); - message.react('\u274E'); - }); - message.reply('Your suggestion has been shown in the suggestions channel.'); + if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); + const {MessageEmbed} = require('discord.js'); + client.channels.cache.get('427495678390960148').send( + new MessageEmbed() + .setColor('#1fd619') + .setTitle('Suggestion') + .setDescription('This is a suggestion from '+ message.author.username +' please react to it using the following emojis.') + .addField('Suggestion Contents', args.join(' ')), + ).then((message) => { + message.react('\u2705'); + message.react('\u274E'); + }); + message.reply('Your suggestion has been shown in the suggestions channel.'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'suggest', - description: 'Suggest a feature in ACN.', - usage: 'suggest [suggestion]', - category: '- ALP Exclusive Commands', + name: 'suggest', + description: 'Suggest a feature in ALP.', + usage: 'suggest [suggestion]', + category: '- ALP Exclusive Commands', }; diff --git a/commands/suggestfeature.js b/commands/suggestfeature.js index fac82a6..8b8b3c7 100644 --- a/commands/suggestfeature.js +++ b/commands/suggestfeature.js @@ -18,27 +18,27 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - const { RichEmbed } = require('discord.js'); + const { MessageEmbed } = require('discord.js'); - client.channels.find('id', '427495678390960148').send( - new RichEmbed() - .setColor ('#1fd619') - .setTitle('AleeBot Feature Suggestion') - .setDescription(`This is an AleeBot feature suggestion from `+ message.author.username +` sending from ${message.guild.name}.`) - .addField('Suggestion Contents', args.join(' ')) - ) - await message.reply("Your suggestion has been shown to the ALP discord server!") + client.channels.cache.get('427495678390960148').send( + new MessageEmbed() + .setColor ('#1fd619') + .setTitle('AleeBot Feature Suggestion') + .setDescription('This is an AleeBot feature suggestion from '+ message.author.username +` sending from ${message.guild.name}.`) + .addField('Suggestion Contents', args.join(' ')) + ); + await message.reply('Your suggestion has been shown to the ALP discord server!'); - }; +}; - exports.conf = { - aliases: [], - guildOnly: false, - }; - exports.help = { - name: 'suggestfeature', - description: 'Suggest features in AleeBot.', - usage: 'suggestfeature [suggestion]', - category: '- General Commands', - }; +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'suggestfeature', + description: 'Suggest features in AleeBot.', + usage: 'suggestfeature [suggestion]', + category: '- General Commands', +}; diff --git a/commands/uptime.js b/commands/uptime.js index 8f97d02..90afc81 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -18,26 +18,26 @@ * * *************************************/ module.exports.run = async (client, message) => { - let uptime = parseInt(client.uptime); - uptime = Math.floor(uptime / 1000); - let uptimeMinutes = Math.floor(uptime / 60); - const minutes = uptime % 60; - let hours = 0; - while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; - } - const uptimeSeconds = minutes % 60; - message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); + let uptime = parseInt(client.uptime); + uptime = Math.floor(uptime / 1000); + let uptimeMinutes = Math.floor(uptime / 60); + const minutes = uptime % 60; + let hours = 0; + while (uptimeMinutes >= 60) { + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + const uptimeSeconds = minutes % 60; + message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'uptime', - description: 'Displays Uptime.', - usage: 'uptime', - category: '- General Commands', + name: 'uptime', + description: 'Displays Uptime.', + usage: 'uptime', + category: '- General Commands', }; diff --git a/commands/userinfo.js b/commands/userinfo.js index 3b79beb..c03dfed 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -18,25 +18,25 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const embed = new Discord.RichEmbed() - .setAuthor(message.author.tag, message.author.avatarURL) - .setDescription('User Information') - .setThumbnail(message.author.avatarURL) - .addField('Names', '**Username:** ' + message.author.username + '\n**Current Nickname:** ' + message.member.displayName) - .addField('Identity', `**User ID:** ${message.author.id} `) - .addField('Create and Join Times', '**Created At:** ' + message.member.user.createdAt.toUTCString() + '\n**Joined Guild At:** ' + message.member.joinedAt.toUTCString()) - .setColor('#1fd619'); - message.channel.send({embed}); + const Discord = require('discord.js'); + const embed = new Discord.MessageEmbed() + .setAuthor(message.author.tag, message.author.avatarURL()) + .setDescription('User Information') + .setThumbnail(message.author.avatarURL()) + .addField('Names', '**Username:** ' + message.author.username + '\n**Current Nickname:** ' + message.member.displayName) + .addField('Identity', `**User ID:** ${message.author.id} `) + .addField('Create and Join Times', '**Created At:** ' + message.member.user.createdAt.toUTCString() + '\n**Joined Guild At:** ' + message.member.joinedAt.toUTCString()) + .setColor('#1fd619'); + message.channel.send({embed}); }; exports.conf = { - aliases: ['uinfo'], - guildOnly: false, + aliases: ['uinfo'], + guildOnly: false, }; exports.help = { - name: 'userinfo', - description: 'Tells your info.', - usage: 'userinfo', - category: '- Information Commands', + name: 'userinfo', + description: 'Tells your info.', + usage: 'userinfo', + category: '- Information Commands', }; diff --git a/commands/vtquote.js b/commands/vtquote.js deleted file mode 100644 index 7d1ccd0..0000000 --- a/commands/vtquote.js +++ /dev/null @@ -1,64 +0,0 @@ -/** ************************************** - * - * VTQuote: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * *************************************/ -module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - - let VictorQuote; - - function GetVictorQuote(quoteNum = -1) { - VictorQuote = new Discord.RichEmbed(); - - let quo = require('../storage/vtquotes.json').quotes; - - if (quoteNum == -1) { - quoteNum = Math.floor(Math.random() * 1000) % quo.length; - quo=quo[quoteNum]; - } - - const author = quo.author; - const authorImage = quo.authorImage; - const quote = quo.quote; - const year = quo.year; - const url = quo.url; - - VictorQuote.setAuthor(author, authorImage); - VictorQuote.setColor('#1fd619'); - VictorQuote.setDescription(quote); - VictorQuote.setFooter('- ' + year); - VictorQuote.setURL(url); - - return VictorQuote; - } - - const victorquote = GetVictorQuote(); - message.reply('Alright, here\'s your Victor quote.'); - message.channel.send(victorquote); -}; - -exports.conf = { - aliases: [], - guildOnly: false, -}; -exports.help = { - name: 'vtquote', - description: 'Tells you quotes when victor accidentaly swore.', - usage: 'vtquote', - category: '- Quote Commands', -}; diff --git a/deprecated/balance.js b/deprecated/balance.js new file mode 100644 index 0000000..ca32081 --- /dev/null +++ b/deprecated/balance.js @@ -0,0 +1,50 @@ +/** ************************************** + * + * Balance: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +module.exports.run = async (client, message) => { + const db = require('quick.db'); + const {MessageEmbed} = require('discord.js'); + + const user = message.mentions.users.first() || message.author; + + let balance = await db.fetch(`userBalance_${user.id}`); + + if (balance === null) { + db.set(`userBalance_${message.author.id}`, 0); + balance = 0; + } + const embed = new MessageEmbed() + .setDescription('**AleeCorp Bank**') + .addField('Account Holder: ', user.username, true) + .addField('Account Balance: ', balance, true) + .setColor('#1fd619'); + + message.channel.send({embed}); +}; + +exports.conf = { + aliases: ['bal', 'money'], + guildOnly: false, +}; +exports.help = { + name: 'balance', + description: 'Checks the balance of AleeBot', + usage: 'balance [@someone (optional)]', + category: '- Economy Commands', +}; diff --git a/deprecated/buy.js b/deprecated/buy.js index 9757d51..25f2589 100644 --- a/deprecated/buy.js +++ b/deprecated/buy.js @@ -18,7 +18,6 @@ * * *************************************/ module.exports.run = async (client, message, args) => { -/* const Discord = require('discord.js'); const fs = require('fs') const db = require('quick.db'); @@ -39,7 +38,7 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); } - const embed = new Discord.RichEmbed() + const embed = new Discord.MessageEmbed() .setDescription(`Available Items`) .setColor('#1fd619') @@ -101,17 +100,15 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8')); } message.channel.send('You bought ' + itemName + '!'); - */ - message.reply('Command is broken for now'); }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'buy', - description: 'Buy things.', - usage: 'buy [item]', - category: '- Economy Commands', + name: 'buy', + description: 'Buy things.', + usage: 'buy [item]', + category: '- Economy Commands', }; diff --git a/deprecated/daily.js b/deprecated/daily.js index c58928c..c0f04f9 100644 --- a/deprecated/daily.js +++ b/deprecated/daily.js @@ -21,36 +21,36 @@ const db = require('quick.db'); ms = require('parse-ms'); module.exports.run = async (client, message) => { - const cooldown = 8.64e+7; - const amount = 100; + const cooldown = 8.64e+7; + const amount = 100; - const lastDaily = await db.fetch(`lastDaily_${message.author.id}`); + const lastDaily = await db.fetch(`lastDaily_${message.author.id}`); - if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) { - const timeObj = ms(cooldown - (Date.now() - lastDaily)); + if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) { + const timeObj = ms(cooldown - (Date.now() - lastDaily)); - message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`); - } else { - message.channel.send(`You have successfully collected $${amount} dollars!`); + message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`); + } else { + message.channel.send(`You have successfully collected $${amount} dollars!`); - const balance = await db.fetch(`userBalance_${message.author.id}`); + const balance = await db.fetch(`userBalance_${message.author.id}`); - if (balance == null) { - db.set(`userBalance_${message.author.id}`, 0); - } + if (balance == null) { + db.set(`userBalance_${message.author.id}`, 0); + } - db.set(`lastDaily_${message.author.id}`, Date.now()); - db.add(`userBalance_${message.author.id}`, 100); - } + db.set(`lastDaily_${message.author.id}`, Date.now()); + db.add(`userBalance_${message.author.id}`, 100); + } }; exports.conf = { - aliases: [], - guildOnly: false, + aliases: [], + guildOnly: false, }; exports.help = { - name: 'daily', - description: 'This gives you money everyday.', - usage: 'daily', - category: '- Economy Commands', + name: 'daily', + description: 'This gives you money everyday.', + usage: 'daily', + category: '- Economy Commands', }; diff --git a/deprecated/pay.js b/deprecated/pay.js new file mode 100644 index 0000000..bc27a4b --- /dev/null +++ b/deprecated/pay.js @@ -0,0 +1,60 @@ +/** ************************************** + * + * Pay: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ + +module.exports.run = async (client, message, args) => { + const db = require('quick.db'); + if (!message.mentions.members.first()) return message.reply('Please mention a user...'); + + const targetMember = message.mentions.members.first(); + const amount = parseInt(args.join(' ').replace(targetMember, '')); + + if (isNaN(amount)) return message.reply('Please define an amount.'); + + let targetBalance = await db.fetch(`userBalance_${targetMember.id}`); + let selfBalance = await db.fetch(`userBalance_${message.author.id}`); + + if (targetBalance === null) { + db.set(`userBalance_${targetMember.id}`, 0); + targetBalance = 0; + } + + if (selfBalance === null) { + db.set(`userBalance_${message.author.id}`, 0); + selfBalance = 0; + } + + if (amount > selfBalance) return message.reply('Sorry you don\'t have enough money.'); + + db.add(`userBalance_${targetMember.id}`, amount); + db.subtract(`userBalance_${message.author.id}`, amount); + + message.reply(`Successfully transfered $${amount} to ${targetMember.user}`); +}; + +exports.conf = { + aliases: ['transfer'], + guildOnly: false, +}; +exports.help = { + name: 'pay', + description: 'You can pay others!', + usage: 'pay [@user] [interger]', + category: '- Economy Commands', +}; diff --git a/package.json b/package.json index c982509..ad4eb3f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "aleebot", "version": "2.0.0", "description": "A chat bot for discord written in discord.js.", - "main": "src/bot.js", + "main": "bot_discord.js", "scripts": { "start": "node bot_discord.js", "dev": "nodemon bot_discord.js --beta" @@ -14,14 +14,15 @@ "author": "Alee Productions", "license": "GPL-3.0", "bugs": { - "url": "https://github.com/aleeproductions/AleeBot-JS/issues" + "url": "https://github.com/aleeproductions/AleeBot/issues" }, - "homepage": "https://github.com/aleeproductions/AleeBot-JS#readme", + "homepage": "https://github.com/aleeproductions/AleeBot#readme", "dependencies": { "blessed": "^0.1.81", "colors": "^1.3.0", "dblapi.js": "^2.0.0", - "discord.js": "^11.3.1", + "discord.js": "^12.2.0", + "eslint": "^7.1.0", "fs": "0.0.1-security", "git-last-commit": "^0.3.0", "i18next": "^19.4.4", @@ -30,6 +31,8 @@ "os": "^0.1.1", "parse-ms": "^1.0.1", "readline": "^1.3.0", + "sequelize": "^6.2.3", + "sqlite3": "^4.2.0", "ytdl-core": "^0.20.4" }, "devDependencies": { diff --git a/storage/items.json b/storage/items.json deleted file mode 100644 index 1d57718..0000000 --- a/storage/items.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Programmer" : { - "name": "Programmer Role", - "price": "100", - "type": "Roles", - "desc": "Buying this gives you the programmer role." - }, - "AleeOS" : { - "name": "AleeOS", - "price": "400", - "type": "OS", - "desc": "Buying this gives you AleeOS." - }, - "theSlate" : { - "name": "theSlate", - "price": "400", - "type": "Tools", - "desc": "Buying this gives you theSlate." - } -} \ No newline at end of file -- cgit v1.2.3 From 1e1f1d15c116001d892a06267b3688a88f8b1d99 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 23 Jul 2020 11:53:20 -0400 Subject: AvatarURL changes --- commands/avatarurl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/avatarurl.js b/commands/avatarurl.js index 293a1a4..7c50e2c 100644 --- a/commands/avatarurl.js +++ b/commands/avatarurl.js @@ -18,7 +18,7 @@ * * *************************************/ module.exports.run = async (client, message) => { - message.reply(message.author.avatarURL()); + message.reply(message.author.avatarURL({ dynamic: true, format: 'png', size: 1024 })); }; exports.conf = { -- cgit v1.2.3 From b2b631137ebc04f76b822ed3ca6b973c7fb9f016 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sat, 25 Jul 2020 21:29:07 -0400 Subject: Basic nick command --- commands/nick.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 commands/nick.js (limited to 'commands') diff --git a/commands/nick.js b/commands/nick.js new file mode 100644 index 0000000..bb3709b --- /dev/null +++ b/commands/nick.js @@ -0,0 +1,37 @@ +/** ************************************** + * + * Nick: Command for AleeBot + * Copyright (C) 2017-2020 Alee Productions + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * *************************************/ +module.exports.run = async (client, message, args) => { + if (!message.guild.member(client.user).hasPermission('MANAGE_NICKNAME')) return message.reply('**ERROR:** I can\'t change nicknames. (Check permissions)'); + if (message.guild.member(client.user).hasPermission('ADMINISRTATOR')) return message.reply('**ERROR:** Since you have admin permissions you are allowed to change your nickanme.'); + const nick = args.join(' '); + message.member.setNickname(nick); + message.channel.send(`Alright! I changed your nickname to \`${nick}\``); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'nick', + description: 'Changes nickname.', + usage: 'nick [context]', + category: '- General Commands', +}; -- cgit v1.2.3 From 865c0495f30020793af1d3e277c97c8b81606f61 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sat, 25 Jul 2020 21:41:43 -0400 Subject: Fixes --- commands/nick.js | 1 - 1 file changed, 1 deletion(-) (limited to 'commands') diff --git a/commands/nick.js b/commands/nick.js index bb3709b..f65bf74 100644 --- a/commands/nick.js +++ b/commands/nick.js @@ -19,7 +19,6 @@ * *************************************/ module.exports.run = async (client, message, args) => { if (!message.guild.member(client.user).hasPermission('MANAGE_NICKNAME')) return message.reply('**ERROR:** I can\'t change nicknames. (Check permissions)'); - if (message.guild.member(client.user).hasPermission('ADMINISRTATOR')) return message.reply('**ERROR:** Since you have admin permissions you are allowed to change your nickanme.'); const nick = args.join(' '); message.member.setNickname(nick); message.channel.send(`Alright! I changed your nickname to \`${nick}\``); -- cgit v1.2.3 From 36eb07fec7646012a711198ee8bfb3598e9e811f Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 22 Dec 2020 10:06:16 -0500 Subject: Added slowdown --- .idea/codeStyles/codeStyleConfig.xml | 5 +++ .idea/discord.xml | 2 +- .idea/jsLibraryMappings.xml | 6 ++++ bot_discord.js | 58 +++++++++++++++++++++++++++-------- commands/help.js | 2 +- commands/setup.js | 6 ++-- commands/slowdown.js | 37 ++++++++++++++++++++++ quote.sqlite | Bin 0 -> 16384 bytes 8 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 commands/slowdown.js create mode 100644 quote.sqlite (limited to 'commands') diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml index 59b11d1..a04e4e5 100644 --- a/.idea/discord.xml +++ b/.idea/discord.xml @@ -1,7 +1,7 @@ -