Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Emojis to All Buttons #83

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions commands/slash/kudos.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@ func Kudos() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *disco
Label: "Approve",
Style: discordgo.SuccessButton,
CustomID: approve_slug,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
Label: "Deny",
Style: discordgo.DangerButton,
CustomID: deny_slug,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down
54 changes: 54 additions & 0 deletions commands/slash/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,17 @@ func tooManyAttempts(s *discordgo.Session, i *discordgo.InteractionCreate, attem
Label: "Yes",
Style: discordgo.SuccessButton,
CustomID: yesSlug,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
Label: "No",
Style: discordgo.DangerButton,
CustomID: noSlug,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -303,11 +309,17 @@ func emailInUse(s *discordgo.Session, i *discordgo.InteractionCreate, userEmail
Label: "Yes",
Style: discordgo.SuccessButton,
CustomID: yesSlug,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
Label: "No",
Style: discordgo.DangerButton,
CustomID: noSlug,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -476,11 +488,17 @@ func recievedEmail(s *discordgo.Session, i *discordgo.InteractionCreate, userEma
CustomID: recievedSlug,
Label: "I recieved the code",
Style: discordgo.SuccessButton,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
CustomID: unrecievedSlug,
Label: "I did not recieve the code",
Style: discordgo.DangerButton,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -538,11 +556,17 @@ func invalidCode(s *discordgo.Session, i *discordgo.InteractionCreate, userEmail
CustomID: continueSlug,
Label: "yes",
Style: discordgo.SuccessButton,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
CustomID: quitSlug,
Label: "no",
Style: discordgo.DangerButton,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -610,11 +634,17 @@ func invalidRITEmail(s *discordgo.Session, i *discordgo.InteractionCreate, userE
CustomID: continueSlug,
Label: "yes",
Style: discordgo.SuccessButton,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
CustomID: quitSlug,
Label: "no",
Style: discordgo.DangerButton,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -757,11 +787,17 @@ func hasRITEmail(s *discordgo.Session, i *discordgo.InteractionCreate, ctx ddtra
CustomID: yesSlug,
Label: "Yes",
Style: discordgo.SuccessButton,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
CustomID: noSlug,
Label: "No",
Style: discordgo.DangerButton,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down Expand Up @@ -924,26 +960,41 @@ func manualVerification(s *discordgo.Session, i *discordgo.InteractionCreate, us
CustomID: memberSlug,
Label: "Member",
Style: discordgo.SuccessButton,
Emoji: discordgo.ComponentEmoji{
Name: "✔️",
},
},
discordgo.Button{
CustomID: externalSlug,
Label: "External",
Style: discordgo.PrimaryButton,
Emoji: discordgo.ComponentEmoji{
Name: "❓",
},
},
discordgo.Button{
CustomID: prosectiveSlug,
Label: "Prospective",
Style: discordgo.PrimaryButton,
Emoji: discordgo.ComponentEmoji{
Name: "👶",
},
},
discordgo.Button{
CustomID: staffSlug,
Label: "Staff",
Style: discordgo.PrimaryButton,
Emoji: discordgo.ComponentEmoji{
Name: "👨‍🏫",
},
},
discordgo.Button{
CustomID: alumniSlug,
Label: "Alumni",
Style: discordgo.PrimaryButton,
Emoji: discordgo.ComponentEmoji{
Name: "🧓",
},
},
},
},
Expand All @@ -953,6 +1004,9 @@ func manualVerification(s *discordgo.Session, i *discordgo.InteractionCreate, us
CustomID: denySlug,
Label: "Deny",
Style: discordgo.DangerButton,
Emoji: discordgo.ComponentEmoji{
Name: "✖️",
},
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions commands/slash/signin.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ func Signin() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *disc
Label: "Signin",
Style: discordgo.SuccessButton,
CustomID: signinSlug,
Emoji: discordgo.ComponentEmoji{
Name: "📝",
},
},
},
},
Expand Down
27 changes: 26 additions & 1 deletion commands/slash/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ func Vote() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *discor
Label: "Vote",
Style: discordgo.SuccessButton,
CustomID: voteSlug,
Emoji: discordgo.ComponentEmoji{
Name: "🗳️",
},
},
},
},
Expand Down Expand Up @@ -375,6 +378,25 @@ func voteGetVote(s *discordgo.Session, i *discordgo.InteractionCreate, rawOption
interactionCreateChan <- i
}

emojis := []string{
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
}

err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Expand All @@ -387,10 +409,13 @@ func voteGetVote(s *discordgo.Session, i *discordgo.InteractionCreate, rawOption
CustomID: messageSlug,
Options: func() []discordgo.SelectMenuOption {
var innerOptions []discordgo.SelectMenuOption
for _, option := range options {
for j, option := range options {
innerOptions = append(innerOptions, discordgo.SelectMenuOption{
Label: option,
Value: option,
Emoji: discordgo.ComponentEmoji{
Name: emojis[j],
},
})
}
return innerOptions
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ github.com/mailgun/mailgun-go v2.0.0+incompatible h1:0FoRHWwMUctnd8KIR3vtZbqdfjp
github.com/mailgun/mailgun-go v2.0.0+incompatible/go.mod h1:NWTyU+O4aczg/nsGhQnvHL6v2n5Gy6Sv5tNDVvC6FbU=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
Expand All @@ -285,8 +283,6 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
Expand Down Expand Up @@ -333,8 +329,6 @@ github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down Expand Up @@ -637,8 +631,6 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
48 changes: 46 additions & 2 deletions helpers/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,34 @@ func SelectButtons(s *discordgo.Session, i *discordgo.InteractionCreate, compone
defer close(selected)
defer close(interaction)

for _, option := range options {
emojis := []string{
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
}

for j, option := range options {
slug := uuid.New().String()
components = append(components, discordgo.Button{
Label: option,
Style: discordgo.PrimaryButton,
CustomID: slug,
Emoji: discordgo.ComponentEmoji{
Name: emojis[j],
},
})
slugs = append(slugs, slug)

Expand Down Expand Up @@ -79,12 +101,34 @@ func SelectButtonsEdit(s *discordgo.Session, i *discordgo.InteractionCreate, com
selected := make(chan string)
defer close(selected)

for _, option := range options {
emojis := []string{
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
"🟥",
"🟧",
"🟨",
"🟩",
"🟦",
"🟪",
"⬛",
"⬜",
}

for j, option := range options {
slug := uuid.New().String()
components = append(components, discordgo.Button{
Label: option,
Style: discordgo.PrimaryButton,
CustomID: slug,
Emoji: discordgo.ComponentEmoji{
Name: emojis[j],
},
})
slugs = append(slugs, slug)

Expand Down
Loading