如何为嵌入 Discord.js 制作随机颜色
- 作者: 沙皮狗的忧伤丿
- 来源: 51数据库
- 2022-10-21
问题描述
好的,所以在我的机器人中,我希望嵌入显示为红色和绿色(这两者之间是随机的),所以我想创建一些可以使这成为可能的东西类似:
const randomcolors = ['#008000', '#E50000']const randomizer = Math.floor((Math.random() * foreigncolors.length));
那我有
const embed= new Discord.MessageEmbed().setColor(foreigncolors[colorss])
但它只会发送绿色,我需要帮助
解决方案
没有必要自己写复杂的东西.相反,您可以使用:
Embed.setColor('RANDOM')这是 discord.js 库的内置功能.?/p>
okay, so in my bot, i want the embeds to appear in red and green (random between those two) so i want to create something that will make this possible something like:
const randomcolors = ['#008000', '#E50000'] const randomizer = Math.floor((Math.random() * foreigncolors.length));
then i have
const embed= new Discord.MessageEmbed()
.setColor(foreigncolors[colorss])
but it will only send green color, I need help
解决方案
There is no need to write something complex all by yourself. Instead, you can use:
Embed.setColor('RANDOM')
This is an inbuilt feature of the discord.js library.
;推荐阅读
热点文章
检查拆分键盘
0
带有“上一个"的工具栏和“下一个"用于键盘输入AccessoryView
0
Activity 启动时显示软键盘
0
UIWebView 键盘 - 摆脱“上一个/下一个/完成"酒吧
0
在 iOS7 中边缘滑动时,使键盘与 UIView 同步动画
0
我的 iOS 应用程序中的键盘在 iPhone 6 上太高了.如何在 XCode 中调整键盘的分辨率?
0
android:inputType="textEmailAddress";- '@' 键和 '.com' 键?
0
禁用 iPhone 中键盘的方向
0
Android 2.3 模拟器上的印地语键盘问题
0
keyDown 没有被调用
0
