http.get(url, opts?)
http.get(url, opts?)
HTTP requests to outside Discord. Always go through the same security filter: response size limit, timeout, blocking of
localhost/private IPs, and a request limit per script run.Parâmetros
| Assinatura | Tipo(s) |
|---|---|
| http.get(url, opts?) | string, object? |
Valor de retorno
{ ok, status, headers, body, json, text }
opts.headers accepts a custom headers object in every method. On servers without this feature unlocked, calling any http method throws an error explaining which plan is required.Exemplo de uso
on command("clima", message, args)
let res = http.get("https://api.exemplo.com/clima")
if res.ok then
message.reply(res.json.temperatura .. "°C")
end
endObservações
Confira os tipos esperados na tabela de Parâmetros antes de chamar — passar um tipo diferente do esperado é a causa mais comum de erro em tempo de execução.