小编Rom*_*ard的帖子

错误 [ERR_REQUIRE_ESM]:不支持来自 /app/commands/Image/meme.js 的 ES 模块 /app/node_modules/got/dist/source/index.js 的 require()

代码:

\n
const { EmbedBuilder } = require("discord.js");\nconst got = require("got");\n\nmodule.exports = {\n  name: "meme",\n  description: "Shows an image of a meme!",\n  run: async (client, message, args) => {\n      got("https://www.reddit.com/r/memes/random/.json").then(response => {\n      const [list] = JSON.parse(response.body);\n      const [post] = list.data.children;\n\n      const permalink = post.data.permalink;\n      const memeUrl = `https://reddit.com${post.data.permalink}`;\n      const memeImage = post.data.url;\n      const memeTitle = post.data.title;\n      const memeUpvotes = post.data.ups;\n      const memeNumComments = post.data.num_comments;\n      \n      const memeEmbed = new EmbedBuilder()\n         .setTitle(`${memeTitle}`)\n         .setURL(`${memeUrl}`)\n         .setColor("Random")\n         .setImage(memeImage)\n         .setFooter({ text: ` ${memeUpvotes} |  ${memeNumComments}` …
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord.js

3
推荐指数
1
解决办法
9147
查看次数

标签 统计

discord.js ×1

javascript ×1

node.js ×1