botvX_mjs/util/Command.mjs

41 lines
1.1 KiB
JavaScript
Raw Normal View History

import { default as settings } from '../settings.json' with {type: "json"}
2024-08-12 04:33:43 -04:00
class Command {
2024-08-17 07:38:04 -04:00
constructor (uuid, user, nick, cmd, msgType, prefix, bot, verify, prefs) {
2024-08-12 04:33:43 -04:00
this.send = (text, uuid) => { bot.tellraw(uuid || '@a', text) }
this.reply = text => bot.tellraw(uuid, text)
this.uuid = uuid
this.username = user
this.nickname = nick
this.command = cmd
2024-08-18 03:18:09 -04:00
this.msgType = msgType
2024-08-12 04:33:43 -04:00
this.prefix = prefix
this.bot = bot
this.type = 'minecraft'
this.args = cmd.split(' ').slice(1)
this.verify = verify
this.host = bot.host.host
this.port = bot.host.port
this.prefs = prefs
2024-08-20 05:27:22 -04:00
if (prefs.lang) {
this.lang = prefs.lang
} else {
this.lang = settings.defaultLang
}
const _colors = {}
if (prefs.colorPrimary) {
_colors.primary = prefs.colorPrimary
} else {
_colors.primary = settings.colors.primary
}
if (prefs.colorSecondary) {
_colors.secondary = prefs.colorSecondary
} else {
_colors.secondary = settings.colors.secondary
}
this.colors = _colors
2024-08-12 04:33:43 -04:00
}
}
export default Command