Skip to content

Commit

Permalink
Custom now gives feedback
Browse files Browse the repository at this point in the history
Also emojiToDescription is now used more widely
  • Loading branch information
TheTipo01 committed Oct 3, 2021
1 parent 24dc55e commit bd17f6d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
18 changes: 15 additions & 3 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ var (
"preghiera": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
vs := findUserVoiceState(s, i.Member.User.ID, i.GuildID)
if vs != nil {
text := advancedReplace(advancedReplace(getRand(server[i.GuildID].customCommands), "<god>", gods), "<dict>", adjectives)
text := emojiToDescription(advancedReplace(advancedReplace(getRand(server[i.GuildID].customCommands), "<god>", gods), "<dict>", adjectives))
c := make(chan int)

go sendEmbedInteraction(s, NewEmbed().SetTitle(s.State.User.Username).AddField("Preghiera", text).
Expand All @@ -315,7 +315,19 @@ var (
if server[i.GuildID].customCommands[command] != "" {
vs := findUserVoiceState(s, i.Member.User.ID, i.GuildID)
if vs != nil {
playSound(s, vs.GuildID, vs.ChannelID, genAudio(advancedReplace(advancedReplace(server[i.GuildID].customCommands[command], "<god>", gods), "<dict>", adjectives)))
text := emojiToDescription(advancedReplace(advancedReplace(server[i.GuildID].customCommands[command], "<god>", gods), "<dict>", adjectives))
c := make(chan int)

go sendEmbedInteraction(s, NewEmbed().SetTitle(s.State.User.Username).AddField("Custom", text).
SetColor(0x7289DA).MessageEmbed, i.Interaction, &c)

playSound(s, vs.GuildID, vs.ChannelID, genAudio(text))

<-c
err := s.InteractionResponseDelete(s.State.User.ID, i.Interaction)
if err != nil {
lit.Error("InteractionResponseDelete failed: %s", err.Error())
}
}
} else {
sendAndDeleteEmbedInteraction(s, NewEmbed().SetTitle(s.State.User.Username).AddField("Error", "Command doesn't exist!").
Expand Down Expand Up @@ -343,7 +355,7 @@ var (
if vs != nil {
c := make(chan int)

article := getWikipedia(i.ApplicationCommandData().Options[0].StringValue())
article := emojiToDescription(getWikipedia(i.ApplicationCommandData().Options[0].StringValue()))

go sendEmbedInteraction(s, NewEmbed().SetTitle(s.State.User.Username).AddField("Wikipedia", article).
SetColor(0x7289DA).MessageEmbed, i.Interaction, &c)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ require (
github.com/valyala/fasthttp v1.30.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d // indirect
golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c // indirect
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.7 // indirect
modernc.org/ccgo/v3 v3.12.12 // indirect
modernc.org/ccgo/v3 v3.12.13 // indirect
modernc.org/sqlite v1.13.1
)
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,8 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d h1:SABT8Vei3iTiu+Gy8KOzpSNz+W1EQ5YBCRtiEETxF+0=
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c h1:EyJTLQbOxvk8V6oDdD8ILR1BOs3nEJXThD6aqsiPNkM=
golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1210,8 +1210,9 @@ modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g
modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.4/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.5 h1:Lm1UiCy8bj3sjs+X+isHYbvzKCKd/ubUsYqbVHtHu7s=
modernc.org/cc/v3 v3.35.5/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.6 h1:+7f3tY9ag8lYEiEn1ARXTzUwE1MhnR49iYfywqJENyY=
modernc.org/cc/v3 v3.35.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
Expand All @@ -1222,8 +1223,8 @@ modernc.org/ccgo/v3 v3.12.4/go.mod h1:Bk+m6m2tsooJchP/Yk5ji56cClmN6R1cqc9o/YtbgB
modernc.org/ccgo/v3 v3.12.6/go.mod h1:0Ji3ruvpFPpz+yu+1m0wk68pdr/LENABhTrDkMDWH6c=
modernc.org/ccgo/v3 v3.12.8/go.mod h1:Hq9keM4ZfjCDuDXxaHptpv9N24JhgBZmUG5q60iLgUo=
modernc.org/ccgo/v3 v3.12.11/go.mod h1:0jVcmyDwDKDGWbcrzQ+xwJjbhZruHtouiBEvDfoIsdg=
modernc.org/ccgo/v3 v3.12.12 h1:or4pTtN1DW6GwAiuDnD4km0yE0JcGABXFchEw+sb/3Q=
modernc.org/ccgo/v3 v3.12.12/go.mod h1:k4NKR2KdXrtIChz1mDbiGjnS7VEtLcuRYheTtxId+8A=
modernc.org/ccgo/v3 v3.12.13 h1:2w8YqG2vvUZnjuhfopHZbAClC8ZUydoBUiLAUIwx5Lg=
modernc.org/ccgo/v3 v3.12.13/go.mod h1:tVujFRt9hr3bgEtMdjuXxFtcj+EQrYP3+xuib5rAuWw=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
Expand Down

0 comments on commit bd17f6d

Please sign in to comment.