translate message
This commit is contained in:
24
main.go
24
main.go
@@ -48,8 +48,6 @@ func lookupWaitingUserIndex(userID string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
//discordServerId := os.Getenv("DISCORD_SERVER_ID")
|
|
||||||
//discordChannelId := os.Getenv("DISCORD_CHANNEL_ID")
|
|
||||||
discordToken := os.Getenv("DISCORD_TOKEN")
|
discordToken := os.Getenv("DISCORD_TOKEN")
|
||||||
|
|
||||||
discord, err := discordgo.New("Bot " + discordToken)
|
discord, err := discordgo.New("Bot " + discordToken)
|
||||||
@@ -92,7 +90,7 @@ func main() {
|
|||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
Content: "User " + i.Member.User.Username + " added to waiting list. ",
|
Content: i.Member.User.Username + " を待機リストに追加しました。",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -102,7 +100,7 @@ func main() {
|
|||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
Content: "User " + i.Member.User.Username + " is already in the waiting list and extend waiting time.",
|
Content: i.Member.User.Username + " の待機時間を延長しました。",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -111,7 +109,7 @@ func main() {
|
|||||||
// Handle waitlistshow command
|
// Handle waitlistshow command
|
||||||
var waitingUsersStr []string
|
var waitingUsersStr []string
|
||||||
for _, user := range WaitingUsersList {
|
for _, user := range WaitingUsersList {
|
||||||
waitingUsersStr = append(waitingUsersStr, user.Username)
|
waitingUsersStr = append(waitingUsersStr, user.Username+" ("+user.EndAt.Format("15:04")+"まで)")
|
||||||
}
|
}
|
||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
@@ -130,14 +128,14 @@ func main() {
|
|||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
Content: "User " + userName + " removed from waiting list.",
|
Content: userName + " を待機リストから削除しました。",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
Content: "User " + userName + " is not in the waiting list.",
|
Content: userName + " は待機リストにいません。",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -152,7 +150,7 @@ func main() {
|
|||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
Content: "All users removed from waiting list.",
|
Content: "全員を待機リストから削除しました。",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -166,23 +164,23 @@ func main() {
|
|||||||
// define command to wait
|
// define command to wait
|
||||||
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||||
Name: "waitlistadd",
|
Name: "waitlistadd",
|
||||||
Description: "Add a user to the waiting list",
|
Description: "待機リストに自分を追加する",
|
||||||
Options: []*discordgo.ApplicationCommandOption{},
|
Options: []*discordgo.ApplicationCommandOption{},
|
||||||
})
|
})
|
||||||
|
|
||||||
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||||
Name: "waitlistshow",
|
Name: "waitlistshow",
|
||||||
Description: "Show the waiting list",
|
Description: "待機リストを表示する",
|
||||||
Options: []*discordgo.ApplicationCommandOption{},
|
Options: []*discordgo.ApplicationCommandOption{},
|
||||||
})
|
})
|
||||||
|
|
||||||
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||||
Name: "waitlistremove",
|
Name: "waitlistremove",
|
||||||
Description: "Remove a user from the waiting list",
|
Description: "待機リストからユーザーを削除する",
|
||||||
Options: []*discordgo.ApplicationCommandOption{
|
Options: []*discordgo.ApplicationCommandOption{
|
||||||
{
|
{
|
||||||
Name: "user",
|
Name: "user",
|
||||||
Description: "The user to remove from the waiting list",
|
Description: "待機リストから削除するユーザー",
|
||||||
Type: discordgo.ApplicationCommandOptionUser,
|
Type: discordgo.ApplicationCommandOptionUser,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
@@ -191,7 +189,7 @@ func main() {
|
|||||||
|
|
||||||
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
discord.ApplicationCommandCreate(discord.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||||
Name: "waitlistremoveall",
|
Name: "waitlistremoveall",
|
||||||
Description: "Remove all users from the waiting list",
|
Description: "待機リストから全員を削除する",
|
||||||
Options: []*discordgo.ApplicationCommandOption{},
|
Options: []*discordgo.ApplicationCommandOption{},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user