question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Command Payload and interaction not resolving properly

See original GitHub issue

Following your examples and docs, I tried to implement a command with the newly supported slash commands. However, the arguments passed to the handler, doesn’t seem to resolve properly.

After running !deploy once the bot has started, the command below also doesn’t display/require the song param in Discord itself.

The following example will log (interaction, undefined) from the handler call.

import { TransformPipe } from '@discord-nestjs/common';
import {
  Command,
  DiscordTransformedCommand,
  Payload,
  UsePipes,
  Param,
} from '@discord-nestjs/core';
import { Logger } from '@nestjs/common';
import { CommandInteraction } from 'discord.js';

// Dto Definition
class PlayDto {
  @Param({
    name: 'song',
    description:
      'Name or URL of song/playlist. Could be from (Youtube, Spotify, SoundCloud)',
    required: true,
  })
  song: string;
}

// Command
@Command({
  name: 'play',
  description: 'Plays a song',
})
@UsePipes(TransformPipe)
export class PlayCommand implements DiscordTransformedCommand<PlayDto> {
  private readonly logger = new Logger(PlayCommand.name);

  handler(@Payload() dto: PlayDto, interaction: CommandInteraction) {
    console.log({
      dto,
      interaction,
    });

    return 'Nice.';
  }
}

Please give me a shout if you need additional information!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
V-edcommented, Apr 8, 2022

I know that this issue has been closed and solved. I had the same issue and discovered that I was missing "useDefineForClassFields": true in my tsconfig.json

Yes, this solution has been added to the readme back then : https://github.com/fjodor-rybakov/discord-nestjs#i-created-dto-and-added-transformpipe-but-when-i-receive-response-to-the-command-the-dto-fields-are-missing

But having it surfaced here too isn’t bad either 😃

1reaction
arelstonecommented, Apr 8, 2022

I know that this issue has been closed and solved. I had the same issue and discovered that I was missing "useDefineForClassFields": true in my tsconfig.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling interactivity with Slash Commands - Slack API
A submitted Slash Command will cause a payload of data to be sent from Slack to the associated app. ... Slash Commands cannot...
Read more >
Not receiving block_action payload when interacting with a ...
I successfully display the modal, and the UI functions correctly, but I do not receive a payload on interaction.
Read more >
Meterpreter HTTP/HTTPS Communication | Rapid7 Blog
To avoid shutting down the payload but still exit the temporary session, use the detach command from the Meterpreter prompt. Keep in mind...
Read more >
projectdiscovery/interactsh: An OOB interaction ... - GitHub
Go to Tools → Options → OAST and select Interactsh. Configure the options for the client and click on "New Payload" to generate...
Read more >
ASK CLI Command Reference | Alexa Skills Kit
High-level commands simplify working with your Alexa skill projects by abstracting details and performing multiple actions. Start with these commands if you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found