当我使用我的meme命令时,我得到的是100个模因,而不是1个,我怎样才能仅生成1个模因? 这是我的代码:
const { MessageEmbed } = require ("discord.js");
const randomPuppy = require("random-puppy");
module.exports = {
name: "meme",
category: "fun",
description: "Sends an epic meme",
}
bot.on("message", async message => {
const subReddits = ["dankmeme", "meme"];
const random = subReddits[Math.floor(Math.random() * subReddits.length)];
const img = await randomPuppy();
const embed = new MessageEmbed()
.setColor("RANDOM")
.setImage(img)
.setTitle(`From /r/${random}`)
.setURL(`https://reddit.com/r/${random}`);
message.channel.send(embed)
})
答案 0 :(得分:0)
好,我解决了我的问题:我添加
if (message.content == "meme"){}
const subReddits = ["dankmeme", "meme"];
似乎可行