From 85a8f11507c0fb74b67914090bdfe10c361b775e Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 20 Sep 2022 09:24:37 -0400 Subject: Removed jail command; Added more activities; Few tweaks --- bot_discord.js | 13 +++++---- commands/ask.js | 1 + commands/git.js | 2 +- commands/help.js | 4 +-- commands/info.js | 2 +- commands/jail.js | 42 ---------------------------- commands/quote.js | 39 +++++++++++++------------- commands/serverinfo.js | 2 +- commands/timeout.js | 49 +++++++++++++++++++++++++++++++++ storage/activities.js | 75 ++++++++++++++++++++++++++++++++++---------------- 10 files changed, 132 insertions(+), 97 deletions(-) delete mode 100644 commands/jail.js create mode 100644 commands/timeout.js diff --git a/bot_discord.js b/bot_discord.js index d963a4d..60a133c 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -178,9 +178,9 @@ rl.on('line', function(cmd) { const uptimeSeconds = minutes % 60; console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue); break; - case 'activity': - console.log('[i] Generating new activity'.blue); - botPresence(); + case 'activity': + console.log('[i] Generating new activity'.blue); + botPresence(); break; case 'exit': console.log('[i] AleeBot will now exit!'.blue); @@ -204,6 +204,7 @@ rl.on('line', function(cmd) { msg += ('leave - Leaves a guild.\n'); msg += ('broadcast - Broadcasts a message to a server.\n'); msg += ('uptime - Shows the uptime for AleeBot.\n'); + msg += ('activity - Generates new activity\n'); msg += ('help - Shows this command.\n'); msg += ('exit - Exits AleeBot.\n'); console.log(msg.cyan); @@ -219,7 +220,7 @@ client.on('ready', async () => { 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] Running version ${settings.abVersion} and in ${client.guilds.cache.size} guilds`.green); + log(`[i] Running version ${settings.abVersion} | Serving in ${client.guilds.cache.size} guilds`.green); botPresence(); @@ -368,7 +369,7 @@ client.on('guildBanRemove', (guild, user) => { }); client.on('guildCreate', (guild) => { - log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`.blue); + log(`[i] New guild joined: ${guild.name} (${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!') @@ -385,7 +386,7 @@ client.on('guildCreate', (guild) => { client.on('guildDelete', (guild) => { - log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`.red); + log(`[i] I have been removed from: ${guild.name} (${guild.id})`.red); const logEmbed = new Discord.MessageEmbed() .setAuthor('AleeBot', client.user.avatarURL()) .setDescription('I got removed from a server...') diff --git a/commands/ask.js b/commands/ask.js index 1dd5edd..efb4a22 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -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/git.js b/commands/git.js index 8f6af1f..e4912e1 100644 --- a/commands/git.js +++ b/commands/git.js @@ -32,7 +32,7 @@ module.exports.run = async (client, message) => { new MessageButton() .setStyle('LINK') .setLabel('Source Code') - .setURL('https://github.com/aleeproductions/AleeBot') + .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 8fe42cc..e925754 100644 --- a/commands/help.js +++ b/commands/help.js @@ -40,8 +40,8 @@ module.exports.run = async (client, message) => { const prefix = prefixes[message.guild.id].prefixes; 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('Currently on the Alpha-Temp branch. Meaning that experimental features are enabled in this bot...') + .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help | Serving in ${client.guilds.cache.size} servers`, client.user.avatarURL()) + .setDescription('[!] Currently on the Alpha-Temp branch. Meaning that experimental features are enabled in this bot...') .setColor('#1fd619') categories.forEach(function(x) { diff --git a/commands/info.js b/commands/info.js index bae45d4..95eaebb 100644 --- a/commands/info.js +++ b/commands/info.js @@ -25,7 +25,7 @@ module.exports.run = async (client, message) => { .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('Discord.JS Version: ', version, true) .addField('OS Platform: ', os.platform(), true) .addField('OS Version: ', os.release(), true) .addField('Mongoose Version:', mongoose.version, true) diff --git a/commands/jail.js b/commands/jail.js deleted file mode 100644 index 7f6f3a3..0000000 --- a/commands/jail.js +++ /dev/null @@ -1,42 +0,0 @@ -/** ************************************** - * - * Jail: 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 . - * - * *************************************/ -module.exports.run = async (client, message, args) => { - if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.'); - - 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.'); - - member.roles.add(message.guild.roles.cache.get('428205205155217418')); - 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: '- Binaryworks Exclusive Commands', -}; diff --git a/commands/quote.js b/commands/quote.js index e431566..481cc9b 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -19,7 +19,7 @@ * *************************************/ const mongo = require('../plugins/mongo'); const quoteSchema = require('../schema/quote-schema'); -module.exports.run = async (client, message) => { +module.exports.run = async (client, message, args) => { if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**'); const { MessageEmbed } = require('discord.js'); @@ -32,27 +32,26 @@ module.exports.run = async (client, message) => { let quoQuote; let quoYear; - // Written using GitHub CoPilot + if (args) { + await mongo().then(async (mongoose) => { + try { + const quote = await quoteSchema.findOne({quoteID: args[1], author: quoAuthor, authorImage: quoAuthorImage, quote: quoQuote, year: quoYear}) + /* + const embed = new MessageEmbed() + .setAuthor(quoAuthor, quoAuthorImage) + .setDescription(quoQuote) + .setColor('#1fd619') + .setFooter('- ' + quoYear); - // Fetch a random quote from quoteSchema database then return the quote using embeds - const fetchQuote = async () => { - const quote = await mongo.db.collection('quotes').aggregate([{ $sample: { size: 1 } }]).toArray(); - quoId = quote[0]._id; - quoAuthor = quote[0].author; - quoAuthorImage = quote[0].authorImage; - quoQuote = quote[0].quote; - quoYear = quote[0].year; - const embed = new MessageEmbed() - - .setColor('#0099ff') - .setAuthor(quoAuthor, quoAuthorImage) - .setDescription(`${quoQuote}`) - .setFooter(`${quoYear}`) - return message.channel.send(embed); + await message.channel.send({embeds:[embed]});*/ + console.log(quote); + } finally { + await mongoose.connection.close(); + } + }) + } else { - }; - - fetchQuote(); + } /* diff --git a/commands/serverinfo.js b/commands/serverinfo.js index 513b1b4..0a2e077 100644 --- a/commands/serverinfo.js +++ b/commands/serverinfo.js @@ -24,7 +24,7 @@ module.exports.run = async (client, message) => { const embed = new Discord.MessageEmbed() .setAuthor(`${message.guild.name}`, `${message.guild.iconURL()}`) .setDescription('Server Information') - .setThumbnail(`${message.guild.iconURL()}`) + .setThumbnail(message.guild.iconURL()) .addField('Server Name:', `${message.guild.name}`) .addField('Server ID:', `${message.guild.id}`) .addField('Created At:', `${message.guild.createdAt.toUTCString()}`) diff --git a/commands/timeout.js b/commands/timeout.js new file mode 100644 index 0000000..bed9077 --- /dev/null +++ b/commands/timeout.js @@ -0,0 +1,49 @@ +/** ************************************** + * + * Jail: 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 . + * + * *************************************/ +module.exports.run = async (client, message, args) => { + const { MessageEmbed } = require('discord.js'); + + 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.'); + + 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 = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'timeout', + description: 'Times out a member', + usage: 'timeout [user]', + category: '- Moderation Commands', +}; diff --git a/storage/activities.js b/storage/activities.js index 13362d9..888c848 100644 --- a/storage/activities.js +++ b/storage/activities.js @@ -1,27 +1,18 @@ -const settings = require("./settings.json"); -const Discord = require("discord.js"); +const { abVersion } = require("./settings.json"); +const { version } = require("discord.js"); const activities = [ - `AleeBot ${settings.abVersion}`, + `AleeBot ${abVersion}`, 'Coding bytes', 'Drawing shapes', 'Fighting Quad', - 'Ultra Jump Mania!', - 'Battle Blaze', - 'Tempest', - 'Turbo Crash 9', - 'Pocket Gakusei', - 'Hidden Heroes', - 'Skybreakers', - 'Exposing TAS-Corp', - 'Fighting Evelyn Claythorne', - 'Games with Tari', - 'Decommissioning Meta Runners', - 'Installing Meta Runners', 'Installing Windows 11', 'Breaking Windows 10', + 'Beating up big tech', + 'Deleting Google', + 'Watering down the Apple walled garden', 'Reticulating splines', - 'Generating terrain', + 'Generating world', 'Never punch a tree...', 'Collecting data', 'Dag dag!', @@ -29,25 +20,61 @@ const activities = [ 'When will 2.13 release?', 'Alert Irruption !!!', 'when', + 'Frying Shrimpbot', + 'RADIATION BABY', + 'Frivolously Spending', 'Thanks! @Victor', + 'MCA DiscoVision', + 'Werq', 'Pombo', + 'Ian Clary\'s First Day At FrivoloCo!', + 'Squid Airlines', 'AirCS Race', + 'FrivoloCo', + 'I WANT 2 ORDER', + 'I REALLY WANT 2 ORDER', + 'I SAID I WANT 2 ORDER', + 'THANK YOU FOR TAKING SO LONG', + 'I COULD HAVE DONE THAT 67% FASTA', + 'I DO NOT WANT 2 ORDER ANYMORE', + 'Monica Is Going To Cosume You', + 'BLĂ…HAJ', 'ShiftOS', 'Histacom', + 'Wall Street', + 'Abunchoo 12.10', + 'MikeOS', 'theBeat', 'FRESHMusicPlayer', 'theShell', 'theBeat', 'theSlate', - 'Google Wallet', - 'Ian Clary\'s First Day At FrivoloCo!', - 'Squid Airlines', - 'Beating up big tech', - 'Deleting Google', - 'Watering down the Apple walled garden', - 'Frying Shrimpbot', + 'theDesk', + 'Ultra Jump Mania!', + 'Battle Blaze', + 'Tempest', + 'Turbo Crash 9', + 'Pocket Gakusei', + 'Hidden Heroes', + 'Skybreakers', + 'Always Running', + 'Only Up', + 'Trade', + 'Breeze', + 'Steady', + 'Bluejay', + 'Exposing TAS-Corp', + 'Fighting Evelyn Claythorne', + 'Hacking SherCorp', + 'Games with Tari', + 'Decommissioning Meta Runners', + 'Installing Meta Runners', '90% bug free!', - 'Now running ' + Discord.version + '!' + 'Google Wallet', + 'Apple Pay', + 'Splatoon 3', + 'Super Mario 64', + `Now running on Discord.JS ${version}!` ]; exports.activity = activities -- cgit v1.2.3