From 1a7a627446edfeb270850f0ed15c9c8d604380b2 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sat, 25 Mar 2023 21:25:43 -0400 Subject: Now using sequelize; Minor tweaks; New activities --- .gitignore | 5 +- .idea/dbnavigator.xml | 417 ++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 2 +- bot_discord.js | 22 +-- commands/about.js | 10 +- commands/addquote.js | 93 +++-------- commands/ban.js | 2 +- commands/kick.js | 2 +- commands/leaveguild.js | 2 +- commands/quote.js | 73 ++------ commands/setlogchannel.js | 35 +--- commands/setup.js | 46 +++++ commands/uptime.js | 11 +- deprecated/setup.js | 45 ----- models/guild-settings.js | 24 +++ models/quote.js | 29 ++++ package.json | 11 +- plugins/mongo.js | 10 -- schema/logging-schema.js | 13 -- schema/quote-schema.js | 17 -- storage/activities.js | 28 +++- sync-database.js | 9 + utils/sequelize.js | 9 + 23 files changed, 643 insertions(+), 272 deletions(-) create mode 100644 .idea/dbnavigator.xml create mode 100644 commands/setup.js delete mode 100644 deprecated/setup.js create mode 100644 models/guild-settings.js create mode 100644 models/quote.js delete mode 100644 plugins/mongo.js delete mode 100644 schema/logging-schema.js delete mode 100644 schema/quote-schema.js create mode 100644 sync-database.js create mode 100644 utils/sequelize.js diff --git a/.gitignore b/.gitignore index fb6a084..bca3965 100644 --- a/.gitignore +++ b/.gitignore @@ -11,11 +11,10 @@ ffprobe.exe .directory -userData.sqlite .vs/slnx.sqlite .vs/slnx.sqlite-journal json.sqlite yarn.lock - -package-lock.json \ No newline at end of file +package-lock.json +database.sqlite diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..b1bad03 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,417 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d75ca6a..2799fb4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Include the GPL-3.0 license too and follow the following format when you create /**************************************** * * [Command/Plugin]: (Command or Plugin) for AleeBot - * Copyright (C) 2017-2021 Alee Productions & (your name here) + * Copyright (C) 2017-2023 Andrew Lee & (your name here) * * 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/bot_discord.js b/bot_discord.js index 60a133c..00afe45 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -1,7 +1,7 @@ /** ************************************** * * AleeBot: Made for discord servers - * Copyright (C) 2017-2021 Alee Productions + * Copyright (C) 2017-2022 Andrew Lee Projects * * 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 @@ -30,11 +30,9 @@ const express = require('express'); const fs = require('fs'); const readline = require('readline'); const colors = require('colors'); -const { AutoPoster } = require('topgg-autoposter'); //const i18next = require('i18next'); 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(); @@ -67,7 +65,7 @@ const rl = readline.createInterface({ prompt: '> '.gray, }); -console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2022 Andrew Lee Projects`.gray); +console.log(`AleeBot ${settings.abVersion}: Copyright (C) 2017-2023 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); @@ -224,14 +222,6 @@ client.on('ready', async () => { botPresence(); - await mongo().then(mongoose => { - try { - log('[>] Connected to MongoDB!'.green); - } finally { - mongoose.connection.close(); - } - }) - web.get('/', (req, res) => { res.send("Hello World! This is going to become the AleeBot dashboard..."); }); @@ -263,10 +253,9 @@ client.on('guildMemberAdd', (member) => { const logEmbed = new Discord.MessageEmbed() .setAuthor('AleeBot Logging', client.user.avatarURL()) .setDescription(`A user has joined this server!`) - .addField('Username: ', `${member.displayName}`, true) + .addField('Username: ', `${member.user.tag}`, true) .addField('User ID: ', `${member.id}`, true) .addField('Created At: ', `${member.user.createdAt.toUTCString()}`) - //.addField('Invite Code: ', `${member.invite.code}`) .setColor('#4bff31') .setTimestamp(); @@ -278,8 +267,7 @@ client.on('guildMemberAdd', (member) => { if (member.guild.id !== serverWhitelist) return; const role = member.guild.roles.cache.get(roleWhitelist); member.roles.add(role); - log(`[i] ${member.user.username} joined Binaryworks Community.`.green); - log(`[i] I gave ${member.user.username} the "Member" role.`.green); + log(`[i] ${member.user.username} joined Andrew Lee Projects, automatically giving them role.`.green); } }); @@ -288,7 +276,7 @@ client.on('guildMemberRemove', (member) => { const logEmbed = new Discord.MessageEmbed() .setAuthor('AleeBot Logging', client.user.avatarURL()) .setDescription(`A user has left this server!`) - .addField('Username: ', `${member.displayName}`, true) + .addField('Username: ', `${member.user.tag}`, true) .addField('User ID: ', `${member.id}`, true) .setColor('#ec2727') .setTimestamp(); diff --git a/commands/about.js b/commands/about.js index 14daebb..be1c17d 100644 --- a/commands/about.js +++ b/commands/about.js @@ -20,12 +20,16 @@ module.exports.run = async (client, message) => { 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('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-2022 Andrew Lee Projects') + .addField('Contributors', Contributors) + .setFooter('© Copyright 2017-2023 Andrew Lee Projects') .setColor('#1fd619'); let inviteButton = new MessageActionRow() @@ -36,7 +40,7 @@ module.exports.run = async (client, message) => { .setURL('https://top.gg/bot/282547024547545109'), new MessageButton() .setStyle('LINK') - .setLabel('Join Binaryworks Community') + .setLabel('Join Andrew Lee Projects') .setURL('https://discord.gg/EFhRDqG') ); diff --git a/commands/addquote.js b/commands/addquote.js index 6334470..477d891 100644 --- a/commands/addquote.js +++ b/commands/addquote.js @@ -17,74 +17,35 @@ * along with this program. If not, see . * * *************************************/ -const mongo = require('../plugins/mongo'); -const quoteSchema = require('../schema/quote-schema'); +const quoteDB = require('../models/quote'); +const Discord = require("discord.js"); module.exports.run = async (client, message, args) => { -/* - let authorMessage; - let authorImageMessage; - let quoteMessage; - let yearMessage;*/ - if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**'); - //await message.author.send('Welcome to AleeBot\'s quoting system!\nThis process will be easy.'); - - if (!args.length) return message.reply("Error: Did not provide more context (message will be replaced eventually)"); - - await mongo().then(async (mongoose) => { - try { - await new quoteSchema({ - author: args[0], - authorImage: args[1], - quote: args[2], - year: args[3] - - }).save() - } finally { - await mongoose.connection.close(); - message.reply('Added this quote to the database...'); - } - }) - -/* - let quoteState = {}; - let state = quoteState[message.author.id]; - - if (message.content.toLowerCase() === "q"){ - await message.author.send("Process has been cancelled"); - state = null; - } else { - switch (state) { - case 1: - await message.author.send('Enter the author\'s name'); - authorMessage = message.content; - console.log(authorMessage); - state = 2; - break; - case 2: - await message.author.send('author url here'); - authorImageMessage = message.content; - console.log(authorImageMessage); - state = 3; - break; - case 3: - await message.author.send('quote here'); - quoteMessage = message.content; - console.log(quoteMessage); - state = 4; - break; - case 4: - await message.author.send('year here'); - yearMessage = message.content; - console.log(yearMessage); - state = 5; - break; - case 5: - await message.author.send('process complete'); - state = null; - break; - } -*/ + try { + let newAuthor; + let newAuthorImage; + let newQuote; + let newYear; + + const quote = await quoteDB.create({ + author: newAuthor, + authorImage: newAuthorImage, + quote: newQuote, + year: newYear + }) + + const setupEmbed = new Discord.MessageEmbed() + .setTitle('AleeBot Quote Setup', client.user.avatarURL()) + .setDescription('Input the data to the following embed') + .addField('Author', newAuthor, true) + .addField('Author Image (URL)', newAuthorImage, true) + .addField('Quote', newQuote, true) + .addField('Year', newYear, true); + + message.reply({embeds: [setupEmbed]}); + } catch (error) { + console.log(error) + } }; exports.conf = { diff --git a/commands/ban.js b/commands/ban.js index 1e8ee6e..b734be5 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -29,7 +29,7 @@ module.exports.run = async (client, message, args) => { .setTitle('User Banned!') .setColor('#1fd619') .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + if (mreason) return banEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``); await message.channel.send({embeds: [banEmbed]}); }; diff --git a/commands/kick.js b/commands/kick.js index 1bf83db..c248afc 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -29,7 +29,7 @@ module.exports.run = async (client, message, args) => { .setTitle('User Kicked!') .setColor('#1fd619') .addField('**User:**', `${member.user.tag}`) - .addField('**Reason:**', `\`\`\`${mreason}\`\`\``); + if (mreason) return kickEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``); await message.channel.send({embeds: [kickEmbed]}); }; diff --git a/commands/leaveguild.js b/commands/leaveguild.js index f88f0bb..00a97fc 100644 --- a/commands/leaveguild.js +++ b/commands/leaveguild.js @@ -19,7 +19,7 @@ * *************************************/ module.exports.run = async (client, message) => { 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...'); + await message.channel.send('Leaving server. If that\'s a mistake, you can re-invite me'); message.guild.leave(); }; diff --git a/commands/quote.js b/commands/quote.js index 481cc9b..81f9142 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -17,72 +17,33 @@ * along with this program. If not, see . * * *************************************/ -const mongo = require('../plugins/mongo'); -const quoteSchema = require('../schema/quote-schema'); 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 quoteDB = require('../models/quote'); const { MessageEmbed } = require('discord.js'); + let quoteID = args[0]; -// let NewQuote; -// let quo; - - let quoId; - let quoAuthor; - let quoAuthorImage; - 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); - - await message.channel.send({embeds:[embed]});*/ - console.log(quote); - } finally { - await mongoose.connection.close(); - } - }) - } else { - + if (quoteID === undefined) { + const quoteList = await quoteDB.findAll({ attributes: ['id'] }) + quoteID = Math.floor(Math.random() * (quoteList.length - 1)) + 1 } - /* + const quote = await quoteDB.findOne({ where: { id: quoteID } }) - function GetNewQuote(quoteNum = -1) { - NewQuote = new Discord.MessageEmbed(); - let quo = require('../storage/quotes.json').quotes + if (quote) { + const embed = new MessageEmbed() + .setAuthor({ name: quote.author, iconURL: quote.authorImage}) + .setDescription(quote.quote) + .setColor('#1fd619') + .setFooter('- ' + quote.year); - 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; - - NewQuote.setAuthor(author, authorImage); - NewQuote.setColor('#1fd619'); - NewQuote.setDescription(quote); - NewQuote.setFooter('- ' + year); - //NewQuote.setURL(url); - - return NewQuote; + await message.reply('Alright, here\'s your quote.') + await message.channel.send({embeds:[embed]}); + } else { + message.reply('Cannot find quote'); } - const newquote = GetNewQuote(); - message.reply('Alright, here\'s your quote.'); - await message.channel.send(newquote);*/ + }; exports.conf = { diff --git a/commands/setlogchannel.js b/commands/setlogchannel.js index 902a210..c04e926 100644 --- a/commands/setlogchannel.js +++ b/commands/setlogchannel.js @@ -17,36 +17,19 @@ * along with this program. If not, see . * * *************************************/ -const mongo = require('../plugins/mongo'); -const logSchema = require('../schema/logging-schema'); +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 cache = {} + const [ guild ] = await guildDB.findOrCreate({ where: { id: message.guild.id } } ) - if (!channel) return message.reply('I cannot find that channel, please specify...'); - - cache[message.guild.id] = channel - - await mongo().then(async (mongoose) => { - try { - await logSchema.findOneAndUpdate( - { - _id: message.guild.id, - }, - { - _id: message.guild.id, - logChannel: channel - }, - { - upsert: true - } - ) - } finally { - await mongoose.connection.close(); - } - }) + 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}>`); }; @@ -58,6 +41,6 @@ exports.conf = { exports.help = { name: 'setlogchannel', description: 'Set the log channel.', - usage: 'setlogchannel [channel id]', + usage: 'setlogchannel #channel', category: '- Moderation Commands', }; diff --git a/commands/setup.js b/commands/setup.js new file mode 100644 index 0000000..5c2f232 --- /dev/null +++ b/commands/setup.js @@ -0,0 +1,46 @@ +/**************************************** + * + * Setup: 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) => { + 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('Chat Logs', 'channelid', true) + .addField('Joining & Leaving Logs', 'placeholder', true) + .addField('Broadcast', 'placeholder', true) + .addField('Broadcast', 'placeholder', true); + + message.author.send({embeds: [setupEmbed]}); +}; + +exports.conf = { + aliases: [], + guildOnly: false, +}; +exports.help = { + name: 'setup', + description: 'Setting up AleeBot.', + usage: 'setup', + category: '- Settings Commands', +}; diff --git a/commands/uptime.js b/commands/uptime.js index 4753f70..7453ad5 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -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/deprecated/setup.js b/deprecated/setup.js deleted file mode 100644 index a86f850..0000000 --- a/deprecated/setup.js +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************** - * - * Setup: 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) => { - 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('Logs', 'channelid', 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/models/guild-settings.js b/models/guild-settings.js new file mode 100644 index 0000000..2e4f8ef --- /dev/null +++ b/models/guild-settings.js @@ -0,0 +1,24 @@ +const Sequelize = require("sequelize"); +const sequelize = require('../utils/sequelize'); + +const guildSettings = sequelize.define('guild-settings', { + id: { + type: Sequelize.STRING, + primaryKey: true + }, + logChannelID: { + type: Sequelize.STRING, + allowNull: true + }, + autoRoleToggle: { + type: Sequelize.BOOLEAN, + allowNull: true + }, + autoRoleID: { + type: Sequelize.STRING, + allowNull: true + } + +}) + +module.exports = guildSettings diff --git a/models/quote.js b/models/quote.js new file mode 100644 index 0000000..f31b472 --- /dev/null +++ b/models/quote.js @@ -0,0 +1,29 @@ +const Sequelize = require("sequelize"); +const sequelize = require('../utils/sequelize'); + +const quote = sequelize.define('quotes', { + id: { + type: Sequelize.INTEGER, + autoIncrement: true, + primaryKey: true + }, + author: { + type: Sequelize.STRING, + allowNull: false + }, + authorImage: { + type: Sequelize.STRING, + allowNull: false + }, + quote: { + type: Sequelize.TEXT, + allowNull: false + }, + year: { + type: Sequelize.STRING, + allowNull: false + } + +}) + +module.exports = quote diff --git a/package.json b/package.json index 0e34c8d..91c283c 100644 --- a/package.json +++ b/package.json @@ -9,19 +9,18 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/aleeproductions/AleeBot.git" + "url": "git+https://github.com/Alee14/AleeBot.git" }, - "author": "Alee Productions", + "author": "Andrew Lee", "license": "GPL-3.0", "bugs": { - "url": "https://github.com/aleeproductions/AleeBot/issues" + "url": "https://github.com/Alee14/AleeBot/issues" }, - "homepage": "https://github.com/aleeproductions/AleeBot#readme", + "homepage": "https://github.com/Alee14/AleeBot#readme", "dependencies": { "@top-gg/sdk": "^3.1.2", "blessed": "^0.1.81", "colors": "^1.3.0", - "discord-together": "^1.1.53", "discord.js": "^13.0.1", "eslint": "^7.1.0", "express": "^4.17.1", @@ -34,6 +33,8 @@ "os": "^0.1.1", "parse-ms": "^1.0.1", "readline": "^1.3.0", + "sequelize": "^6.30.0", + "sqlite3": "^5.1.6", "topgg-autoposter": "^2.0.0", "ytdl-core": "^0.20.4" }, diff --git a/plugins/mongo.js b/plugins/mongo.js deleted file mode 100644 index 0102aab..0000000 --- a/plugins/mongo.js +++ /dev/null @@ -1,10 +0,0 @@ -const mongoose = require('mongoose'); -const { mongoPath } = require('../tokens.json'); - -module.exports = async () => { - await mongoose.connect(mongoPath, { - useNewUrlParser: true, - useUnifiedTopology: true, - }); - return mongoose; -} \ No newline at end of file diff --git a/schema/logging-schema.js b/schema/logging-schema.js deleted file mode 100644 index 339c7f7..0000000 --- a/schema/logging-schema.js +++ /dev/null @@ -1,13 +0,0 @@ -const mongoose = require('mongoose') - -const reqString = { - type: String, - required: true -} - -const loggingSchema = mongoose.Schema({ - _id: reqString, - logChannel: reqString -}) - -module.exports = mongoose.model('logging', loggingSchema) \ No newline at end of file diff --git a/schema/quote-schema.js b/schema/quote-schema.js deleted file mode 100644 index d1c7db8..0000000 --- a/schema/quote-schema.js +++ /dev/null @@ -1,17 +0,0 @@ -const mongoose = require('mongoose'); - -const reqString = { - type: String, - required: true -} - -const quoteSchema = mongoose.Schema({ - quoteID: reqString, - author: reqString, - authorImage: reqString, - quote: reqString, - year: reqString - -}) - -module.exports = mongoose.model('quote', quoteSchema) \ No newline at end of file diff --git a/storage/activities.js b/storage/activities.js index 888c848..418a038 100644 --- a/storage/activities.js +++ b/storage/activities.js @@ -10,6 +10,9 @@ const activities = [ 'Breaking Windows 10', 'Beating up big tech', 'Deleting Google', + 'Deleting Apple', + 'Deleting System32', + 'Deleting /usr/bin/', 'Watering down the Apple walled garden', 'Reticulating splines', 'Generating world', @@ -33,15 +36,12 @@ const activities = [ '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', + 'Mac OS X Jaguar', 'Abunchoo 12.10', 'MikeOS', 'theBeat', @@ -65,6 +65,7 @@ const activities = [ 'Bluejay', 'Exposing TAS-Corp', 'Fighting Evelyn Claythorne', + 'Frying Dr. Sheridan', 'Hacking SherCorp', 'Games with Tari', 'Decommissioning Meta Runners', @@ -74,6 +75,25 @@ const activities = [ 'Apple Pay', 'Splatoon 3', 'Super Mario 64', + 'Minceraft', + 'Mario Kart 8', + 'bnbmc', + 'Evaluating JavaScript code', + 'Evaluating C# code', + 'Forkbombing FMP', + 'Merging with DLAP', + 'Now asbestos-free!', + 'May contain nuts!', + 'MythOS', + 'Also try Scratch!', + 'Funky!', + 'What is Web3?', + 'GNU\'s NOT UNIX!', + 'Linux, but actually GNU/Linux', + 'Praise RMS!', + 'Praying to St IGNUcius', + 'Debloating my ThinkPad', + 'Goddamn Idiotic Truckload of Windows', `Now running on Discord.JS ${version}!` ]; diff --git a/sync-database.js b/sync-database.js new file mode 100644 index 0000000..2462f29 --- /dev/null +++ b/sync-database.js @@ -0,0 +1,9 @@ +const quoteDB = require("./models/quote"); +const guildDB = require ('./models/guild-settings'); +quoteDB.sync({alter: true}).then(() => { + console.log('Quote database synced!') +}); + +guildDB.sync({alter: true}).then(() => { + console.log('Guild database synced!') +}); diff --git a/utils/sequelize.js b/utils/sequelize.js new file mode 100644 index 0000000..db18d50 --- /dev/null +++ b/utils/sequelize.js @@ -0,0 +1,9 @@ +const Sequelize = require("sequelize"); +const sequelize = new Sequelize('database', 'user', 'password', { + host: 'localhost', + dialect: 'sqlite', + logging: false, + storage: 'database.sqlite', +}); + +module.exports = sequelize; -- cgit v1.2.3