generated from nhcarrigan/template
feat: build out discord support agent
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 1m17s
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 1m17s
This commit is contained in:
58
bot/prod/commands/about.js
Normal file
58
bot/prod/commands/about.js
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { TextDisplayBuilder, SeparatorBuilder, SeparatorSpacingSize, ContainerBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, MessageFlags, } from "discord.js";
|
||||
import { errorHandler } from "../utils/errorHandler.js";
|
||||
/**
|
||||
* Handles the `/about` command interaction.
|
||||
* @param _hikari - Hikari's Discord instance (unused).
|
||||
* @param interaction - The command interaction payload from Discord.
|
||||
*/
|
||||
// eslint-disable-next-line max-lines-per-function -- It's mostly components.
|
||||
export const about = async (_hikari, interaction) => {
|
||||
try {
|
||||
const components = [
|
||||
new ContainerBuilder().
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent("# About Hikari")).
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent(
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"Hi there~! I am Hikari, an AI agent specifically tailored to help you understand and use NHCarrigan's products!")).
|
||||
addSeparatorComponents(new SeparatorBuilder().
|
||||
setSpacing(SeparatorSpacingSize.Small).
|
||||
setDivider(true)).
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent("## What can I do?")).
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent(
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"To get started, you will need to purchase the user subscription from my Discord store. Then you can send me a direct message to ask questions about NHCarrigan's work.\n\nIf you cannot find our DM channel, run the `/dm` command and I will ping you!")).
|
||||
addSeparatorComponents(new SeparatorBuilder().
|
||||
setSpacing(SeparatorSpacingSize.Small).
|
||||
setDivider(true)).
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent("## What if I need more help?")).
|
||||
addTextDisplayComponents(new TextDisplayBuilder().setContent(
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"My deepest apologies! I am not perfect, though I do try my best. If you have a question that I just cannot answer, you should save yourself some time and reach out to the team via one of the support channels!")),
|
||||
new ActionRowBuilder().addComponents(new ButtonBuilder().
|
||||
setStyle(ButtonStyle.Link).
|
||||
setLabel("Discord Server").
|
||||
setURL("https://chat.nhcarrigan.com"), new ButtonBuilder().
|
||||
setStyle(ButtonStyle.Link).
|
||||
setLabel("Forum").
|
||||
setURL("https://forum.nhcarrigan.com")),
|
||||
];
|
||||
await interaction.reply({
|
||||
components,
|
||||
flags: MessageFlags.IsComponentsV2,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
await errorHandler(error, "about command");
|
||||
await interaction.reply({
|
||||
content:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"An error occurred while processing your request. Please try again later.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
};
|
35
bot/prod/commands/dm.js
Normal file
35
bot/prod/commands/dm.js
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { errorHandler } from "../utils/errorHandler.js";
|
||||
/**
|
||||
* Handles the `/dm` command interaction.
|
||||
* @param _hikari - Hikari's Discord instance (unused).
|
||||
* @param interaction - The command interaction payload from Discord.
|
||||
*/
|
||||
export const dm = async (_hikari, interaction) => {
|
||||
try {
|
||||
await interaction.deferReply({
|
||||
ephemeral: true,
|
||||
});
|
||||
const dmSent = await interaction.user.send({
|
||||
content: "Hello! You can now ask me questions directly in this DM channel.",
|
||||
});
|
||||
await dmSent.delete();
|
||||
await interaction.editReply({
|
||||
content:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"I have highlighted your DM channel. You can now ask me questions directly there!",
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
await errorHandler(error, "dm command");
|
||||
await interaction.editReply({
|
||||
content:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
"Oh dear! It looks like I might not be able to DM you. You may need to install me directly to your user account!",
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user