slash roleypoly yay
This commit is contained in:
parent
02f5075d3b
commit
607d7e121c
22 changed files with 394 additions and 66 deletions
|
@ -10,28 +10,32 @@ import (
|
|||
"time"
|
||||
|
||||
"git.sapphic.engineer/roleypoly/v4/discord"
|
||||
"git.sapphic.engineer/roleypoly/v4/discord/clientmock"
|
||||
"git.sapphic.engineer/roleypoly/v4/interactions"
|
||||
"git.sapphic.engineer/roleypoly/v4/types/fixtures"
|
||||
"github.com/goccy/go-json"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func makeInteractions(t *testing.T) (*interactions.Interactions, *discord.GuildService, ed25519.PrivateKey) {
|
||||
func makeInteractions(t *testing.T) (*interactions.Interactions, *clientmock.DiscordClientMock, ed25519.PrivateKey) {
|
||||
pub, priv, err := ed25519.GenerateKey(nil)
|
||||
if err != nil {
|
||||
t.Errorf("makeInteractions: failed to generate key: %v", err)
|
||||
}
|
||||
|
||||
gs := &discord.GuildService{}
|
||||
dcm := clientmock.NewDiscordClientMock()
|
||||
gs := discord.NewGuildService(dcm)
|
||||
|
||||
i := &interactions.Interactions{
|
||||
PublicKey: pub,
|
||||
Guilds: gs,
|
||||
Router: interactions.NewInteractionRouter(),
|
||||
OK: true,
|
||||
PublicKey: pub,
|
||||
PublicBaseURL: "http://roleypoly.local",
|
||||
Guilds: gs,
|
||||
Router: interactions.NewInteractionRouter(),
|
||||
OK: true,
|
||||
}
|
||||
|
||||
return i, gs, priv
|
||||
return i, dcm, priv
|
||||
}
|
||||
|
||||
func cmdHelloWorld(ix interactions.Interaction) (interactions.InteractionResponse, error) {
|
||||
|
@ -85,7 +89,9 @@ func sendInteraction(t *testing.T, i *interactions.Interactions, key ed25519.Pri
|
|||
|
||||
func mkInteraction(name string) interactions.Interaction {
|
||||
return interactions.Interaction{
|
||||
Type: interactions.TypeApplicationCommand,
|
||||
GuildID: "guild-id",
|
||||
Type: interactions.TypeApplicationCommand,
|
||||
Member: fixtures.Member,
|
||||
Data: interactions.InteractionData{
|
||||
Name: name,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue