Fix and improve api command output

This commit is contained in:
Tulir Asokan
2017-12-01 16:15:07 +02:00
parent 0d9937f73f
commit 5064ab88eb
+5 -1
View File
@@ -293,7 +293,11 @@ commands.api = async (sender, args, reply, app) => {
try {
reply(`Calling ${apiMethod} with the following arguments:\n${JSON.stringify(apiArgs, "", " ")}`)
const response = await sender.telegramPuppet.client(apiMethod, apiArgs)
reply(`API call successful. Response:\n${JSON.stringify(response, "", " ")}`)
reply(`API call successful. Response:
<pre><code class="language-json">
${JSON.stringify(response, "", " ")}
</code></pre>`, { allowHTML: true })
} catch (err) {
reply(`API call errored. Response:\n${JSON.stringify(err, "", " ")}`)
}