krisppurg / dimscord

A Discord Bot & REST Library for Nim.
https://krisppurg.github.io/dimscord/
MIT License
222 stars 20 forks source link

having trouble with text inputs... #114

Closed derspyy closed 1 year ago

derspyy commented 1 year ago

this is my interaction handler:

proc interactionCreate(s: Shard, i: Interaction) {.event(discord).} =
  let data = i.data.get
  let text_input = MessageComponent(
    kind: Button,
  )
  case data.name
    of "example":
      for message in data.resolved.messages.values:
        await discord.api.interactionResponseMessage(
          i.id,
          i.token,
          kind = irtChannelMessageWithSource,
          response = InteractionCallbackDataMessage(
            content: "test",
            components: @[text_input],
          )
        )
    of "example2":
      echo "test"
    else:
      echo "test"

this is my error message...

Exception message: [400] Bad request.

 - [DiscordError]:: Invalid Form Body (50035)

    - data.data.components.0._errors: Field "type" is required to determine the model type.
 [RestError]