generated from nhcarrigan/template
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 1m17s
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
/**
|
|
* @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!",
|
|
});
|
|
}
|
|
};
|