【发布时间】:2021-07-03 06:22:40
【问题描述】:
const { checkUrl } = require("check-url");
const Discord = require("discord.js");
module.exports = async (bot, client) => {
console.log("Successfully logged in!");
const ok = function ok(res) {
if(res.ok == false) {
const embed = new Discord.MessageEmbed()
.setAuthor("Ramnet Status", bot.user.displayAvatarURL())
.setColor("#7289da")
.setThumbnail(bot.user.displayAvatarURL())
.setFooter("Last Updated")
.setTimestamp()
if(res.ok == false) {
embed.setDescription(`- Bot: <:offline:825589358270349374> Offline\n- Dashboard: :offline: Offline\n- Modmail (Support System): <:offline:825589414628950046> Offline`)
embed.setFooter(`yes`)
} else {
embed.setDescription(`- Bot: :online: Online\n- Dashboard: <:offline:825589414628950046> Online\n- Modmail (Support System): <:offline:825589414628950046> Online`)
}
}
}
// wrap the code below in a setInterval function so it runs every 30 seconds or so
setInterval (function () {
checkUrl('https://mUdollar1cB0t.bencofficial.repl.co')
.then((res) => ok(res))
.catch((err) => console.error(err.message));
bot.channels.cache.get('825589791441420361').send(embed);
}, 1 * 30000);
};
bot.channels.cache.get('825589791441420361').send(embed);这就是问题所在
ReferenceError: 嵌入未定义 你能帮我吗,这对我来说很难,我想启动并运行它
【问题讨论】:
-
const是块作用域,所以它只在if(res.ok == false) {}中可用。我也不知道你为什么要在if (res.ok == false)里面查看if (res.ok == false) -
在区间内外使用
console.log(embed)检查您的嵌入。
标签: node.js discord.js