mirror of
https://github.com/arthur-pbty/selfbot-discord.git
synced 2026-06-23 18:04:51 +02:00
update
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import sqlite3 from 'sqlite3';
|
||||
require('dotenv').config();
|
||||
|
||||
function getPrefix() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dbName = process.env.DB_NAME || 'db.db';
|
||||
|
||||
let db = new sqlite3.Database(dbName, sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, (err: Error | null) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
db.get('SELECT prefix FROM prefix', (err: Error | null, row: any) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
reject(err);
|
||||
}
|
||||
const prefix = row ? row.prefix : process.env.DEFAULT_PREFIX;
|
||||
resolve(prefix);
|
||||
});
|
||||
|
||||
db.close((err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = getPrefix;
|
||||
Reference in New Issue
Block a user