diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/about.js | 34 | ||||
| -rw-r--r-- | commands/addquote.js | 60 | ||||
| -rw-r--r-- | commands/ask.js | 3 | ||||
| -rw-r--r-- | commands/avatarurl.js | 12 | ||||
| -rw-r--r-- | commands/ban.js | 14 | ||||
| -rw-r--r-- | commands/eval.js | 8 | ||||
| -rw-r--r-- | commands/git.js | 19 | ||||
| -rw-r--r-- | commands/help.js | 12 | ||||
| -rw-r--r-- | commands/info.js | 11 | ||||
| -rw-r--r-- | commands/interrogate.js | 8 | ||||
| -rw-r--r-- | commands/invite.js | 49 | ||||
| -rw-r--r-- | commands/kick.js | 14 | ||||
| -rw-r--r-- | commands/leaveguild.js | 6 | ||||
| -rw-r--r-- | commands/nick.js | 4 | ||||
| -rw-r--r-- | commands/ping.js | 2 | ||||
| -rw-r--r-- | commands/poweroff.js | 4 | ||||
| -rw-r--r-- | commands/purge.js | 2 | ||||
| -rw-r--r-- | commands/quote.js | 50 | ||||
| -rw-r--r-- | commands/say.js | 2 | ||||
| -rw-r--r-- | commands/serverinfo.js | 51 | ||||
| -rw-r--r-- | commands/setlogchannel.js | 46 | ||||
| -rw-r--r-- | commands/setprefix.js | 4 | ||||
| -rw-r--r-- | commands/setup.js | 19 | ||||
| -rw-r--r-- | commands/slowdown.js | 4 | ||||
| -rw-r--r-- | commands/suggest.js | 12 | ||||
| -rw-r--r-- | commands/suggestfeature.js | 23 | ||||
| -rw-r--r-- | commands/timeout.js (renamed from commands/jail.js) | 27 | ||||
| -rw-r--r-- | commands/uptime.js | 13 | ||||
| -rw-r--r-- | commands/userinfo.js | 8 |
29 files changed, 276 insertions, 245 deletions
diff --git a/commands/about.js b/commands/about.js index a455faa..be1c17d 100644 --- a/commands/about.js +++ b/commands/about.js @@ -1,7 +1,7 @@ /** ************************************** * * About: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,15 +18,33 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - const os = require('os'); - const embed = new Discord.MessageEmbed() + const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js'); + + let Contributors = ('- Andrew Lee (Founder of this project)\n'); + Contributors += ('- OfficialRain (Raina) (Uptime Command)\n'); + Contributors += ('- jtsshieh (Command Handler)'); + + const aboutEmbed = new MessageEmbed() .setAuthor(`AleeBot ${require('../storage/settings.json').abVersion}`, client.user.avatarURL()) - .addField('About AleeBot', 'AleeBot is an all-in-one bot that\'s made from the Discord.JS api!') - .addField('Contributors', 'Andrew Lee (Founder of this project)\nOfficialRain (Raina) (Uptime Command)\njtsshieh (Command Handler)') - .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0') + .addField('About AleeBot', 'AleeBot is an all-in-one bot that\'s made from the Discord.JS API!') + .addField('License', 'GNU General Public License v3.0') + .addField('Contributors', Contributors) + .setFooter('© Copyright 2017-2023 Andrew Lee Projects') .setColor('#1fd619'); - await message.channel.send({embed}); + + let inviteButton = new MessageActionRow() + .addComponents( + new MessageButton() + .setStyle('LINK') + .setLabel('Invite AleeBot') + .setURL('https://top.gg/bot/282547024547545109'), + new MessageButton() + .setStyle('LINK') + .setLabel('Join Andrew Lee Projects') + .setURL('https://discord.gg/EFhRDqG') + ); + + await message.channel.send({embeds: [aboutEmbed], components: [inviteButton]}); }; exports.conf = { diff --git a/commands/addquote.js b/commands/addquote.js deleted file mode 100644 index 7b7221e..0000000 --- a/commands/addquote.js +++ /dev/null @@ -1,60 +0,0 @@ -/** ************************************** - * - * AddQuote: 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 <http://www.gnu.org/licenses/>. - * - * *************************************/ -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 = { - author: args[0], - authorImage: args[1], - 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...`) -*/ - 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 3b1efd5..efb4a22 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -1,7 +1,7 @@ /** ************************************** * * Ask: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -26,6 +26,7 @@ module.exports.run = async (client, message, args) => { 'Yep. Just kidding :P', 'I doubt it.', 'Maybe?', + 'Perhaps...', 'I don\'t know?', 'Hmm let me think :thinking:', ]; diff --git a/commands/avatarurl.js b/commands/avatarurl.js index 7c50e2c..2c796f4 100644 --- a/commands/avatarurl.js +++ b/commands/avatarurl.js @@ -1,7 +1,7 @@ /** ************************************** * * avatarurl: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,11 +18,17 @@ * * *************************************/ module.exports.run = async (client, message) => { - message.reply(message.author.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + if(!message.mentions.users.first()) { + message.reply(message.author.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + } else { + let targetMember; + targetMember = message.mentions.users.first(); + message.reply(targetMember.avatarURL({ dynamic: true, format: 'png', size: 1024 })) + } }; exports.conf = { - aliases: [], + aliases: ['pic'], guildOnly: false, }; exports.help = { diff --git a/commands/ban.js b/commands/ban.js index 3c8a809..b734be5 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -1,7 +1,7 @@ /** ************************************** * * Ban: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -21,16 +21,16 @@ 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.'); + if (!message.guild.members.cache.get(client.user.id).permissions.has('BAN_MEMBERS')) return message.reply('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.'); - await member.ban(`Banned by ${message.author.tag} Reason: ` + mreason); - const embed = new Discord.MessageEmbed() + if (!member) return message.reply('Please mention a member first.'); + await member.ban({ reason: `Banned by ${message.author.tag} for ${mreason}.`}); + const banEmbed = new Discord.MessageEmbed() .setTitle('User Banned!') .setColor('#1fd619') .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); - await message.channel.send({embed}); + if (mreason) return banEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embeds: [banEmbed]}); }; exports.conf = { diff --git a/commands/eval.js b/commands/eval.js index ef8fc97..b414225 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,7 +1,7 @@ /** ************************************** * * Eval: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions & jtsshieh + PokeWorld + * Copyright (C) 2017-2021 Alee Productions & jtsshieh + PokeWorld * * 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 @@ -47,7 +47,7 @@ module.exports.run = async (client, message, args) => { .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', client.user.avatarURL()) .setColor('RED'); - return message.channel.send({embed}); + return message.channel.send({embeds: [embed]}); } try { @@ -59,7 +59,7 @@ module.exports.run = async (client, message, args) => { .setFooter('Eval', client.user.avatarURL()) .setColor('GREEN'); - return message.channel.send({embed}); + return message.channel.send({embeds: [embed]}); } catch (err) { const embed = new MessageEmbed() .setAuthor('Eval Error') @@ -68,7 +68,7 @@ module.exports.run = async (client, message, args) => { .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', client.user.avatarURL()) .setColor('RED'); - return message.channel.send({embed}); + return message.channel.send({embeds: [embed]}); } }; diff --git a/commands/git.js b/commands/git.js index ed98ebf..e4912e1 100644 --- a/commands/git.js +++ b/commands/git.js @@ -1,7 +1,7 @@ /** ************************************** * * Git: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,16 +18,23 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); + const { MessageEmbed, MessageButton, MessageActionRow } = 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') + const gitInfo = new MessageEmbed() + .setTitle('Git Information') .addField('**Last Commit:**', commit.subject) .addField('**Commited By:**', commit.author.name) .setColor('#1fd619'); - message.channel.send({embed}); + + let sourceCode = new MessageActionRow() + .addComponents( + new MessageButton() + .setStyle('LINK') + .setLabel('Source Code') + .setURL('https://github.com/alee14-projects/AleeBot') + ); + message.channel.send({embeds: [gitInfo], components: [sourceCode]}); }); }; diff --git a/commands/help.js b/commands/help.js index 36d4630..0b9191e 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,7 +1,7 @@ /** ************************************** * * Help: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -38,12 +38,12 @@ module.exports.run = async (client, message) => { } 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.'); + if (!message.guild.members.cache.get(client.user.id).permissions.has('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 + '`') + .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help`, client.user.avatarURL()) + .setDescription('Every command you input into AleeBot is `ab:`') + .setFooter(`Currently serving on ${client.guilds.cache.size} servers`) .setColor('#1fd619') - .setFooter('© Copyright 2017-2020 Alee Productions, Licensed with GPL-3.0'); categories.forEach(function(x) { let cat = ''; @@ -55,7 +55,7 @@ module.exports.run = async (client, message) => { embed.addField(x, cat, true); }); - await message.channel.send({embed}); + await message.channel.send({embeds: [embed]}); }; exports.conf = { diff --git a/commands/info.js b/commands/info.js index 3de7ecd..95eaebb 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,7 +1,7 @@ /** ************************************** * * Info: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,16 +18,19 @@ * * *************************************/ module.exports.run = async (client, message) => { - const Discord = require('discord.js'); + const { MessageEmbed, version } = require('discord.js'); const os = require('os'); - const embed = new Discord.MessageEmbed() + const mongoose = require('mongoose'); + const embed = new MessageEmbed() .setTitle('Information on AleeBot\'s Host') .addField('OS Hostname: ', os.hostname(), true) .addField('NodeJS Version: ', process.versions.node, true) + .addField('Discord.JS Version: ', version, true) .addField('OS Platform: ', os.platform(), true) .addField('OS Version: ', os.release(), true) + .addField('Mongoose Version:', mongoose.version, true) .setColor('#1fd619'); - message.channel.send({embed}); + await message.channel.send({ embeds: [embed] }); }; exports.conf = { diff --git a/commands/interrogate.js b/commands/interrogate.js index 54e8cb2..3386352 100644 --- a/commands/interrogate.js +++ b/commands/interrogate.js @@ -1,7 +1,7 @@ /** ************************************** * * Interrogate: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,10 +18,10 @@ * * *************************************/ 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 Binaryworks 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.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.members.cache.get(client.user.id).permissions.has('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.'); diff --git a/commands/invite.js b/commands/invite.js deleted file mode 100644 index e6f538f..0000000 --- a/commands/invite.js +++ /dev/null @@ -1,49 +0,0 @@ -/** ************************************** - * - * 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 <http://www.gnu.org/licenses/>. - * - * *************************************/ -module.exports.run = async (client, message) => { - 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'); -}; - -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/kick.js b/commands/kick.js index 3cbaaf8..c248afc 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -1,7 +1,7 @@ /** ************************************** * * Kick: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -21,16 +21,16 @@ 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 kick people.'); - if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.'); + if (!message.guild.members.cache.get(client.user.id).permissions.has('KICK_MEMBERS')) return message.reply('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() + if (!member) return message.reply('Please mention a member first.'); + await member.kick(`Kicked by ${message.author.tag} for ${mreason}.`); + const kickEmbed = new Discord.MessageEmbed() .setTitle('User Kicked!') .setColor('#1fd619') .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); - await message.channel.send({embed}); + if (mreason) return kickEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + await message.channel.send({embeds: [kickEmbed]}); }; exports.conf = { diff --git a/commands/leaveguild.js b/commands/leaveguild.js index 5108436..00a97fc 100644 --- a/commands/leaveguild.js +++ b/commands/leaveguild.js @@ -1,7 +1,7 @@ /** ************************************** * * LeaveGuild: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,8 +18,8 @@ * * *************************************/ 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!'); + if (!['242775871059001344', message.guild.ownerID].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.'); + await message.channel.send('Leaving server. If that\'s a mistake, you can re-invite me'); message.guild.leave(); }; diff --git a/commands/nick.js b/commands/nick.js index f65bf74..8fcdce7 100644 --- a/commands/nick.js +++ b/commands/nick.js @@ -1,7 +1,7 @@ /** ************************************** * * Nick: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,7 +18,7 @@ * * *************************************/ 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.members.cache.get(client.user.id).permissions.has('MANAGE_NICKNAME')) return message.reply('**ERROR:** I can\'t change nicknames. (Check permissions)'); const nick = args.join(' '); message.member.setNickname(nick); message.channel.send(`Alright! I changed your nickname to \`${nick}\``); diff --git a/commands/ping.js b/commands/ping.js index b8d2779..d66330d 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,7 +1,7 @@ /** ************************************** * * Ping: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 diff --git a/commands/poweroff.js b/commands/poweroff.js index 8067c5f..22fb6bb 100644 --- a/commands/poweroff.js +++ b/commands/poweroff.js @@ -1,7 +1,7 @@ /** ************************************** * * Poweroff: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -27,7 +27,7 @@ module.exports.run = async (client, message) => { let statusChannel = client.channels.cache.get('606602551634296968'); if (!statusChannel) return console.error('The status channel does not exist! Skipping.'); - await statusChannel.send(stopEmbed); + await statusChannel.send({ embeds: [stopEmbed]}); await message.reply(':warning: AleeBot will now exit!'); console.log('[i] AleeBot will now exit!'.blue); client.destroy(); diff --git a/commands/purge.js b/commands/purge.js index 97c1be6..bc6e727 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -1,7 +1,7 @@ /** ************************************** * * Purge: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 diff --git a/commands/quote.js b/commands/quote.js index 149fe37..37f5714 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -1,7 +1,7 @@ /** ************************************** * * Quote: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -17,39 +17,33 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *************************************/ -module.exports.run = async (client, message) => { - const Discord = require('discord.js'); - - let NewQuote; - - function GetNewQuote(quoteNum = -1) { - NewQuote = new Discord.MessageEmbed(); - - let quo = require('../storage/quotes.json').quotes; +module.exports.run = async (client, message, args) => { + const quoteDB = require('../models/quote'); + const { MessageEmbed } = require('discord.js'); + let quoteID = args[0]; + + if (quoteID === undefined) { + const quoteList = await quoteDB.findAll({ attributes: ['id'] }) + const random = crypto.getRandomValues(new Uint32Array(1)); + quoteID = quoteList[random[0] % quoteList.length].id; + } - if (quoteNum == -1) { - quoteNum = Math.floor(Math.random() * 1000) % quo.length; - quo=quo[quoteNum]; - } + const quote = await quoteDB.findOne({ where: { id: quoteID } }) - 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); + if (quote) { + const quoteEmbed = new MessageEmbed() + .setAuthor({ name: quote.author, iconURL: quote.authorImage }) + .setDescription(quote.quote) + .setColor('#1fd619') + .setFooter('- ' + quote.year); - return NewQuote; + await message.reply({ content: 'Alright, here\'s your quote.', embeds: [quoteEmbed] }) + } else { + message.reply('Cannot find quote, specify the correct quote id.'); } - const newquote = GetNewQuote(); - message.reply('Alright, here\'s your quote.'); - message.channel.send(newquote); + }; exports.conf = { diff --git a/commands/say.js b/commands/say.js index fe17b42..9ef9707 100644 --- a/commands/say.js +++ b/commands/say.js @@ -1,7 +1,7 @@ /** ************************************** * * Say: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 diff --git a/commands/serverinfo.js b/commands/serverinfo.js new file mode 100644 index 0000000..67442a2 --- /dev/null +++ b/commands/serverinfo.js @@ -0,0 +1,51 @@ +/** ************************************** + * + * ServerInfo: Command for AleeBot + * Copyright (C) 2017-2021 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 <http://www.gnu.org/licenses/>. + * + * *************************************/ +module.exports.run = async (client, message) => { + const Discord = require('discord.js'); + const listedChannels = []; + let guildOwner = await message.guild.fetchOwner(); + let memberCountNoBots = await message.guild.members.fetch().then((members) => members.filter(member => !member.user.bot).size); + const embed = new Discord.MessageEmbed() + .setAuthor(`${message.guild.name}`, `${message.guild.iconURL()}`) + .setDescription('Server Information') + .setThumbnail(message.guild.iconURL()) + .addField('Main Information', `**Server Name:** ${message.guild.name}\n**Server ID:** ${message.guild.id}\n**Server Owner:** ${guildOwner.user.tag}`) + .addField('Join Dates', `**Created At:** ${message.guild.createdAt.toUTCString()}\n**AleeBot Joined:** ${message.guild.joinedAt.toUTCString()}`) + /*message.guild.channels.cacheType.forEach(channel => { + listedChannels.push(channel) + })*/ + //.addField('Channels', `${listedChannels.join('\n')}`) + //.addField('Total Channels', message.guild.channelCountMode) + .addField('Total Members (with bots)', `${message.guild.memberCount}`) + .addField('Total Members (without bots)', `${memberCountNoBots}`) + .setColor('#1fd619'); + await message.channel.send({embeds: [embed]}); +}; + +exports.conf = { + aliases: ['sinfo'], + guildOnly: false, +}; +exports.help = { + name: 'serverinfo', + description: 'Tells your info.', + usage: 'serverinfo', + category: '- Information Commands', +}; diff --git a/commands/setlogchannel.js b/commands/setlogchannel.js new file mode 100644 index 0000000..c04e926 --- /dev/null +++ b/commands/setlogchannel.js @@ -0,0 +1,46 @@ +/** ************************************** + * + * SetLogChannel: Command for AleeBot + * Copyright (C) 2017-2021 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 <http://www.gnu.org/licenses/>. + * + * *************************************/ +const guildDB = require ('../models/guild-settings') +module.exports.run = async (client, message) => { + //This will be replaced in the future possibly + if (!message.member.permissions.has('MANAGE_GUILD')) return message.reply('It looks like that you can\'t manage this server.'); + const channel = await message.mentions.channels.first().id; + const [ guild ] = await guildDB.findOrCreate({ where: { id: message.guild.id } } ) + + if (!channel) { + message.reply('No channel has been set, disabling the logging channel feature...'); + await guild.update({ channelId: null } ); + } else { + await guild.update({ channelId: message.guild.id } ) ; + } + + await message.reply(`Logging channel has been set to <#${channel}>`); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'setlogchannel', + description: 'Set the log channel.', + usage: 'setlogchannel #channel', + category: '- Moderation Commands', +}; diff --git a/commands/setprefix.js b/commands/setprefix.js index edb42c9..6800eea 100644 --- a/commands/setprefix.js +++ b/commands/setprefix.js @@ -1,7 +1,7 @@ /** ************************************** * * SetPrefix: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -23,7 +23,7 @@ module.exports.run = async (client, message, args) => { 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 (!message.member.permissions.has('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix'); if (!args[0] || args[0 == 'help']) return message.reply('Usage: <your prefix>setprefix <prefix>'); const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); diff --git a/commands/setup.js b/commands/setup.js index bf6a14c..5c2f232 100644 --- a/commands/setup.js +++ b/commands/setup.js @@ -1,7 +1,7 @@ /**************************************** - * + * * Setup: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -15,22 +15,23 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * * *************************************/ 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.'); + if (!['242775871059001344', message.guild.ownerId].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('Logs', 'channelid', true) - // .addField('Chat Logs', 'placeholder', true) - // .addField('Chat Logs', 'placeholder', true); + .addField('Chat Logs', 'channelid', true) + .addField('Joining & Leaving Logs', 'placeholder', true) + .addField('Broadcast', 'placeholder', true) + .addField('Broadcast', 'placeholder', true); - message.author.send(setupEmbed); + message.author.send({embeds: [setupEmbed]}); }; exports.conf = { @@ -42,4 +43,4 @@ exports.help = { description: 'Setting up AleeBot.', usage: 'setup', category: '- Settings Commands', -};
\ No newline at end of file +}; diff --git a/commands/slowdown.js b/commands/slowdown.js index c9fc611..55e441b 100644 --- a/commands/slowdown.js +++ b/commands/slowdown.js @@ -1,7 +1,7 @@ /** ************************************** * * Slowdown: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -21,7 +21,7 @@ module.exports.run = async (client, message, args) => { if (!message.member.permissions.has('MANAGE_CHANNELS')) return message.reply('It looks like that you don\'t have the permissions to slowdown channels.'); if (isNaN(args[0])) return message.reply('Please input a valid number to slowdown a channel.'); await message.channel.setRateLimitPerUser(args[0]); - message.channel.send(`This channel has been ratelimited for ${args[0]} second(s).`); + message.channel.send(`This channel has been slowdown for ${args[0]} second(s).`); }; diff --git a/commands/suggest.js b/commands/suggest.js index 3adaa31..b503139 100644 --- a/commands/suggest.js +++ b/commands/suggest.js @@ -1,7 +1,7 @@ /** ************************************** * * Suggest: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,15 +18,15 @@ * * *************************************/ 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 Andrew Lee Projects exclusive command.'); const {MessageEmbed} = require('discord.js'); - client.channels.cache.get('427495678390960148').send( + client.channels.cache.get('427495678390960148').send({ embeds: [ new MessageEmbed() .setColor('#1fd619') .setTitle('Suggestion') - .setDescription('This is a suggestion from '+ message.author.username +' please react to it using the following emojis.') + .setDescription('This is a suggestion from '+ message.author.username +'. Please react to it using the following emojis.') .addField('Suggestion Contents', args.join(' ')), - ).then((message) => { + ]}).then((message) => { message.react('\u2705'); message.react('\u274E'); }); @@ -39,7 +39,7 @@ exports.conf = { }; exports.help = { name: 'suggest', - description: 'Suggest a feature in ALP.', + description: 'Suggest a feature in Andrew Lee Projects.', usage: 'suggest [suggestion]', category: '- ALP Exclusive Commands', }; diff --git a/commands/suggestfeature.js b/commands/suggestfeature.js index 8b8b3c7..21b6849 100644 --- a/commands/suggestfeature.js +++ b/commands/suggestfeature.js @@ -1,7 +1,7 @@ /**************************************** - * + * * SuggestFeature: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -15,22 +15,23 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * * *************************************/ module.exports.run = async (client, message, args) => { const { MessageEmbed } = require('discord.js'); - - client.channels.cache.get('427495678390960148').send( + + client.channels.cache.get('427495678390960148').send({ embeds: [ new MessageEmbed() - .setColor ('#1fd619') + .setColor('#1fd619') .setTitle('AleeBot Feature Suggestion') - .setDescription('This is an AleeBot feature suggestion from '+ message.author.username +` sending from ${message.guild.name}.`) + .setDescription(`This is an AleeBot feature suggested from ${message.author.username}.`) .addField('Suggestion Contents', args.join(' ')) + .setFooter(`Sending from ${message.guild.name}`, message.guild.iconURL())]} ); - await message.reply('Your suggestion has been shown to the ALP discord server!'); - + await message.reply('Your suggestion has been shown to the Andrew Lee Projects discord server!'); + }; - + exports.conf = { aliases: [], guildOnly: false, @@ -41,4 +42,4 @@ exports.help = { usage: 'suggestfeature [suggestion]', category: '- General Commands', }; - + diff --git a/commands/jail.js b/commands/timeout.js index 432f60a..bed9077 100644 --- a/commands/jail.js +++ b/commands/timeout.js @@ -1,7 +1,7 @@ /** ************************************** * * Jail: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -18,16 +18,23 @@ * * *************************************/ module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.'); + const { MessageEmbed } = require('discord.js'); - 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.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.'); + if (!message.guild.members.cache.get(client.user.id).permissions.has('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.'); + + if (!args[1]) message.reply('Determine the length of the timeout...'); + if (!args[2]) message.reply('Determine the reason of the timeout...'); const member = message.mentions.members.first(); if (!member) return await message.reply('Uhh... Please mention a member first.'); - member.roles.add(message.guild.roles.cache.get('428205205155217418')); - message.reply(`Alright, I just jailed ${member.user.tag}.`); + const timeoutEmbed = new MessageEmbed() + .setDescription(`${member.user.tag} just got timed out!`) + .addField('Length', `${args[1]} minute(s)`) + .addField('Reason', args[2]) + .setColor('#ec2727') + member.timeout(args[1] * 60 * 1000, args[2]).then(message.reply({embeds: [timeoutEmbed]})); }; exports.conf = { @@ -35,8 +42,8 @@ exports.conf = { guildOnly: false, }; exports.help = { - name: 'jail', - description: 'Jails a member', - usage: 'jail [user]', - category: '- ALP Exclusive Commands', + name: 'timeout', + description: 'Times out a member', + usage: 'timeout [user]', + category: '- Moderation Commands', }; diff --git a/commands/uptime.js b/commands/uptime.js index 90afc81..7453ad5 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -1,7 +1,7 @@ /** ************************************** * * Uptime: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions & OfficialRain + * Copyright (C) 2017-2021 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 @@ -23,12 +23,17 @@ module.exports.run = async (client, message) => { let uptimeMinutes = Math.floor(uptime / 60); const minutes = uptime % 60; let hours = 0; + let days = 0; while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + while (hours >= 24) { + days++; + hours = hours - 24; } const uptimeSeconds = minutes % 60; - message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); + message.channel.send(`:clock3: AleeBot has been up for ${days} days, ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`); }; exports.conf = { diff --git a/commands/userinfo.js b/commands/userinfo.js index f12454a..bc7ec8e 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -1,7 +1,7 @@ /** ************************************** * * UserInfo: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 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 @@ -23,11 +23,11 @@ module.exports.run = async (client, message) => { .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('Names', `**Display Name:** ${message.member.displayName}\n**Username:** ${message.author.username}\n**Server 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()) + .addField('Create and Join Times', `**Created At:** ${message.member.user.createdAt.toUTCString()}\n**Joined Guild At:** ${message.member.joinedAt.toUTCString()}`) .setColor('#1fd619'); - await message.channel.send({embed}); + await message.channel.send({embeds: [embed]}); }; |
