javascriptdiscord.jsquick.db

Is there a way to make a discord.js logging system using quick.db


I am trying to make a discord.js logging system for my discord bot using quick.db

Whenever I restart it, anything sent BEFORE the restart will not be logged for any actions

I am currently trying this code

const Discord = require("discord.js")
const client = new Discord.Client()
const db = require("quick.db")

client.on('messageUpdate', (oldmessage, newmessage) => {
  const Embed = new Discord.MessageEmbed()
    .setTitle("Message eddited")
    .setDescription(`A message was eddited in ${newmessage.channel}\n\nOriginal Message: \`${oldmessage.content}\`\nNew message: \`${newmessage.content}\`\nMessage Author \`${newmessage.author.tag}\``)
    .setFooter("Logging System")
  const channelID = db.fetch(`${newmessage.guild.id}-logChannel`) // It is set as an ID
  if (channelID) {
    const channel = newmessage.guild.channels.cache.find(c => c.id == channelID)
    channel.send(Embed)
  }
})

Solution

  • Can you elaborate more? Also, try to use MongoDB or some other database and not quickdb. Quickdb is also very slow and insecure

    SQL:

    1. Cassandra
    2. Dynamo
    3. MySQL
    4. Maria
    5. Postgres
    6. PHYMyAdmin

    NoSQL (SQL better):

    1. Mongo
    2. Firestore
    3. REDIS