fix(plugin): start moderator reliably and colocate no-reply-api under plugin dir
This commit is contained in:
@@ -16,7 +16,7 @@ export function startNoReplyApi(
|
||||
return;
|
||||
}
|
||||
|
||||
const serverPath = path.resolve(pluginDir, "..", "no-reply-api", "server.mjs");
|
||||
const serverPath = path.resolve(pluginDir, "no-reply-api", "server.mjs");
|
||||
logger.info(`dirigent: resolved serverPath=${serverPath}`);
|
||||
|
||||
if (!fs.existsSync(serverPath)) {
|
||||
|
||||
@@ -77,22 +77,21 @@ export default {
|
||||
api.on("gateway_start", () => {
|
||||
api.logger.info(`dirigent: gateway_start event received`);
|
||||
|
||||
const live = getLivePluginConfig(api, baseConfig as DirigentConfig);
|
||||
|
||||
// Check no-reply-api server file exists
|
||||
const serverPath = path.resolve(pluginDir, "..", "no-reply-api", "server.mjs");
|
||||
const serverPath = path.resolve(pluginDir, "no-reply-api", "server.mjs");
|
||||
api.logger.info(`dirigent: checking no-reply-api server at ${serverPath}, exists=${fs.existsSync(serverPath)}`);
|
||||
|
||||
// Additional debug: list what's in the parent directory
|
||||
const parentDir = path.resolve(pluginDir, "..");
|
||||
// Additional debug: list what's in the plugin directory
|
||||
try {
|
||||
const entries = fs.readdirSync(parentDir);
|
||||
api.logger.info(`dirigent: parent dir (${parentDir}) entries: ${JSON.stringify(entries)}`);
|
||||
const entries = fs.readdirSync(pluginDir);
|
||||
api.logger.info(`dirigent: plugin dir (${pluginDir}) entries: ${JSON.stringify(entries)}`);
|
||||
} catch (e) {
|
||||
api.logger.warn(`dirigent: cannot read parent dir: ${String(e)}`);
|
||||
api.logger.warn(`dirigent: cannot read plugin dir: ${String(e)}`);
|
||||
}
|
||||
|
||||
startNoReplyApi(api.logger, pluginDir, Number(live.noReplyPort || 8787));
|
||||
|
||||
const live = getLivePluginConfig(api, baseConfig as DirigentConfig);
|
||||
api.logger.info(`dirigent: config loaded, moderatorBotToken=${live.moderatorBotToken ? "[set]" : "[not set]"}`);
|
||||
|
||||
if (live.moderatorBotToken) {
|
||||
|
||||
Reference in New Issue
Block a user