Command Payload and interaction not resolving properly
See original GitHub issueFollowing 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:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃
I know that this issue has been closed and solved. I had the same issue and discovered that I was missing
"useDefineForClassFields": true
in mytsconfig.json