Jump to content

So I'm trying to create a discord bot which uses a better sqlite3 table/database for a score counter. I can't seem to figure out how to save the data to a file. Here's a command that I tried to implement which uses the backup function. 

const { prefix } = require('../config.json');
const Discord = require("discord.js");
const bot = require('../bot.js');

module.exports = {
	name: 'backup',
	description: 'saves the database that stores all of the point values',
	aliases: ['save','savepoints','savescore'],
	usage: '[command name]',
    cooldown: 0,
    guildOnly : true,
	execute(message, args) {
        if (!message.author.id === 237697797745278976) return message.channel.send('You don\'t have the right permissions for that!');
        bot.sql.backup(`backup-${Date.now()}.sqlite`)
          .then(() => {
            console.log('backup complete!');
          })
          .catch((err) => {
            console.log('backup failed:', err);
          });
    }
};

FYI: I'm running this off a Github Repo with Heroku. IDK if that impacts anything

Link to comment
https://linustechtips.com/topic/1057282-better-sqlite3-question/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×