简体   繁体   English

使用 Discord.js 选择一个随机的公会成员

[英]Select a random Guild member using Discord.js

I'm trying to make a command that based off of one of the april fools videos will mention a random member of teh server.我正在尝试根据其中一个愚人节视频发出一个命令,该命令将提及服务器的随机成员。 unfortuneately ive had no luck with everything ive googled.不幸的是,我用谷歌搜索的一切都没有运气。

I would like to mention I'm still very new to javascript and discord.js我想提一下我对 javascript 和 discord.js 还是很陌生

the best ive found so far is:到目前为止我发现的最好的是:

interaction.guild.members.random();

and that didnt work (it told me its not function)那没有用(它告诉我它不起作用)

It should be interaction.guild.members.cache.random() – Zsolt Meszaros它应该是 interaction.guild.members.cache.random() – Zsolt Meszaros

turns out I was missing the cache part of the command.原来我错过了命令的缓存部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM