【发布时间】:2021-11-08 08:58:35
【问题描述】:
我正在尝试为我的不和谐机器人发出命令,因此我可以通过他们的 api 从 5sim 获取任何类型帐户的验证码...我认为我非常接近,因为我的一些代码在 https://reqbin.com/req/c-vdhoummp/curl-get-json-example.. 中工作。但我无法将它实施到我的命令中!这是我第一次使用 Curl,所以我不太熟悉,但我想知道是否有人可以帮助我解决我的损坏代码?
const Discord = require(`discord.js`)
const curl = require(`curl`)
module.exports = {
name: `buynumber`,
description: `buys a phone number!`,
async execute(message) {
const response = curl 'https://5sim.net/v1/user/buy/activation/cambodia/any/yahoo',
{
headers: {
Authorization: "Bearer MYAUTHORIZATIONTOKENHERE",
Accept: "application/json"
}
}; data = await response.json()
message.channel.send(data.number)
}}
我当前面临的错误是
[Sun Sep 12 2021 21:26:16] [LOG] Initializing Startup!
[Sun Sep 12 2021 21:26:16] [ERROR] (node:12692) UnhandledPromiseRejectionWarning: C:\Users\manof\Desktop\Main Bots\Celly Bot\commands\buy.js:8
const response = curl "https://5sim.net/v1/user/buy/activation/cambodia/any/discord",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected string
所有帮助将不胜感激!
【问题讨论】:
标签: api curl discord discord.js bots