-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 /setupコマンドでverifiedロールが存在する場合にsetupコマンドを中止するように修正 (backend/src/comm…
…ands/setup.ts)
- Loading branch information
1 parent
aea92bf
commit e41e598
Showing
1 changed file
with
46 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
import { | ||
Client, | ||
BaseCommandInteraction, | ||
MessageButton, | ||
MessageActionRow, | ||
Client, | ||
BaseCommandInteraction, | ||
MessageButton, | ||
MessageActionRow, | ||
} from "discord.js"; | ||
import { Command } from "../interface"; | ||
|
||
const cmd: Command = { | ||
data: { | ||
name: "setup", | ||
description: "Discord hCaptch認証のセットアップをします", | ||
defaultMemberPermissions: ["ADMINISTRATOR"], | ||
}, | ||
async execute(client: Client, interaction: BaseCommandInteraction) { | ||
const guild = interaction.guild; | ||
await interaction.reply({ | ||
content: "セットアップを開始します", | ||
ephemeral: true, | ||
}); | ||
const role = guild?.roles.cache.find((role) => role.name === "verified"); | ||
if (!role === undefined) { | ||
data: { | ||
name: "setup", | ||
description: "Discord hCaptch認証のセットアップをします", | ||
defaultMemberPermissions: ["ADMINISTRATOR"], | ||
}, | ||
async execute(client: Client, interaction: BaseCommandInteraction) { | ||
const guild = interaction.guild; | ||
await interaction.reply({ | ||
content: "セットアップを開始します", | ||
ephemeral: true, | ||
}); | ||
const role = guild?.roles.cache.find((role) => role.name === "verified"); | ||
if (!role === void 0) { | ||
await interaction.editReply({ | ||
content: | ||
"Verifiedロールが存在します\n認証ボタンを作成する場合は`/genbutton`コマンドを実行してください", | ||
}); | ||
return; | ||
} | ||
guild?.roles.create({ name: "verified" }); | ||
await interaction.editReply({ | ||
content: | ||
"Verifiedロールが存在します\n認証ボタンを作成する場合は`/genbutton`コマンドを実行してください", | ||
content: "ロールを作成しました", | ||
}); | ||
const button = new MessageButton() | ||
.setCustomId("verify") | ||
.setStyle("PRIMARY") | ||
.setLabel("認証") | ||
.setEmoji("✅"); | ||
await interaction.channel?.send({ | ||
embeds: [ | ||
{ | ||
title: "認証方法", | ||
description: "認証を行うには、以下のボタンを押してください", | ||
color: "RANDOM", | ||
timestamp: new Date(), | ||
footer: { | ||
text: "©️ HidemaruOwO | Discord hCaptcha", | ||
}, | ||
}, | ||
], | ||
components: [new MessageActionRow().addComponents(button)], | ||
}); | ||
return; | ||
} | ||
guild?.roles.create({ name: "verified" }); | ||
await interaction.editReply({ | ||
content: "ロールを作成しました", | ||
}); | ||
const button = new MessageButton() | ||
.setCustomId("verify") | ||
.setStyle("PRIMARY") | ||
.setLabel("認証") | ||
.setEmoji("✅"); | ||
await interaction.channel?.send({ | ||
embeds: [ | ||
{ | ||
title: "認証方法", | ||
description: "認証を行うには、以下のボタンを押してください", | ||
color: "RANDOM", | ||
timestamp: new Date(), | ||
footer: { | ||
text: "©️ HidemaruOwO | Discord hCaptcha", | ||
}, | ||
}, | ||
], | ||
components: [new MessageActionRow().addComponents(button)], | ||
}); | ||
await interaction.editReply({ content: "セットアップを完了しました" }); | ||
}, | ||
await interaction.editReply({ content: "セットアップを完了しました" }); | ||
}, | ||
}; | ||
|
||
export { cmd }; |
e41e598
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2