chomens-bot-js/plugins/bruhify.js

23 lines
731 B
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
const convert = require('color-convert');
module.exports = {
inject: function(bot) {
bot.bruhifyText = '';
let startHue = 0;
timer = setInterval(() => {
2022-11-07 07:26:38 -05:00
if (bot.bruhifyText === '') return;
2022-08-14 05:51:45 -04:00
let hue = startHue;
const displayName = bot.bruhifyText;
const increment = (360 / Math.max(displayName.length, 20));
const component = [];
for (const character of displayName) {
const color = convert.hsv.hex(hue, 100, 100);
component.push({text: character, color: `#${color}`});
hue = (hue + increment) % 360;
}
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`);
startHue = (startHue + increment) % 360;
}, 100);
},
};