Skip to content

Create Test Cases for Interactions #1234

Answered by valzargaming
civilCornball asked this question in Q&A
Discussion options

You must be logged in to vote

For the command listeners, you're probably best off writing typecasted returns and letting your IDE guide you through it as it would throw errors to warn you if your command never had a proper return. If you check that all variables are properly set, your own methods returned properly, etc. you shouldn't have issues.

$this->listenCommand('ping', function (Interaction $interaction): PromiseInterface
{
    return $interaction->respondWithMessage(MessageBuilder::new()->setContent('Pong!'));
});

As for validating the Command structure for $commands->save($command), most people are fine with using the CommandBuilder helper class, however I've had little luck with it. I've been writing my own s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@civilCornball
Comment options

@valzargaming
Comment options

Answer selected by valzargaming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
awaiting confirmation The issue has been resolved, but awaits confirmation from the creator to confirm.
2 participants