我目前正在从以前的代码中设置一个高级队列机器人,但我需要从 snekfetch 切换到 node fetch
我已经尝试使用 get 功能但无济于事,它不存在
run(msg, { user }) {
fetch.get('https://api.2b2t.dev/prioq').then(r => {
fetch.get('https://2b2t.io/api/queue').then(qwerty => {
let entry = r.body[1]
let response = qwerty.body[0][1]
client.user.setActivity("Queue: " + response + " PrioQueue: " + entry);
if(message.channel.id === 598643633398349854) {
message.delete().catch(O_o=>{});
message.author.send("The owner has disabled this command in this channel!")
return
}
const queueembed = new RichEmbed()
.setColor("#32CD32")
.addField('Regular Queue:', response, true)
.addField('Priority Queue:', entry, true)
.addField('Regular Queue Time:', Math.round(response * 0.7) + " minutes.", true)
.addField('Priority Queue Time:', Math.round(entry * 0.7) + " minutes.", true)
.setThumbnail('https://i.redd.it/jyvrickfyuly.jpg')
.setFooter("https://discordapp.com/invite/uGfHNVQ")
message.channel.send(queueembed).then(msg => {
var timerID = setInterval(function() {
const queueembed = new RichEmbed()
.setColor("#32CD32")
.addField('Regular Queue:', response, true)
.addField('Priority Queue:', entry, true)
.addField('Regular Queue Time:', Math.round(response * 0.7) + " minutes.", true)
.addField('Priority Queue Time:', Math.round(entry * 0.7) + " minutes.", true)
.setThumbnail('https://i.redd.it/jyvrickfyuly.jpg')
.setFooter("https://discordapp.com/invite/uGfHNVQ")
message.channel.edit(msg)
}, 5 * 1000);
})})
})
}
}
通常机器人会启动,但会弹出此错误
我曾尝试在 fetch 和删除 get 之间切换,但我对下一步做什么感到困惑
"TypeError: Cannot read property 'get' of undefined"