Add check for closure type

This commit is contained in:
Wolfsblvt 2024-09-06 19:49:32 +02:00
parent de8732fad6
commit e48ff8daae
1 changed files with 5 additions and 1 deletions

View File

@ -2240,7 +2240,11 @@ async function echoCallback(args, value) {
options.onHidden = () => resolveToastDismissal(value);
}
if (args.onClick) {
options.onclick = () => args.onClick.execute();
if (args.onClick instanceof SlashCommandClosure) {
options.onclick = () => args.onClick.execute();
} else {
toastr.warning('Invalid onClick provided for /echo command. This is not a closure');
}
}
let toast;