feat: merge forward-to-owner context command (#13)

# Conflicts:
#	src/index.ts
This commit is contained in:
2026-03-03 10:58:55 -08:00
4 changed files with 159 additions and 10 deletions
+31 -10
View File
@@ -16,6 +16,7 @@ import { scheduleJob } from "node-schedule";
import { App } from "octokit";
import { createIssue } from "./commands/createIssue.js";
import { createTask } from "./commands/createTask.js";
import { forwardOwnerDM } from "./commands/forwardToOwner.js";
import { onboardMentee } from "./commands/onboardMentee.js";
import { ids } from "./config/ids.js";
import { handleMessageCreate } from "./events/handleMessageCreate.js";
@@ -44,6 +45,7 @@ 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(
@@ -91,12 +93,18 @@ amari.discord.once(Events.ClientReady, () => {
scheduleJob("post progress reminders", "0 9 * * 1-5", async() => {
await postProgressReminders(amari);
});
setInterval(() => {
amari.recentlyActiveChannels = new Set<string>();
}, 10 * 60 * 1000);
setInterval(() => {
void checkRetroAchievements(amari);
}, 10 * 60 * 1000);
setInterval(
() => {
amari.recentlyActiveChannels = new Set<string>();
},
10 * 60 * 1000,
);
setInterval(
() => {
void checkRetroAchievements(amari);
},
10 * 60 * 1000,
);
});
amari.discord.on(Events.MessageCreate, (message) => {
@@ -109,14 +117,26 @@ amari.discord.on(Events.MessageCreate, (message) => {
amari.discord.on(Events.InteractionCreate, (interaction) => {
void analytics.logGatewayEvent(Events.InteractionCreate, { ...interaction });
if (
interaction.isMessageContextMenuCommand()
&& interaction.commandName === "Forward to Naomi"
) {
void forwardOwnerDM.execute(interaction);
return;
}
if (interaction.isButton() && interaction.customId === "resolve") {
if (interaction.user.id !== ids.users.naomi) {
return void interaction.reply({
void interaction.reply({
content: "Who are you????",
flags: [ MessageFlags.Ephemeral ],
});
return;
}
return void interaction.message.delete();
void interaction.message.delete();
return;
}
if (interaction.isChatInputCommand()) {
const { commandName } = interaction;
@@ -131,9 +151,10 @@ amari.discord.on(Events.InteractionCreate, (interaction) => {
}
}
if (interaction.isAutocomplete()) {
return void interaction;
void interaction;
return;
}
return void interaction.reply({
void interaction.reply({
content: "What?",
flags: [ MessageFlags.Ephemeral ],
});