From 8cab479d1154f264fd8d3ad9381e8a0a83617fce Mon Sep 17 00:00:00 2001 From: sirrow Date: Sun, 31 Aug 2025 13:13:00 +0900 Subject: [PATCH] =?UTF-8?q?=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=99=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=83=8D=E3=83=AB=E3=82=92=E9=96=93=E9=81=95?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 535defe..df590d4 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ func lookupWaitingUserIndex(userID string) int { func main() { discordToken := os.Getenv("DISCORD_TOKEN") + discordChannelId := os.Getenv("DISCORD_CHANNEL_ID") discord, err := discordgo.New("Bot " + discordToken) if err != nil { @@ -61,6 +62,14 @@ func main() { }) discord.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) { if i.Type == discordgo.InteractionApplicationCommand { + if i.ChannelID != discordChannelId { + s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + Type: discordgo.InteractionResponseChannelMessageWithSource, + Data: &discordgo.InteractionResponseData{ + Content: "コマンドを使うチャンネルを間違ってますよ。", + }, + }) + } roles, _ := s.GuildRoles(i.GuildID) var discordWaintingRoleId string for _, role := range roles {