rename openDb to openDB

This commit is contained in:
Alex 2021-05-23 22:10:11 -04:00
parent b4a6159dc4
commit dd26c7a45c
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import Discord from 'discord.js'
let db : Database | null = null;
export async function openDb () {
export async function openDB () {
if(db == null){
db = await open({
filename: './db/bot.db',
@ -22,13 +22,13 @@ export async function testDb(message: Discord.Message, command: string, args: st
await message.channel.send('no args');
return;
}
await openDb().then((db) => {
await openDB().then((db) => {
db.run('INSERT INTO saved_data (msg_id,data)' + 'VALUES(?,?)', [message.id, args[0]]);
});
await message.channel.send('Saved ' + args[0] + ' with id ' + message.id);
break;
case 'dump':
await openDb().then(async (db) => {
await openDB().then(async (db) => {
let flag: boolean = true;
let outEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
@ -53,7 +53,7 @@ export async function testDb(message: Discord.Message, command: string, args: st
});
break;
case 'clear':
openDb()
openDB()
.then((db) => {
return db.run('DELETE FROM saved_data');
})

View File

@ -3,7 +3,7 @@ dotenv.config();
import Discord from 'discord.js';
import _ from 'lodash';
import { openDb, testDb } from './components/db';
import { openDB, testDb } from './components/db';
import logger from './logger';
const NOTIF_CHANNEL_ID: string = process.env.NOTIF_CHANNEL_ID || '.';