This PR adds 'internalRejectedPromiseHandler' in DiscordCommandClient which accepts a null or a callable, by default the library will log promise rejection caused by internal calls from the DiscordCommandClient instead of being ghosted (since the code was not maintained for 8 years). Thanks to @2colours for reporting the issue.
Example code:
$discord->registerCommand('test', function ($message) {
return 'test';
});
This will send reply "test" to the user who used test command, or else will log the rejection errors (e.g. missing permissions). Same applies to default help command.
To override this:
$discordCommandClient = new DiscordCommandClient([
'token' => '<secret>',
'internalRejectedPromiseHandler' => function ($reason): void {
// Do something
},
'discordOptions' => [],
]);
or set null for the old effect with ghost promise bug.
This PR adds 'internalRejectedPromiseHandler' in
DiscordCommandClient
which accepts a null or a callable, by default the library will log promise rejection caused by internal calls from theDiscordCommandClient
instead of being ghosted (since the code was not maintained for 8 years). Thanks to @2colours for reporting the issue.Example code:
This will send reply "test" to the user who used
test
command, or else will log the rejection errors (e.g. missing permissions). Same applies to default help command.To override this:
or set
null
for the old effect with ghost promise bug.