【发布时间】:2020-10-27 23:43:14
【问题描述】:
我正在尝试创建一个 meme 命令,它从 reddit 发布 meme
这是发布表情包的命令:
const randompuppy = require("random-puppy");
if(message.content.startsWith(prefix + 'meme')){
const subredddits = ["dankmeme", "meme", "me_irl"];
// Grab a random property from the array
const random = subredddits[Math.floor(Math.random() * subredddits.length)];
// Get a random image from the subreddit page
const image = randompuppy(random);
const embed = new RichEmbed()
.setColor("RANDOM")
.setImage(image)
.setTitle(`From /r/${random}`)
.setFooter(`© Extendo Selfbot | prefix: ${prefix} | Made By 7teen#1646`)
.setURL(`https://reddit.com/r/${random}`);
message.channel.send(embed);
}
这是错误
(node:2180) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.image.url: Could not interpret "{}" as string.
at C:\Users\Familia\OneDrive\Documents\Other Stuff\Visual Studio code\Discord Bots\Testing\SELFBOT\extendo v2\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
at C:\Users\Familia\OneDrive\Documents\Other Stuff\Visual Studio code\Discord Bots\Testing\SELFBOT\extendo v2\node_modules\snekfetch\src\index.js:215:21
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:2180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我们将不胜感激!
【问题讨论】:
标签: javascript node.js discord discord.js