Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit e41e598

Browse files
committed
🐛 /setupコマンドでverifiedロールが存在する場合にsetupコマンドを中止するように修正 (backend/src/commands/setup.ts)
1 parent aea92bf commit e41e598

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

backend/src/commands/setup.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
import {
2-
Client,
3-
BaseCommandInteraction,
4-
MessageButton,
5-
MessageActionRow,
2+
Client,
3+
BaseCommandInteraction,
4+
MessageButton,
5+
MessageActionRow,
66
} from "discord.js";
77
import { Command } from "../interface";
88

99
const cmd: Command = {
10-
data: {
11-
name: "setup",
12-
description: "Discord hCaptch認証のセットアップをします",
13-
defaultMemberPermissions: ["ADMINISTRATOR"],
14-
},
15-
async execute(client: Client, interaction: BaseCommandInteraction) {
16-
const guild = interaction.guild;
17-
await interaction.reply({
18-
content: "セットアップを開始します",
19-
ephemeral: true,
20-
});
21-
const role = guild?.roles.cache.find((role) => role.name === "verified");
22-
if (!role === undefined) {
10+
data: {
11+
name: "setup",
12+
description: "Discord hCaptch認証のセットアップをします",
13+
defaultMemberPermissions: ["ADMINISTRATOR"],
14+
},
15+
async execute(client: Client, interaction: BaseCommandInteraction) {
16+
const guild = interaction.guild;
17+
await interaction.reply({
18+
content: "セットアップを開始します",
19+
ephemeral: true,
20+
});
21+
const role = guild?.roles.cache.find((role) => role.name === "verified");
22+
if (!role === void 0) {
23+
await interaction.editReply({
24+
content:
25+
"Verifiedロールが存在します\n認証ボタンを作成する場合は`/genbutton`コマンドを実行してください",
26+
});
27+
return;
28+
}
29+
guild?.roles.create({ name: "verified" });
2330
await interaction.editReply({
24-
content:
25-
"Verifiedロールが存在します\n認証ボタンを作成する場合は`/genbutton`コマンドを実行してください",
31+
content: "ロールを作成しました",
32+
});
33+
const button = new MessageButton()
34+
.setCustomId("verify")
35+
.setStyle("PRIMARY")
36+
.setLabel("認証")
37+
.setEmoji("✅");
38+
await interaction.channel?.send({
39+
embeds: [
40+
{
41+
title: "認証方法",
42+
description: "認証を行うには、以下のボタンを押してください",
43+
color: "RANDOM",
44+
timestamp: new Date(),
45+
footer: {
46+
text: "©️ HidemaruOwO | Discord hCaptcha",
47+
},
48+
},
49+
],
50+
components: [new MessageActionRow().addComponents(button)],
2651
});
27-
return;
28-
}
29-
guild?.roles.create({ name: "verified" });
30-
await interaction.editReply({
31-
content: "ロールを作成しました",
32-
});
33-
const button = new MessageButton()
34-
.setCustomId("verify")
35-
.setStyle("PRIMARY")
36-
.setLabel("認証")
37-
.setEmoji("✅");
38-
await interaction.channel?.send({
39-
embeds: [
40-
{
41-
title: "認証方法",
42-
description: "認証を行うには、以下のボタンを押してください",
43-
color: "RANDOM",
44-
timestamp: new Date(),
45-
footer: {
46-
text: "©️ HidemaruOwO | Discord hCaptcha",
47-
},
48-
},
49-
],
50-
components: [new MessageActionRow().addComponents(button)],
51-
});
52-
await interaction.editReply({ content: "セットアップを完了しました" });
53-
},
52+
await interaction.editReply({ content: "セットアップを完了しました" });
53+
},
5454
};
5555

5656
export { cmd };

0 commit comments

Comments
 (0)