Skip to content

Commit

Permalink
remove unneeded columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Sep 4, 2024
1 parent 88e834d commit 01de098
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/services/Markov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,16 @@ class MarkovChain extends MarkovChainBase {
}

ready(): void {
this.db.run(
"CREATE TABLE IF NOT EXISTS markov (`timestamp` DATETIME, `authorID` VARCHAR(255), `authorName` VARCHAR(255), `message` VARCHAR(255));"
);
this.db.run("CREATE TABLE IF NOT EXISTS markov (`message` VARCHAR(255));");
}

learn(data: ILearnData): Promise<void> {
return new Promise<void>((resolve, reject) => {
data.message = data.message.trim().replace(/\s+/g, " "); // standardise whitespace

this.db.run(
"INSERT INTO markov VALUES ($timestamp, $authorID, $authorName, $message)",
"INSERT INTO markov VALUES ($message)",
{
$timestamp: Math.round((data.timestamp || Date.now()) / 1000),
$authorID: data.authorID,
$authorName: data.authorName,
$message: data.message,
},
err => {
Expand Down

0 comments on commit 01de098

Please sign in to comment.