display not attendings and fix being able to add yourself multiple times
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Leopold 2025-12-03 20:21:47 +01:00 committed by Ingwerpold
parent 2f40ad1c34
commit 69c516daf5

View file

@ -90,7 +90,7 @@ func commandListener(event *events.ApplicationCommandInteractionCreate) {
if data.CommandName() == "schedule" {
err := event.CreateMessage(
discord.NewMessageCreateBuilder().
SetContent(fmt.Sprintf("Will you attend on %s?\n", data.String("date"))).
SetContent(fmt.Sprintf("Will you attend on %s?\nAttending:\n\nNot Attending:\n", data.String("date"))).
AddActionRow(
discord.ButtonComponent{
Style: discord.ButtonStylePrimary,
@ -116,6 +116,8 @@ func interactListener(event *events.ComponentInteractionCreate) {
case "attend":
currentcontent := event.Message.Content
event.UpdateMessage(discord.NewMessageUpdateBuilder().
SetContent(strings.ReplaceAll(currentcontent, event.User().Username, "")).
SetContent(strings.ReplaceAll(currentcontent, "Attending:\n", fmt.Sprintf("Attending:\n%s\n", event.User().Username))).
SetContentf("%s\n%s\n", currentcontent, event.User().Username).
Build(),
)
@ -123,6 +125,7 @@ func interactListener(event *events.ComponentInteractionCreate) {
currentcontent := event.Message.Content
event.UpdateMessage(discord.NewMessageUpdateBuilder().
SetContent(strings.ReplaceAll(currentcontent, event.User().Username, "")).
SetContent(strings.ReplaceAll(currentcontent, "Not Attending:\n", fmt.Sprintf("Not Attending:\n%s\n", event.User().Username))).
Build(),
)
}