Fix and improve api command output
This commit is contained in:
+5
-1
@@ -293,7 +293,11 @@ commands.api = async (sender, args, reply, app) => {
|
|||||||
try {
|
try {
|
||||||
reply(`Calling ${apiMethod} with the following arguments:\n${JSON.stringify(apiArgs, "", " ")}`)
|
reply(`Calling ${apiMethod} with the following arguments:\n${JSON.stringify(apiArgs, "", " ")}`)
|
||||||
const response = await sender.telegramPuppet.client(apiMethod, 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) {
|
} catch (err) {
|
||||||
reply(`API call errored. Response:\n${JSON.stringify(err, "", " ")}`)
|
reply(`API call errored. Response:\n${JSON.stringify(err, "", " ")}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user