| 2241 | } | 2241 | } |
| 2242 | if (args.onClick) { | 2242 | if (args.onClick) { |
| 2243 | if (args.onClick instanceof SlashCommandClosure) { | 2243 | if (args.onClick instanceof SlashCommandClosure) { |
| 2244 | options.onclick = () => args.onClick.execute(); | 2244 | options.onclick = async () => { |
| | 2245 | // Execute the slash command directly, with its internal scope and everything. Clear progress at the end if the main script is already done. |
| | 2246 | await args.onClick.execute(); |
| | 2247 | await clearCommandProgress(); |
| | 2248 | }; |
| 2245 | } else { | 2249 | } else { |
| 2246 | toastr.warning('Invalid onClick provided for /echo command. This is not a closure'); | 2250 | toastr.warning('Invalid onClick provided for /echo command. This is not a closure'); |
| 2247 | } | 2251 | } |