呼び出すチャンネルを間違ってる場合の処理を追加
This commit is contained in:
9
main.go
9
main.go
@@ -49,6 +49,7 @@ func lookupWaitingUserIndex(userID string) int {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
discordToken := os.Getenv("DISCORD_TOKEN")
|
discordToken := os.Getenv("DISCORD_TOKEN")
|
||||||
|
discordChannelId := os.Getenv("DISCORD_CHANNEL_ID")
|
||||||
|
|
||||||
discord, err := discordgo.New("Bot " + discordToken)
|
discord, err := discordgo.New("Bot " + discordToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -61,6 +62,14 @@ func main() {
|
|||||||
})
|
})
|
||||||
discord.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
discord.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
if i.Type == discordgo.InteractionApplicationCommand {
|
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)
|
roles, _ := s.GuildRoles(i.GuildID)
|
||||||
var discordWaintingRoleId string
|
var discordWaintingRoleId string
|
||||||
for _, role := range roles {
|
for _, role := range roles {
|
||||||
|
|||||||
Reference in New Issue
Block a user