2024-08-12 04:33:43 -04:00
|
|
|
// HOW TO WRITE CLASS JS
|
|
|
|
const settings = require('../settings.json')
|
|
|
|
class Command {
|
|
|
|
constructor (uuid, user, nick, cmd, prefix, bot, verify, prefs) {
|
|
|
|
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
|
|
|
|
this.prefix = prefix
|
|
|
|
this.bot = bot
|
|
|
|
this.type = 'minecraft'
|
|
|
|
this.index = bot.id
|
|
|
|
this.args = cmd.split(' ').slice(1)
|
|
|
|
this.verify = verify
|
|
|
|
this.host = bot.host.host
|
|
|
|
this.port = bot.host.port
|
|
|
|
// this.lang = lang
|
|
|
|
this.prefs = prefs
|
2024-08-15 05:43:42 -04:00
|
|
|
if (prefs.lang) {
|
2024-08-12 04:33:43 -04:00
|
|
|
this.lang = prefs.lang
|
|
|
|
} else {
|
|
|
|
this.lang = settings.defaultLang
|
|
|
|
}
|
2024-08-15 05:43:42 -04:00
|
|
|
|
|
|
|
const _colors = {}
|
|
|
|
if (prefs.colorPrimary) {
|
2024-08-12 04:33:43 -04:00
|
|
|
_colors.primary = prefs.colorPrimary
|
|
|
|
} else {
|
|
|
|
_colors.primary = settings.colors.primary
|
|
|
|
}
|
2024-08-15 05:43:42 -04:00
|
|
|
if (prefs.colorSecondary) {
|
2024-08-12 04:33:43 -04:00
|
|
|
_colors.secondary = prefs.colorSecondary
|
|
|
|
} else {
|
|
|
|
_colors.secondary = settings.colors.secondary
|
|
|
|
}
|
|
|
|
this.colors = _colors
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Command
|