This commit is contained in:
James Shiffer 2024-02-06 16:48:58 -08:00
commit a68f632125
6 changed files with 35 additions and 26 deletions

2
.env
View File

@ -1 +1 @@
PORT=3000
PORT=5555

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
**/.env
**/*.js
**/*.js.map
**/nohup.out
# Logs
logs

View File

@ -16,6 +16,8 @@ import {
User
} from 'discord.js';
import { ChatMessage, llamacpp, streamText } from 'modelfusion';
import fetch from 'node-fetch';
import { JSDOM } from 'jsdom';
import { logError, logInfo } from '../logging';
import {
db,
@ -78,8 +80,8 @@ async function fetchMotd()
{
const res = await fetch(process.env.MOTD_HREF);
const xml = await res.text();
const parser = new DOMParser();
const doc = parser.parseFromString(xml, 'text/html');
const parser = new JSDOM(xml);
const doc = parser.window.document;
return doc.querySelector(process.env.MOTD_QUERY).textContent;
}

View File

@ -5,6 +5,8 @@
"discord.js": "^14.13.0",
"dotenv": "^16.3.1",
"modelfusion": "^0.135.1",
"jsdom": "^22.1.0",
"node-fetch": "^3.3.2",
"sqlite": "^5.0.1",
"sqlite3": "^5.1.6"
},

46
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "femleaderboard",
"version": "0.0.0",
"name": "femscoreboard",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "femleaderboard",
"version": "0.0.0",
"name": "femscoreboard",
"version": "1.0.0",
"dependencies": {
"dotenv": "^16.3.1",
"express": "^4.18.2",
@ -84,6 +84,25 @@
"node-pre-gyp": "bin/node-pre-gyp"
}
},
"node_modules/@mapbox/node-pre-gyp/node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/@npmcli/fs": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz",
@ -1319,25 +1338,6 @@
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="
},
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-gyp": {
"version": "8.4.1",
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",

4
start.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
nohup npm start &
cd discord
nohup npm start