Lint
This commit is contained in:
parent
54eb048e0b
commit
919bc90365
11 changed files with 87 additions and 87 deletions
|
@ -112,7 +112,7 @@ const aboutServer = function (c) {
|
|||
text: thisItem,
|
||||
color: c.colors.primary,
|
||||
clickEvent: {
|
||||
action: "copy_to_clipboard",
|
||||
action: 'copy_to_clipboard',
|
||||
value: thisItem
|
||||
},
|
||||
hoverEvent: {
|
||||
|
@ -203,8 +203,8 @@ const aboutServer = function (c) {
|
|||
const displayServerList = function (c) {
|
||||
index.bot.forEach((item, i) => {
|
||||
if (item.host.options && item.host.options.hidden && c.verify !== 3 && c.bot.id !== i) return
|
||||
let message = 'command.about.serverListItem';
|
||||
if(c.bot.id == i) message = 'command.about.serverListItem.thisServer'
|
||||
let message = 'command.about.serverListItem'
|
||||
if (c.bot.id === i) message = 'command.about.serverListItem.thisServer'
|
||||
c.reply({
|
||||
translate: getMessage(c.lang, message),
|
||||
color: c.colors.secondary,
|
||||
|
@ -217,7 +217,7 @@ const displayServerList = function (c) {
|
|||
text: `${item.host.host}:${item.host.port}`,
|
||||
color: c.colors.primary,
|
||||
clickEvent: {
|
||||
action: "copy_to_clipboard",
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${item.host.host}:${item.host.port}`
|
||||
},
|
||||
hoverEvent: {
|
||||
|
@ -240,9 +240,9 @@ const displayServerList = function (c) {
|
|||
module.exports = {
|
||||
execute: function (c) {
|
||||
let subcmd = c.args[0]
|
||||
if(subcmd === "servers") subcmd = "serverlist"
|
||||
if(c.cmdName === "serverinfo") subcmd = "server"
|
||||
if(c.cmdName === "serverlist" || c.cmdName === "servers") subcmd = "serverlist"
|
||||
if (subcmd === 'servers') subcmd = 'serverlist'
|
||||
if (c.cmdName === 'serverinfo') subcmd = 'server'
|
||||
if (c.cmdName === 'serverlist' || c.cmdName === 'servers') subcmd = 'serverlist'
|
||||
if (subcmd === 'server') {
|
||||
aboutServer(c)
|
||||
} else if (subcmd === 'serverlist') {
|
||||
|
|
|
@ -5,8 +5,8 @@ module.exports = {
|
|||
let host = c.host
|
||||
let port = c.port
|
||||
if (c.bot.host.options && c.bot.host.options.hidden) {
|
||||
host = "localhost" // Makes hidden servers appear as localhost
|
||||
port = "25565"
|
||||
host = 'localhost' // Makes hidden servers appear as localhost
|
||||
port = '25565'
|
||||
}
|
||||
const json = {
|
||||
translate: '[%s] %s: %s',
|
||||
|
@ -14,12 +14,12 @@ module.exports = {
|
|||
{
|
||||
text: c.serverName,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
action: 'show_text',
|
||||
value: {
|
||||
translate: '%s: %s:%s',
|
||||
with: [
|
||||
{
|
||||
text: getMessage(c.lang, "command.netmsg.serverAddress"),
|
||||
text: getMessage(c.lang, 'command.netmsg.serverAddress'),
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@ const { languages, getMessage } = require('../util/lang.js')
|
|||
const fs = require('fs')
|
||||
module.exports = {
|
||||
execute: (c) => {
|
||||
if(c.type == "console"){
|
||||
if (c.type === 'console') {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.disabled.console'),
|
||||
color: c.colors.secondary
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
text: item,
|
||||
color: c.colors.primary,
|
||||
clickEvent: {
|
||||
action: "copy_to_clipboard",
|
||||
action: 'copy_to_clipboard',
|
||||
value: item
|
||||
},
|
||||
hoverEvent: {
|
||||
|
|
10
index.js
10
index.js
|
@ -1,14 +1,14 @@
|
|||
const fs = require('fs')
|
||||
|
||||
if (!fs.readdirSync('.').includes('settings.json')) {
|
||||
console.log("Settings file is missing, using defaults.")
|
||||
fs.copyFileSync("settings_example.json", "settings.json")
|
||||
console.log('Settings file is missing, using defaults.')
|
||||
fs.copyFileSync('settings_example.json', 'settings.json')
|
||||
}
|
||||
|
||||
if (!fs.readdirSync('.').includes('secret.json')) {
|
||||
console.log("Secrets file is missing, using defaults.")
|
||||
fs.copyFileSync("secret_example.json", "secret.json")
|
||||
console.log("Please change the hashing keys in the secrets file.")
|
||||
console.log('Secrets file is missing, using defaults.')
|
||||
fs.copyFileSync('secret_example.json', 'secret.json')
|
||||
console.log('Please change the hashing keys in the secrets file.')
|
||||
}
|
||||
|
||||
const m = require('minecraft-protocol')
|
||||
|
|
|
@ -3,11 +3,11 @@ const parsePlain = require('../util/chatparse_plain.js')
|
|||
const parseConsole = require('../util/chatparse_console.js')
|
||||
const parse1204 = require('../util/parseNBT.js')
|
||||
const convertChatStyleItem = (item) => {
|
||||
let output={};
|
||||
const output = {}
|
||||
for (const i in item) {
|
||||
output[i] = item[i].value
|
||||
}
|
||||
return output;
|
||||
return output
|
||||
}
|
||||
const convertChatTypeItem = (item) => {
|
||||
if (item.style) {
|
||||
|
@ -26,11 +26,11 @@ const convertChatTypeItem = (item) => {
|
|||
}
|
||||
module.exports = {
|
||||
load: (b) => {
|
||||
b.messageTypes = [];
|
||||
b._client.on("registry_data",(data)=>{
|
||||
b.messageTypes = []
|
||||
b._client.on('registry_data', (data) => {
|
||||
if (data.codec.value['minecraft:chat_type']) {
|
||||
b.messageTypes = data.codec.value['minecraft:chat_type']
|
||||
const nbtItems = data.codec.value['minecraft:chat_type'].value.value.value.value;
|
||||
const nbtItems = data.codec.value['minecraft:chat_type'].value.value.value.value
|
||||
nbtItems.forEach((item, i) => {
|
||||
b.messageTypes[i] = convertChatTypeItem(item.element.value.chat.value)
|
||||
})
|
||||
|
@ -38,24 +38,24 @@ module.exports = {
|
|||
})
|
||||
b._client.on('profileless_chat', (data) => {
|
||||
const messageType = b.messageTypes[data.type]
|
||||
let json = {translate: messageType.translation_key, with: []}
|
||||
const json = { translate: messageType.translation_key, with: [] }
|
||||
messageType.parameters.forEach((item, i) => {
|
||||
if(item == "content"){
|
||||
if (item === 'content') {
|
||||
json.with[i] = parse1204(data.message)
|
||||
} else if(item == "sender"){
|
||||
} else if (item === 'sender') {
|
||||
json.with[i] = parse1204(data.name)
|
||||
} else if(item == "target"){
|
||||
} else if (item === 'target') {
|
||||
json.with[i] = parse1204(data.target)
|
||||
}
|
||||
})
|
||||
for (const i in messageType.style) {
|
||||
json[i] = messageType.style[i]
|
||||
}
|
||||
let username = ""
|
||||
let nickname = ""
|
||||
let uuid = "00000000-0000-0000-0000-000000000000"
|
||||
let message = ""
|
||||
if (messageType.translation_key == "%s") {
|
||||
let username = ''
|
||||
let nickname = ''
|
||||
let uuid = '00000000-0000-0000-0000-000000000000'
|
||||
let message = ''
|
||||
if (messageType.translation_key === '%s') {
|
||||
const parsed = parsePlain(json)
|
||||
const split = parsed.split(': ')
|
||||
const chatName = split.splice(0, 1)[0]
|
||||
|
@ -63,7 +63,7 @@ module.exports = {
|
|||
nickname = chatNameSplit[chatNameSplit.length - 1]
|
||||
username = b.findRealName(chatName)
|
||||
uuid = b.findUUID(username)
|
||||
message = split.join(": ")
|
||||
message = split.join(': ')
|
||||
} else {
|
||||
message = parsePlain(parse1204(data.message))
|
||||
uuid = b.findUUID(parsePlain(parse1204(data.name)))
|
||||
|
@ -71,7 +71,7 @@ module.exports = {
|
|||
username = parsePlain(parse1204(data.name))
|
||||
}
|
||||
b.emit('chat', {
|
||||
json: json,
|
||||
json,
|
||||
type: 'profileless',
|
||||
uuid,
|
||||
message,
|
||||
|
@ -82,17 +82,17 @@ module.exports = {
|
|||
|
||||
b._client.on('player_chat', (data) => {
|
||||
const messageType = b.messageTypes[data.type]
|
||||
let json = {translate: messageType.translation_key, with: []}
|
||||
const json = { translate: messageType.translation_key, with: [] }
|
||||
messageType.parameters.forEach((item, i) => {
|
||||
if(item == "content"){
|
||||
if(messageType.translation_key === "%s"){
|
||||
if (item === 'content') {
|
||||
if (messageType.translation_key === '%s') {
|
||||
json.with[i] = parse1204(data.unsignedChatContent)
|
||||
} else {
|
||||
json.with[i] = data.plainMessage
|
||||
}
|
||||
} else if(item == "sender"){
|
||||
} else if (item === 'sender') {
|
||||
json.with[i] = parse1204(data.networkName)
|
||||
} else if(item == "target"){
|
||||
} else if (item === 'target') {
|
||||
json.with[i] = parse1204(data.networkTargetName)
|
||||
}
|
||||
})
|
||||
|
@ -100,7 +100,7 @@ module.exports = {
|
|||
json[i] = messageType.style[i]
|
||||
}
|
||||
b.emit('chat', {
|
||||
json: json,
|
||||
json,
|
||||
type: 'player',
|
||||
uuid: data.senderUuid,
|
||||
message: data.plainMessage,
|
||||
|
|
|
@ -23,7 +23,7 @@ const hexColorParser = (color) => {
|
|||
if (!consoleColors24.enabled || consoleColors24.bit === 4) { // Hex color parsing to the 4 bit mode has not been implemented yet
|
||||
return ''
|
||||
}
|
||||
if(consoleColors24.bit == 24){
|
||||
if (consoleColors24.bit === 24) {
|
||||
let out = '\x1B[0;'
|
||||
const redChannel = Number(`0x${color.slice(1, 3)}`)
|
||||
const greenChannel = Number(`0x${color.slice(3, 5)}`)
|
||||
|
@ -34,7 +34,7 @@ const hexColorParser = (color) => {
|
|||
out += '48;2;0;0;0;'
|
||||
}
|
||||
return out + `38;2;${redChannel};${greenChannel};${blueChannel}m`
|
||||
} else if(consoleColors24.bit == 8){
|
||||
} else if (consoleColors24.bit === 8) {
|
||||
let out = '\x1B[0;'
|
||||
const redChannel = Number(`0x${color.slice(1, 3)}`)
|
||||
const greenChannel = Number(`0x${color.slice(3, 5)}`)
|
||||
|
@ -44,10 +44,10 @@ const hexColorParser = (color) => {
|
|||
} else if (consoleColors24.lightMode && ((redChannel > 194 && greenChannel > 194 && blueChannel > 194) || greenChannel > 154)) {
|
||||
out += '48;5;16;'
|
||||
}
|
||||
let redOut = process8bitColorChannel(redChannel);
|
||||
let greenOut = process8bitColorChannel(greenChannel);
|
||||
let blueOut = process8bitColorChannel(blueChannel);
|
||||
let colorValue = 16 + 36 * redOut + 6 * greenOut + blueOut
|
||||
const redOut = process8bitColorChannel(redChannel)
|
||||
const greenOut = process8bitColorChannel(greenChannel)
|
||||
const blueOut = process8bitColorChannel(blueChannel)
|
||||
const colorValue = 16 + 36 * redOut + 6 * greenOut + blueOut
|
||||
return out + `38;5;${colorValue}m`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
const lang = require('./mc_lang.js')
|
||||
|
||||
const consoleColors = {
|
||||
dark_red: "§4",
|
||||
red: "§c",
|
||||
dark_green: "§2",
|
||||
green: "§a",
|
||||
gold: "§6",
|
||||
yellow: "§e",
|
||||
dark_blue: "§1",
|
||||
blue: "§9",
|
||||
dark_purple: "§5",
|
||||
light_purple: "§d",
|
||||
dark_aqua: "§3",
|
||||
aqua: "§b",
|
||||
black: "§0",
|
||||
gray: "§7",
|
||||
dark_gray: "§8",
|
||||
white: "§f",
|
||||
reset: "§r§f"
|
||||
dark_red: '§4',
|
||||
red: '§c',
|
||||
dark_green: '§2',
|
||||
green: '§a',
|
||||
gold: '§6',
|
||||
yellow: '§e',
|
||||
dark_blue: '§1',
|
||||
blue: '§9',
|
||||
dark_purple: '§5',
|
||||
light_purple: '§d',
|
||||
dark_aqua: '§3',
|
||||
aqua: '§b',
|
||||
black: '§0',
|
||||
gray: '§7',
|
||||
dark_gray: '§8',
|
||||
white: '§f',
|
||||
reset: '§r§f'
|
||||
}
|
||||
|
||||
const processColor = (col, rcol) => {
|
||||
|
|
|
@ -33,11 +33,11 @@ const rsg = function (count) {
|
|||
const rsgLegal = function (count) {
|
||||
let output = ''
|
||||
if (Math.random() > 0.5) {
|
||||
output += "uwu_"
|
||||
output += 'uwu_'
|
||||
} else {
|
||||
output += "owo_"
|
||||
output += 'owo_'
|
||||
}
|
||||
output += crypto.randomBytes(count).toString("hex")
|
||||
output += crypto.randomBytes(count).toString('hex')
|
||||
return output
|
||||
}
|
||||
module.exports = function (legal) {
|
||||
|
|
Loading…
Reference in a new issue