Create Test Cases for Interactions #1234
-
Testing interactions manually can get tedious, and often you'll end up forgetting one of them. How do you write or find code that would test your Interaction commands for you? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 |
Beta Was this translation helpful? Give feedback.
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.
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…