windsor-bot 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/poker/README.txt +6 -0
- package/assets/poker/club.svg +11 -0
- package/assets/poker/diamond.svg +8 -0
- package/assets/poker/heart.svg +9 -0
- package/assets/poker/spade.svg +9 -0
- package/dist/bot.js +109 -16
- package/dist/commands/index.js +2 -0
- package/dist/commands/poker.js +139 -0
- package/dist/index.js +9 -17
- package/dist/printing/index.js +39 -13
- package/dist/reactions.js +2 -1
- package/dist/server.js +52 -0
- package/dist/tests/config.test.js +8 -1
- package/dist/tests/poker.test.js +12 -0
- package/dist/tests/urls.test.js +11 -1
- package/dist/web/app.bundle.js +42 -2
- package/dist/web/app.js +41 -1
- package/package.json +2 -1
package/dist/web/app.js
CHANGED
|
@@ -290,6 +290,14 @@ function RestartSection() {
|
|
|
290
290
|
const [msg, setMsg] = useState('');
|
|
291
291
|
const [err, setErr] = useState('');
|
|
292
292
|
const [restarting, setRestarting] = useState(false);
|
|
293
|
+
const [updating, setUpdating] = useState(false);
|
|
294
|
+
const [hardRestarting, setHardRestarting] = useState(false);
|
|
295
|
+
const [version, setVersion] = useState(null);
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
void apiFetch('/api/version')
|
|
298
|
+
.then(data => setVersion(data.version))
|
|
299
|
+
.catch(e => setErr(e instanceof Error ? e.message : String(e)));
|
|
300
|
+
}, []);
|
|
293
301
|
async function restart() {
|
|
294
302
|
setRestarting(true);
|
|
295
303
|
setErr('');
|
|
@@ -303,7 +311,39 @@ function RestartSection() {
|
|
|
303
311
|
setRestarting(false);
|
|
304
312
|
}
|
|
305
313
|
}
|
|
306
|
-
|
|
314
|
+
async function update() {
|
|
315
|
+
setUpdating(true);
|
|
316
|
+
setErr('');
|
|
317
|
+
setMsg('');
|
|
318
|
+
try {
|
|
319
|
+
const data = await jsonPost('/api/update', {});
|
|
320
|
+
setVersion(data.version);
|
|
321
|
+
window.alert(`Windsor bot updated to version ${data.version}.`);
|
|
322
|
+
setMsg(`Updated to version ${data.version}.`);
|
|
323
|
+
}
|
|
324
|
+
catch (e) {
|
|
325
|
+
setErr(e instanceof Error ? e.message : String(e));
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
setUpdating(false);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
async function hardRestart() {
|
|
332
|
+
if (!window.confirm('Hard reboot the server now? The current process will be killed.'))
|
|
333
|
+
return;
|
|
334
|
+
setHardRestarting(true);
|
|
335
|
+
setErr('');
|
|
336
|
+
setMsg('');
|
|
337
|
+
try {
|
|
338
|
+
await jsonPost('/api/hard-restart', {});
|
|
339
|
+
setMsg('Hard reboot started.');
|
|
340
|
+
}
|
|
341
|
+
catch (e) {
|
|
342
|
+
setErr(e instanceof Error ? e.message : String(e));
|
|
343
|
+
setHardRestarting(false);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return (_jsxs("section", { style: S.box, children: [_jsx("h2", { style: { marginTop: 0 }, children: "Server Control" }), _jsxs("p", { children: ["Version: ", _jsx("span", { style: S.mono, children: version ?? 'Loading…' })] }), err && _jsx("p", { style: S.err, children: err }), msg && _jsx("p", { style: S.ok, children: msg }), _jsx("button", { style: { ...S.btn, background: '#8a6d00' }, onClick: () => void restart(), disabled: restarting, children: restarting ? 'Restarting…' : 'Restart Server' }), _jsx("button", { style: S.btn, onClick: () => void update(), disabled: updating, children: updating ? 'Updating…' : 'Update Bot' }), _jsx("button", { style: { ...S.btn, background: '#c0392b' }, onClick: () => void hardRestart(), disabled: hardRestarting, children: hardRestarting ? 'Rebooting…' : 'Hard Reboot' })] }));
|
|
307
347
|
}
|
|
308
348
|
function App() {
|
|
309
349
|
const [config, setConfig] = useState(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windsor-bot",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Self-hosted Discord bot automation for household list and todo printing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"typescript": "^7.0.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
39
40
|
"@types/pdfkit": "^0.17.6",
|
|
40
41
|
"@types/qrcode": "^1.5.6",
|
|
41
42
|
"discord.js": "^14.27.0",
|