25 lines
640 B
JavaScript
25 lines
640 B
JavaScript
|
const name = 'rainbowify'
|
||
|
const description = 'Makes text rainbow'
|
||
|
const usages = ['<message...>']
|
||
|
const aliases = ['rainbowify']
|
||
|
const enabled = true
|
||
|
|
||
|
const permLevel = 0
|
||
|
|
||
|
const colorsys = require('colorsys')
|
||
|
|
||
|
function execute (bot, cmd, player, args, handler) {
|
||
|
const message = args.join(' ')
|
||
|
|
||
|
const result = []
|
||
|
let hue = 0
|
||
|
message.split('').forEach((char) => {
|
||
|
result.push({ text: char, color: colorsys.hsv2Hex(hue, 100, 100) })
|
||
|
hue += 355 / Math.max(message.length, 20)
|
||
|
})
|
||
|
|
||
|
bot.core.run(`/tellraw @a ${JSON.stringify(result)}`)
|
||
|
}
|
||
|
|
||
|
module.exports = { name, description, usages, aliases, enabled, execute, permLevel }
|