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:
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