fix db types
This commit is contained in:
parent
f1ca08f577
commit
90132ed9c0
4 changed files with 8 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
hf.database.run(
|
||||
"CREATE TABLE IF NOT EXISTS guild_data (key STRING PRIMARY KEY, value STRING NOT NULL) WITHOUT ROWID"
|
||||
"CREATE TABLE IF NOT EXISTS guild_data (key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID"
|
||||
);
|
||||
|
||||
function setGuildData(id, key, value) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
hf.database.run(
|
||||
"CREATE TABLE IF NOT EXISTS user_data (key STRING PRIMARY KEY, value STRING NOT NULL) WITHOUT ROWID"
|
||||
"CREATE TABLE IF NOT EXISTS user_data (key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID"
|
||||
);
|
||||
|
||||
function setUserData(id, key, value) {
|
||||
|
|
|
@ -112,20 +112,18 @@ const VINBOARD_THREAD_ID = "1048462330201124935";
|
|||
const VINBOARD_WEBHOOK_ID = "1048471543287660665";
|
||||
|
||||
hf.database.run(
|
||||
"CREATE TABLE IF NOT EXISTS vinboard (message_id STRING NOT NULL PRIMARY KEY, count INTEGER NOT NULL, board_id STRING NOT NULL) WITHOUT ROWID"
|
||||
"CREATE TABLE IF NOT EXISTS vinboard (message_id TEXT NOT NULL PRIMARY KEY, count INTEGER NOT NULL, board_id TEXT NOT NULL) WITHOUT ROWID"
|
||||
);
|
||||
|
||||
function getBoardEntry(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
hf.database.run(
|
||||
hf.database.get(
|
||||
"SELECT message_id,count,board_id FROM vinboard WHERE message_id = $id",
|
||||
{
|
||||
$id: id,
|
||||
},
|
||||
function (err) {
|
||||
logger.debug("vinboard", JSON.stringify(arguments));
|
||||
(err, row) => {
|
||||
if (err == null) {
|
||||
logger.debug("vinboard", JSON.stringify(row));
|
||||
resolve(row);
|
||||
} else {
|
||||
reject(err);
|
||||
|
@ -316,8 +314,6 @@ async function processReaction(_msg, user, reaction) {
|
|||
const _boardMessage =
|
||||
board_channel.messages.get(dbEntry.board_id) ??
|
||||
(await board_channel.getMessage(dbEntry.board_id).catch(() => {}));
|
||||
logger.debug("vinboard", dbEntry.board_id);
|
||||
logger.debug("vinboard", JSON.stringify(_boardMessage));
|
||||
if (_boardMessage) {
|
||||
logger.verbose(
|
||||
"vinboard",
|
||||
|
@ -335,7 +331,6 @@ async function processReaction(_msg, user, reaction) {
|
|||
const boardMessage = await vinboard_webhook.execute(
|
||||
await createBoardMessage(msg, trueCount)
|
||||
);
|
||||
logger.debug("vinboard", JSON.stringify(boardMessage));
|
||||
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,7 @@ const reminderData = require(resolve(
|
|||
));
|
||||
|
||||
hf.database.run(
|
||||
"CREATE TABLE IF NOT EXISTS private_reminders (user STRING NOT NULL PRIMARY KEY, last_run STRING NOT NULL) WITHOUT ROWID"
|
||||
"CREATE TABLE IF NOT EXISTS private_reminders (user TEXT NOT NULL PRIMARY KEY, last_run TEXT NOT NULL) WITHOUT ROWID"
|
||||
);
|
||||
|
||||
function setLastRun(id, date) {
|
||||
|
@ -89,10 +89,10 @@ hf.bot.once("ready", () => {
|
|||
let [hour, minutes] = time.split(":");
|
||||
hour = parseInt(hour);
|
||||
minutes = parseInt(minutes);
|
||||
const lastRan = await getLastRun(data.user);
|
||||
const lastRan = new Date(await getLastRun(data.user)).getTime();
|
||||
|
||||
if (
|
||||
date != lastRan &&
|
||||
date > lastRan &&
|
||||
hour == data.hour &&
|
||||
minutes == 0 &&
|
||||
channel != null
|
||||
|
|
Loading…
Reference in a new issue