From dc323ffeb138b9175540437da89d1ebbc7079c04 Mon Sep 17 00:00:00 2001 From: Bradley Bickford Date: Sat, 11 Nov 2023 22:18:54 -0500 Subject: [PATCH] Some final cleanup, and README adjustments --- README.md | 2 +- breadbot.js | 18 ++++-------------- utilities/sqlutil.js | 2 -- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6877fdc..9d06fef 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ I have a subset of features that I want it to have before I call it "production - [ ] Add Autocomplete for common elements like Calendar Names, Event Names, Timezones, etc. - [ ] Calendar Announcements for Upcoming Events - [ ] Poll Creation and Results Announcements -- [ ] Conversation Archiving (May be Removed) +- [ ] Conversation Archiving (Partially working, need to work out edited messages, deleted messages, and attachments) "Adventurous (Lots of Work)" Features - [ ] BreadBot Voice Chat Hall Monitor diff --git a/breadbot.js b/breadbot.js index c77ab89..ab6c4e4 100644 --- a/breadbot.js +++ b/breadbot.js @@ -3,7 +3,6 @@ const path = require('node:path'); const { Client, Events, GatewayIntentBits, Collection } = require('discord.js'); const { token, mysql_username, mysql_password } = require('./config.json'); const sqlutil = require('./utilities/sqlutil'); -const { sql } = require('googleapis/build/src/apis/sql'); sqlutil.buildPool('breadbot_test') @@ -71,25 +70,16 @@ client.on(Events.GuildCreate, async guild => { console.log(`The server description is ${guild.description}`) console.log(`The server snowflake is ${guild.id}`) - sqlutil.isServerRegistered(guild.id).then(registered => { - if (!registered) { - console.log("Server is not registered") - - sqlutil.registerServer(guild.id, guild.name, guild.description).then(added => { - if (added) { - console.log("Server Registered") - } else { - console.log("Failed to register the server") - } - }) + sqlutil.registerServerIfMissing(guild.id, guild.name, guild.description).then(server_added => { + if(server_added) { + console.log(`Server Added ${guild.name}`) } else { - console.log("Server is already registered") + console.log(`Server failed to add ${guild.name}`) } }) } }) -// There is what too much async/await mess in here. Needs to be reworked client.on(Events.MessageCreate, async message => { console.log("Message Create Fired") diff --git a/utilities/sqlutil.js b/utilities/sqlutil.js index b06673b..9b9569d 100644 --- a/utilities/sqlutil.js +++ b/utilities/sqlutil.js @@ -1,8 +1,6 @@ const mysql = require('mysql2') const { mysql_username, mysql_password } = require('../config.json') -// TODO Some of the below functions are unnecessarily repetitious - var connection_pool = null async function buildPool(db_name) {