2024-07-28 02:37:31 -04:00
|
|
|
const settings = require('../settings.json')
|
|
|
|
class Command {
|
2024-09-19 00:31:15 -04:00
|
|
|
constructor (uuid, user, nick, cmd, msgType, msgSubtype, prefix, bot, prefs) {
|
2024-07-28 02:37:31 -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-22 07:34:39 -04:00
|
|
|
this.msgType = msgType
|
2024-09-19 00:31:15 -04:00
|
|
|
this.msgSubtype = msgSubtype
|
2024-07-28 02:37:31 -04:00
|
|
|
this.prefix = prefix
|
|
|
|
this.bot = bot
|
|
|
|
this.type = 'minecraft'
|
|
|
|
this.args = cmd.split(' ').slice(1)
|
2024-08-23 10:29:01 -04:00
|
|
|
this.cmdName = cmd.split(' ')[0]
|
2024-09-11 02:02:29 -04:00
|
|
|
this.verify = 0
|
2024-07-28 02:37:31 -04:00
|
|
|
this.host = bot.host.host
|
|
|
|
this.port = bot.host.port
|
2024-08-24 09:06:55 -04:00
|
|
|
this.serverName = bot.host.options.name
|
2024-08-12 05:13:32 -04:00
|
|
|
this.prefs = prefs
|
2024-09-12 00:26:36 -04:00
|
|
|
this.cancel = false
|
2024-08-22 07:34:39 -04:00
|
|
|
if (prefs.lang) {
|
2024-08-12 05:13:32 -04:00
|
|
|
this.lang = prefs.lang
|
|
|
|
} else {
|
|
|
|
this.lang = settings.defaultLang
|
|
|
|
}
|
2024-08-22 07:34:39 -04:00
|
|
|
|
|
|
|
const _colors = {}
|
|
|
|
if (prefs.colorPrimary) {
|
2024-08-12 05:13:32 -04:00
|
|
|
_colors.primary = prefs.colorPrimary
|
|
|
|
} else {
|
|
|
|
_colors.primary = settings.colors.primary
|
|
|
|
}
|
2024-08-22 07:34:39 -04:00
|
|
|
if (prefs.colorSecondary) {
|
2024-08-12 05:13:32 -04:00
|
|
|
_colors.secondary = prefs.colorSecondary
|
|
|
|
} else {
|
|
|
|
_colors.secondary = settings.colors.secondary
|
|
|
|
}
|
|
|
|
this.colors = _colors
|
2024-09-11 02:02:29 -04:00
|
|
|
|
|
|
|
this.rewriteCommand = newCmd => {
|
|
|
|
this.command = newCmd
|
|
|
|
this.args = newCmd.split(' ').slice(1)
|
|
|
|
this.cmdName = newCmd.split(' ')[0]
|
|
|
|
}
|
2024-07-28 02:37:31 -04:00
|
|
|
}
|
2024-07-27 02:39:18 -04:00
|
|
|
}
|
|
|
|
|
2024-07-28 02:37:31 -04:00
|
|
|
module.exports = Command
|