generated from nhcarrigan/template
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ButtonBuilder,
|
ButtonBuilder,
|
||||||
ButtonStyle,
|
ButtonStyle,
|
||||||
|
type AnyThreadChannel,
|
||||||
type Message,
|
type Message,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import { personality } from "../config/personality.js";
|
import { personality } from "../config/personality.js";
|
||||||
@@ -21,20 +22,16 @@ import type { MessageParam } from "@anthropic-ai/sdk/resources/index.js";
|
|||||||
* @param message - The message payload from Discord.
|
* @param message - The message payload from Discord.
|
||||||
*/
|
*/
|
||||||
export const handleThreadMessage
|
export const handleThreadMessage
|
||||||
// eslint-disable-next-line max-lines-per-function, complexity, max-statements -- We're off by one bloody line.
|
// eslint-disable-next-line max-lines-per-function, max-statements -- We're off by one bloody line.
|
||||||
= async(message: Message<true>): Promise<void> => {
|
= async(message: Message<true>): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
|
// @ts-expect-error -- This is a workaround to get the channel type.
|
||||||
|
const channel: AnyThreadChannel = message.channel;
|
||||||
if (message.author.bot) {
|
if (message.author.bot) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const starter = await message.thread?.fetchStarterMessage();
|
const owner = await channel.fetchOwner();
|
||||||
const mentionsKeiko = starter?.mentions.has("1425897287065800785", {
|
if (owner?.id !== "1425897287065800785") {
|
||||||
ignoreDirect: false,
|
|
||||||
ignoreEveryone: true,
|
|
||||||
ignoreRepliedUser: true,
|
|
||||||
ignoreRoles: true,
|
|
||||||
});
|
|
||||||
if (mentionsKeiko !== true) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isNaomi = await isNaomiMessage(message);
|
const isNaomi = await isNaomiMessage(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user