diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-09-15 15:06:29 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-09-15 15:06:29 -0400 |
| commit | 96762ce209415c72e098a78771f80fcc41413280 (patch) | |
| tree | 4340e737752f0468aeab7451bfb7c30db7e0de50 | |
| parent | caa341ec28a1247bd06602ba3bc727a7ff8f1fd7 (diff) | |
| download | AleeBot-96762ce209415c72e098a78771f80fcc41413280.tar.gz AleeBot-96762ce209415c72e098a78771f80fcc41413280.tar.bz2 AleeBot-96762ce209415c72e098a78771f80fcc41413280.zip | |
2022 update; Modularized activities
| -rw-r--r-- | bot_discord.js | 29 | ||||
| -rw-r--r-- | commands/about.js | 4 | ||||
| -rw-r--r-- | commands/quote.js | 43 | ||||
| -rw-r--r-- | commands/serverinfo.js | 2 | ||||
| -rw-r--r-- | storage/activities.js | 53 |
5 files changed, 87 insertions, 44 deletions
diff --git a/bot_discord.js b/bot_discord.js index a390fef..d963a4d 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -36,6 +36,7 @@ const web = express(); const settings = require('./storage/settings.json'); const mongo = require('./plugins/mongo'); const api = require('./tokens.json'); +const { activity } = require('./storage/activities'); const active = new Map(); let autoRole = true; let readyEmbedMessage = false; @@ -45,22 +46,6 @@ let statusChannelID = '606602551634296968'; let serverWhitelist = "243022206437687296"; let roleWhitelist = "657426918416580614" -const activities = [ - 'AleeBot ' + settings.abVersion + ' | ' + settings.prefix + 'help', - 'Coding bytes', - 'Drawing shapes', - 'Fighting Quad', - 'Ultra Jump Mania!', - 'Exposing TAS-Corp', - 'Fighting Evelyn Claythorne', - 'Installing Windows 11', - 'Breaking Windows 10', - 'Reticulating splines', - 'Dag dag!', - '90% bug free!', - 'Now running ' + Discord.version + '!' -]; - const log = (message) => { console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white); }; @@ -68,7 +53,7 @@ const log = (message) => { function botPresence() { client.user.setPresence({ activities: [{ - name: activities[Math.floor(Math.random() * activities.length)] + name: activity[Math.floor(Math.random() * activity.length)] }], status: 'online', afk: false, @@ -82,7 +67,7 @@ const rl = readline.createInterface({ prompt: '> '.gray, }); -console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2021 Alee Productions`.gray); +console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2022 Andrew Lee Projects`.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); @@ -193,6 +178,10 @@ 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(); + break; case 'exit': console.log('[i] AleeBot will now exit!'.blue); const asyncPowerOff = async () => { @@ -323,7 +312,7 @@ client.on('messageUpdate', async (oldMessage, newMessage) => { .setColor('#ffff1a') .setTimestamp() .setFooter(`Author ID: ${oldMessage.author.id}`); - + let editMessage = client.channels.cache.get(logChannel); if (!editMessage) return; @@ -419,7 +408,7 @@ AutoPoster(api.dbltoken, client) client.on('messageCreate', async(msg) => { if (!client.application?.owner) await client.application?.fetch(); if (msg.author.bot) return; - + const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8')); if (!prefixes[msg.guild.id]) { diff --git a/commands/about.js b/commands/about.js index 5fd11de..14daebb 100644 --- a/commands/about.js +++ b/commands/about.js @@ -22,10 +22,10 @@ module.exports.run = async (client, message) => { 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('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', 'Andrew Lee (Founder of this project)\nOfficialRain (Raina) (Uptime Command)\njtsshieh (Command Handler)') - .setFooter('© Copyright 2017-2021 Alee Productions') + .setFooter('© Copyright 2017-2022 Andrew Lee Projects') .setColor('#1fd619'); let inviteButton = new MessageActionRow() diff --git a/commands/quote.js b/commands/quote.js index 57729ae..e431566 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -19,12 +19,12 @@ * *************************************/ const mongo = require('../plugins/mongo'); const quoteSchema = require('../schema/quote-schema'); -module.exports.run = async (client, message, args) => { +module.exports.run = async (client, message) => { 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'); - let NewQuote; - let quo; +// let NewQuote; +// let quo; let quoId; let quoAuthor; @@ -32,26 +32,27 @@ module.exports.run = async (client, message, args) => { let quoQuote; let quoYear; - 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); + // Written using GitHub CoPilot - await message.channel.send({embeds:[embed]});*/ - console.log(quote); - } finally { - await mongoose.connection.close(); - } - }) - } else { + // 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); - } + }; + + fetchQuote(); /* diff --git a/commands/serverinfo.js b/commands/serverinfo.js index 049ad98..513b1b4 100644 --- a/commands/serverinfo.js +++ b/commands/serverinfo.js @@ -27,7 +27,7 @@ module.exports.run = async (client, message) => { .setThumbnail(`${message.guild.iconURL()}`) .addField('Server Name:', `${message.guild.name}`) .addField('Server ID:', `${message.guild.id}`) - .addField('Create At:', `${message.guild.createdAt.toUTCString()}`) + .addField('Created At:', `${message.guild.createdAt.toUTCString()}`) /*message.guild.channels.cacheType.forEach(channel => { listedChannels.push(channel) })*/ diff --git a/storage/activities.js b/storage/activities.js new file mode 100644 index 0000000..13362d9 --- /dev/null +++ b/storage/activities.js @@ -0,0 +1,53 @@ +const settings = require("./settings.json"); +const Discord = require("discord.js"); + +const activities = [ + `AleeBot ${settings.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', + 'Reticulating splines', + 'Generating terrain', + 'Never punch a tree...', + 'Collecting data', + 'Dag dag!', + 'Developed by Andrew Lee', + 'When will 2.13 release?', + 'Alert Irruption !!!', + 'when', + 'Thanks! @Victor', + 'Pombo', + 'AirCS Race', + 'ShiftOS', + 'Histacom', + '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', + '90% bug free!', + 'Now running ' + Discord.version + '!' +]; + +exports.activity = activities |
