-
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.
🐛 コマンドの条件分岐をしっかり動作するように修正 (backend/src/commands/genbutton.ts backend/…
…src/commands/genrole.ts backend/src/discord.ts)
- Loading branch information
1 parent
049f0fa
commit c23cdcb
Showing
3 changed files
with
230 additions
and
220 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,51 +1,52 @@ | ||
import { | ||
Client, | ||
BaseCommandInteraction, | ||
MessageButton, | ||
MessageActionRow, | ||
Client, | ||
BaseCommandInteraction, | ||
MessageButton, | ||
MessageActionRow, | ||
} from "discord.js"; | ||
import { Command } from "../interface"; | ||
|
||
const cmd: Command = { | ||
data: { | ||
name: "genbutton", | ||
description: "認証ボタンを作成します", | ||
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) { | ||
await interaction.editReply({ | ||
content: "Verifiedロールが存在しません", | ||
data: { | ||
name: "genbutton", | ||
description: "認証ボタンを作成します", | ||
defaultMemberPermissions: ["ADMINISTRATOR"], | ||
}, | ||
async execute(client: Client, interaction: BaseCommandInteraction) { | ||
const guild = interaction.guild; | ||
await interaction.reply({ | ||
content: "ボタンを作成します", | ||
ephemeral: true, | ||
}); | ||
return; | ||
} | ||
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: "ボタンを作成しました" }); | ||
}, | ||
const role = guild?.roles.cache.find((role) => role.name === "verified"); | ||
if (role === void 0) { | ||
await interaction.editReply({ | ||
content: | ||
"Verifiedロールが存在しません\n`/genrole`コマンドを実行して再度お試しください", | ||
}); | ||
return; | ||
} | ||
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: "ボタンを作成しました" }); | ||
}, | ||
}; | ||
|
||
export { cmd }; |
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
Oops, something went wrong.