windsor-bot 0.1.6 → 0.1.8

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/dist/web/app.js CHANGED
@@ -105,7 +105,7 @@ function BotSetup({ config, onSave }) {
105
105
  setSaving(false);
106
106
  }
107
107
  }
108
- return (_jsxs("section", { style: S.box, children: [_jsx("h2", { style: { marginTop: 0 }, children: "Bot Setup" }), config && _jsxs("p", { style: { color: '#b4bdc8', marginTop: 0 }, children: ["Config: ", config.configPath] }), err && _jsx("p", { style: S.err, children: err }), msg && _jsx("p", { style: S.ok, children: msg }), _jsx(Field, { label: "Discord Token", value: discordToken, onChange: setDiscordToken, placeholder: "Discord bot token" }), _jsx(Field, { label: "Server ID (required)", value: serverId, onChange: setServerId, placeholder: "Required \u2014 Discord server ID" }), _jsx(Field, { label: "OpenAI Key", value: openaiKey, onChange: setOpenaiKey, placeholder: "OpenAI API key" }), _jsx(Field, { label: "Diagnostics Port", type: "number", value: diagnosticsPort, onChange: setDiagnosticsPort, placeholder: "8080" }), _jsx("button", { style: S.btn, onClick: () => void save(), disabled: saving, children: saving ? 'Saving…' : 'Save' })] }));
108
+ return (_jsxs("section", { style: S.box, children: [_jsx("h2", { style: { marginTop: 0 }, children: "Bot Setup" }), config && _jsxs("p", { style: { color: '#b4bdc8', marginTop: 0 }, children: ["Config: ", config.configPath] }), err && _jsx("p", { style: S.err, children: err }), msg && _jsx("p", { style: S.ok, children: msg }), _jsx(Field, { label: "Discord Token", value: discordToken, onChange: setDiscordToken, placeholder: makeFakeDiscordToken() }), _jsx(Field, { label: "Server ID", value: serverId, onChange: setServerId, placeholder: makeFakeServerID() }), _jsx(Field, { label: "OpenAI Key (optional)", value: openaiKey, onChange: setOpenaiKey, placeholder: "OpenAI API key" }), _jsx(Field, { label: "Diagnostics Port", type: "number", value: diagnosticsPort, onChange: setDiagnosticsPort, placeholder: "8080" }), _jsx("button", { style: S.btn, onClick: () => void save(), disabled: saving, children: saving ? 'Saving…' : 'Save' })] }));
109
109
  }
110
110
  function ChannelBehaviors({ refreshKey }) {
111
111
  const [data, setData] = useState(null);
@@ -319,6 +319,25 @@ function App() {
319
319
  }
320
320
  return (_jsxs("main", { style: { maxWidth: '860px', margin: '0 auto', padding: '24px' }, children: [_jsx("h1", { style: { marginTop: 0 }, children: "\uD83D\uDDA8\uFE0F Windsor Control Panel" }), _jsx(BotSetup, { config: config, onSave: handleSave }), _jsx(ChannelBehaviors, { refreshKey: refreshKey }), _jsx(PrintModeSection, {}), _jsx(SecuritySection, { onSave: () => void loadConfig() }), _jsx(LogSection, {}), _jsx(RestartSection, {})] }));
321
321
  }
322
+ const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
323
+ const Numeric = "0123456789";
324
+ function randomChars(alphabet, length) {
325
+ let out = "";
326
+ for (let i = 0; i < length; i++) {
327
+ out += alphabet[Math.floor(Math.random() * alphabet.length)];
328
+ }
329
+ return out;
330
+ }
331
+ function makeFakeDiscordToken() {
332
+ return [
333
+ randomChars(Base64, 24),
334
+ randomChars(Base64, 6),
335
+ randomChars(Base64, 32),
336
+ ].join(".");
337
+ }
338
+ function makeFakeServerID() {
339
+ return randomChars(Numeric, 14);
340
+ }
322
341
  const root = document.getElementById('app');
323
342
  if (!root)
324
343
  throw new Error('Missing #app');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windsor-bot",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Self-hosted Discord bot automation for household list and todo printing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,8 @@
8
8
  "prepare": "npm run build",
9
9
  "build": "tsc && node scripts/build-web.mjs",
10
10
  "dev": "node src/index.ts",
11
- "test": "node --test src/tests/*.test.ts"
11
+ "test": "node --test src/tests/*.test.ts",
12
+ "generate-wordsearches": "node scripts/generate-wordsearches.mjs"
12
13
  },
13
14
  "bin": {
14
15
  "windsor-bot": "dist/index.js"