From a7910e5f7898e6b8fd303ad9d9ae3e7981a2f200 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 23 Aug 2024 09:57:03 +0000 Subject: [PATCH] change how restart works - no longer uses systemctl --- commands/restart.js | 2 +- commands/toggle.js | 15 ++++++++++----- modules/fedimbed.js | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/commands/restart.js b/commands/restart.js index afcf713..4ab9f04 100644 --- a/commands/restart.js +++ b/commands/restart.js @@ -1,7 +1,7 @@ import { exec } from "node:child_process"; function execute(client, event, args) { - exec("systemctl restart possumbot"); + process.exit(255); } export default { diff --git a/commands/toggle.js b/commands/toggle.js index 63bfda8..0b3fe54 100644 --- a/commands/toggle.js +++ b/commands/toggle.js @@ -22,17 +22,22 @@ function execute(client, event, args) { var state = (config[module.name] ? "En" : "Dis") + "abled"; - var reply = state + " " + module.name + "\n"; - var replyHTML = `${state} ${encode(module.name)}
`; + var reply = state + " " + module.name; + var replyHTML = `${state} ${encode(module.name)}`; client.cache.set(event.sender.roomId, config); client.reply(event, reply, replyHTML); return; } - var enabled = client.modules.map(m => "[" + (config[m.name] !== false ? "x" : " ") + "] " + m.name); - var reply = `enabled modules:\n${enabled.join("\n")}`; - var replyHTML = `enabled modules:
${enabled.join("
")}`; + var modules = client.modules.map(m=>m.name); + var enabled = modules.filter(m=>config[m]!==false); + + var reply = `enabled modules:\n${enabled.join(", ")}`; + var replyHTML = `enabled modules:
${enabled.join(", ")}`; + + reply += `\navailable modules:\n${modules.join(", ")}`; + replyHTML += `
available modules:
${modules.join(", ")}`; client.reply(event, reply, replyHTML); } diff --git a/modules/fedimbed.js b/modules/fedimbed.js index 37a6927..102b3d1 100644 --- a/modules/fedimbed.js +++ b/modules/fedimbed.js @@ -14,6 +14,7 @@ async function onMessage(client, event) { client.reply(event, c, `
${encode(c)}
`); return; } + for(const emb of embed.embeds) { var link = document.createElement("a"); link.href = emb.url;