Skip to content

Commit ce714f9

Browse files
committed
use defered reply
1 parent beadc45 commit ce714f9

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

commands/owner/createRoles.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,31 @@ export default {
1515
requiredPermissions: ["MANAGE_GUILD", "MANAGE_ROLES"],
1616
ownerOnly: true,
1717

18-
callback: async ({ interaction }) => {
18+
callback: async ({ client, interaction: msgInt }) => {
1919
console.log(chalk.green("Creating roles..."));
2020
console.log(
2121
chalk.red("------------------------------------------------------")
2222
);
23-
if (interaction.guild === null) {
23+
if (msgInt.guild === null) {
2424
return;
2525
}
26+
await msgInt.deferReply({ ephemeral: true });
27+
2628
// Create the roles
27-
await createRoles(interaction.guild, classModel);
28-
await createRoles(interaction.guild, staffModel);
29-
await createRoles(interaction.guild, yearModel);
30-
interaction.reply({
29+
await createRoles(msgInt.guild, classModel);
30+
await createRoles(msgInt.guild, staffModel);
31+
await createRoles(msgInt.guild, yearModel);
32+
msgInt.editReply({
3133
content: "Roles created!",
32-
ephemeral: true,
3334
});
3435

3536
// Log the command usage
3637
console.log(
3738
chalk.blue(
3839
`${chalk.green(`[COMMAND]`)} ${chalk.yellow(
39-
interaction.user.tag
40-
)} used the ${chalk.green(`/yearPoll`)} command in ${chalk.yellow(
41-
interaction.guild?.name
40+
msgInt.user.tag
41+
)} used the ${chalk.green(`/createRoles`)} command in ${chalk.yellow(
42+
msgInt.guild?.name
4243
)}`
4344
)
4445
);

0 commit comments

Comments
 (0)