feat: auto-assign issues and prs to naomi
Node.js CI / Lint and Test (push) Successful in 42s

This commit is contained in:
2025-08-27 17:58:28 -07:00
parent c48242a141
commit 1b7f83f335
8 changed files with 874 additions and 9 deletions
+16 -1
View File
@@ -6,6 +6,7 @@
import { Client, GatewayIntentBits, Events, Partials } from "discord.js";
import { scheduleJob } from "node-schedule";
import { App } from "octokit";
import { handleMessageCreate } from "./events/handleMessageCreate.js";
import { cacheData } from "./modules/cacheData.js";
import {
@@ -18,6 +19,19 @@ import { instantiateServer } from "./server/serve.js";
import { logger } from "./utils/logger.js";
import type { Amari } from "./interfaces/amari.js";
if (process.env.GH_CLIENT_ID === undefined
|| process.env.GH_PRIVATE_KEY === undefined) {
throw new Error("Cannot initialise GitHub!");
}
const githubApp = new App({
appId: process.env.GH_CLIENT_ID,
privateKey: process.env.GH_PRIVATE_KEY.replaceAll("\\n", "\n"),
});
const octokit = await githubApp.getInstallationOctokit(83_119_105);
const { data } = await octokit.rest.apps.getAuthenticated();
await logger.log("debug", `Authenticated to GitHub as ${data?.name ?? "unknown"}`);
const amari: Amari = {
discord: new Client({ intents: [
GatewayIntentBits.Guilds,
@@ -27,6 +41,7 @@ const amari: Amari = {
GatewayIntentBits.DirectMessages,
],
partials: [ Partials.Channel ] }),
github: octokit,
lastRssItems: {
freeCodeCamp: null,
hackerNews: null,
@@ -66,4 +81,4 @@ amari.discord.on(Events.UserUpdate, (_oldUser, updatedUser) => {
});
await amari.discord.login(process.env.BOT_TOKEN);
instantiateServer();
instantiateServer(amari);