feat: initial prototype
Code Analysis / SonarQube (push) Failing after 19s
Node.js CI / Lint and Test (push) Has been cancelled

This commit is contained in:
2025-10-09 11:28:28 -07:00
parent 00cbbdab24
commit 68f7eabe2c
27 changed files with 6158 additions and 14 deletions
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import {
ChannelType,
type Message,
type OmitPartialGroupDMChannel,
} from "discord.js";
import { handleDmMessage } from "./handleDmMessage.js";
import { handleThreadMessage } from "./handleThreadMessage.js";
/**
* Handles the message event from Discord.
* @param message -- The message payload from Discord.
*/
export const onMessage = async(
message: OmitPartialGroupDMChannel<Message>,
): Promise<void> => {
if (message.channel.type === ChannelType.DM) {
await handleDmMessage(message);
return;
}
// This should not be true at this point, but we need to narrow this.
if (!message.inGuild()) {
return;
}
if (
message.channel.type === ChannelType.PublicThread
|| message.channel.type === ChannelType.PrivateThread
) {
await handleThreadMessage(message);
return;
}
void message;
};