Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
LoV432 committed Feb 23, 2024
1 parent 6facb48 commit aacfb81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 0 additions & 18 deletions app/api/chat-logger/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@ type discordMessage = {
};
const config = getServersConfig();

if (!('err' in config) && config.global.chatLogger == true) {
try {
await db.execute(
`CREATE TABLE IF NOT EXISTS server_messages (
id INT AUTO_INCREMENT PRIMARY KEY,
time DATETIME,
team VARCHAR(50),
message TEXT,
ipAddress VARCHAR(15),
author_name VARCHAR(255),
author_id VARCHAR(255),
author_icon_url VARCHAR(255),
server_id INT
)`
);
} catch {}
}

const regexPattern =
/^\[(\d{2}-\d{2}-\d{4}) - (\d{2}:\d{2}:\d{2})\] \[(\w+)\] (.+) \(IpAddress: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)$/;
export async function POST(request: NextRequest) {
Expand Down
18 changes: 18 additions & 0 deletions app/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,21 @@ export const db = mysql
password: globalConfig.mysqlPassword
})
.promise();

if (!('err' in config) && config.global.chatLogger == true) {
try {
db.execute(
`CREATE TABLE IF NOT EXISTS server_messages (
id INT AUTO_INCREMENT PRIMARY KEY,
time DATETIME,
team VARCHAR(50),
message TEXT,
ipAddress VARCHAR(15),
author_name VARCHAR(255),
author_id VARCHAR(255),
author_icon_url VARCHAR(255),
server_id INT
)`
);
} catch {}
}

0 comments on commit aacfb81

Please sign in to comment.