How to make random colors for embeds Discord.js(如何为嵌入 Discord.js 制作随机颜色)
问题描述
好的,所以在我的机器人中,我希望嵌入显示为红色和绿色(这两者之间是随机的),所以我想创建一些可以使这成为可能的东西类似:
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.
这篇关于如何为嵌入 Discord.js 制作随机颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为嵌入 Discord.js 制作随机颜色
基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
