Remove some codes

This commit is contained in:
7cc5c4f330d47060 2024-10-23 22:51:35 -04:00
parent ab593cfd7d
commit e87c85c0c1
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
14 changed files with 21 additions and 37 deletions

View file

@ -1,4 +1,4 @@
const load = (b) => { export function load (b) {
b._client.on('login', () => { b._client.on('login', () => {
b.interval.chatQueue = setInterval(() => { b.interval.chatQueue = setInterval(() => {
if (b.chatqueue.length !== 0) { if (b.chatqueue.length !== 0) {
@ -16,4 +16,3 @@ const load = (b) => {
}) })
} }
} }
export { load }

View file

@ -7,7 +7,7 @@ const cs = {
z: 4 z: 4
} }
const load = function (b) { export function load (b) {
b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000) b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000)
b.ccq = [] b.ccq = []
b.blocknoX = 0 b.blocknoX = 0
@ -136,5 +136,3 @@ const load = function (b) {
} }
} }
} }
export { load }

View file

@ -1,4 +1,3 @@
const load = (b) => { export function load (b) {
console.log(`Test plugin loaded on bot ${b.id}`) console.log(`Test plugin loaded on bot ${b.id}`)
} }
export { load }

View file

@ -1,7 +1,7 @@
import { parse2 as parse } from '../util/chatparse_plain.js' import { parse2 as parse } from '../util/chatparse_plain.js'
import { parse as parseNBT } from '../util/parseNBT.js' import { parse as parseNBT } from '../util/parseNBT.js'
const load = (b) => { export function load (b) {
b.players = {} b.players = {}
b._client.on('player_info', (data) => { b._client.on('player_info', (data) => {
const buffer2 = {} const buffer2 = {}
@ -73,4 +73,3 @@ const load = (b) => {
} }
} }
} }
export { load }

View file

@ -1,5 +1,5 @@
import { createBot } from "../index.js" import { createBot } from "../index.js"
const load = (b) => { export function load (b) {
b._client.on('end', () => { b._client.on('end', () => {
b.info(`Bot ${b.id} disconnected`) b.info(`Bot ${b.id} disconnected`)
for (const i in b.interval) { for (const i in b.interval) {
@ -11,4 +11,3 @@ const load = (b) => {
}, 5000) }, 5000)
}) })
} }
export { load }

View file

@ -14,7 +14,7 @@ class SCTask {
} }
const load = (b) => { export function load (b) {
b.sc_tasks = {} b.sc_tasks = {}
b.selfcareRun = 0 b.selfcareRun = 0
b.interval.sc = setInterval(() => { b.interval.sc = setInterval(() => {
@ -130,4 +130,3 @@ const load = (b) => {
}) })
} }
} }
export { load }

View file

@ -45,7 +45,7 @@ for (const plugin of bpl) {
} }
const load = (b) => { export function load (b) {
b.messageCount = 0 b.messageCount = 0
b.chatDisabledUntil = 0 b.chatDisabledUntil = 0
b.interval.antiSpam = setInterval(() => { b.interval.antiSpam = setInterval(() => {
@ -193,5 +193,3 @@ const load = (b) => {
b.displayChat(data.type, data.subtype, `${msgConsole}\x1b[0m`) b.displayChat(data.type, data.subtype, `${msgConsole}\x1b[0m`)
}) })
} }
export { load }

View file

@ -119,7 +119,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
const parse2 = function (_data, l, resetColor) { export function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {
@ -127,4 +127,3 @@ const parse2 = function (_data, l, resetColor) {
return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}`
} }
} }
export { parse2 }

View file

@ -85,7 +85,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
const parse2 = function (_data, l, resetColor) { export function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {
@ -93,4 +93,3 @@ const parse2 = function (_data, l, resetColor) {
return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}`
} }
} }
export { parse2 }

View file

@ -87,7 +87,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
const parse2 = function (_data, l, resetColor) { export function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {
@ -95,4 +95,3 @@ const parse2 = function (_data, l, resetColor) {
return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}`
} }
} }
export { parse2 }

View file

@ -46,7 +46,7 @@ const parse = function (_data, l = 0) {
} }
return out return out
} }
const parse2 = function (_data, l) { export function parse2 (_data, l) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {
@ -54,4 +54,3 @@ const parse2 = function (_data, l) {
return `An error occured while parsing a message. See console for more information. JSON that caused the error: ${JSON.stringify(_data)}` return `An error occured while parsing a message. See console for more information. JSON that caused the error: ${JSON.stringify(_data)}`
} }
} }
export { parse2 }

View file

@ -1,5 +1,5 @@
import { processNbtMessage } from 'prismarine-chat' import { processNbtMessage } from 'prismarine-chat'
const parse = function (data) { export function parse (data) {
if (typeof data.type === 'string') { if (typeof data.type === 'string') {
return JSON.parse(processNbtMessage(data)) return JSON.parse(processNbtMessage(data))
} else if (typeof data === 'string') { } else if (typeof data === 'string') {
@ -8,4 +8,3 @@ const parse = function (data) {
return data return data
} }
} }
export { parse }

View file

@ -1,5 +1,4 @@
import { randomBytes } from "crypto"; import { randomBytes } from "crypto";
const generateUser = function (legal) { export function generateUser (legal) {
return `${parseInt(randomBytes(4).toString("hex"),16).toString(36)}${parseInt(randomBytes(4).toString("hex"),16).toString(36)}` return `${parseInt(randomBytes(4).toString("hex"),16).toString(36)}${parseInt(randomBytes(4).toString("hex"),16).toString(36)}`
} }
export { generateUser }

View file

@ -1,6 +1,5 @@
const uuidToInt = function (uuid) { export function uuidToInt (uuid) {
const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return `0x${a}` }).match(/.{1,10}/g) const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return `0x${a}` }).match(/.{1,10}/g)
const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0] const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0]
return numUUID return numUUID
} }
export { uuidToInt }