Commit graph

441 commits

Author SHA1 Message Date
b1724744a0 OMAGAD ONEPLUS 2024-08-01 21:40:58 -04:00
7bad033c97 Finish chat parser rewrite 2024-08-01 20:32:14 -04:00
f85a34481b Start chat parser rewrite 2024-08-01 20:11:59 -04:00
eb89f9e657 sg.usage": " <message>",
"command.netmsg.desc": "Send a message to all servers the bot is connected to",
	"command.refill.usage": "",
	"command.refill.desc": "Refill core",
	"command.say.usage": " <message>",
	"command.say.desc": "Sends a message to chat",
	"command.serverinfo.usage": "",
	"command.serverinfo.desc": "Get system/bot info",
	"command.stop.usage": "",
	"command.stop.desc": "Restart bot",
	"command.template.usage": " <required> [optional]",
	"command.template.desc": "Does nothing",
	"command.tpr.desc": "Teleport to a random location",
    "command.tpr.usage": "",
	"command.verify.usage": " [args...]",
	"command.verify.desc": "Check the hashing system",
	"command.about.author": "%s - a Minecraft bot made by 77c8f4699b732c11 / a5a06d596f15c7db",
	"command.about.version": "Version %s",
	"command.about.sourceCode": "Source code: %s",
	"command.about.sourceCode.openInBrowser": "Click to o
2024-08-01 20:00:46 -04:00
4a4b992c69 Console colors 2024-08-01 19:58:13 -04:00
ffa68f81b6 Merge branch 'main' of https://code.chipmunk.land/7cc5c4f330d47060/botvX 2024-08-01 19:55:12 -04:00
33cd9adf67 Chat parser 2024-08-01 19:55:09 -04:00
111ba7ba25 We have to patch prismarine-chat because minecraft-protocol depends on it...
revert Add error handler to this for some reason
I got a maximum call stack size exceeded error in this code...
2024-08-01 00:21:28 -04:00
5f3a41a1a0 revert 2b87fd14cc
revert Fix chatparse_1204 error handler
2024-08-01 00:20:34 -04:00
4f2c7af996 Merge branch 'main' of https://code.chipmunk.land/7cc5c4f330d47060/botvX 2024-07-31 16:10:10 -04:00
f09b341ac9 Add strings 2024-07-31 16:09:51 -04:00
e2f1d7da43 Add source code link hover to about, make hover texts compatible with 20w14i 2024-07-31 16:08:04 -04:00
38f38dda2a Change internal fallback player name 2024-07-31 06:08:07 -04:00
0bf088f548 Stereo Madness 2024-07-31 06:05:09 -04:00
f63d7d4d77 Add node jndex.js to reamde 2024-07-31 06:03:45 -04:00
27766c8c56 Update plugins/commands/restart.js 2024-07-31 05:56:20 -04:00
20fb934a02 Update plugins/commands/stop.js 2024-07-31 05:55:57 -04:00
1cab040f8d Remove minecraft section sign chat 2024-07-31 05:30:35 -04:00
6f1271ba81 This wouldn't even work anymore 2024-07-31 02:57:43 -04:00
12391e8db4 Vanilla server support 2024-07-31 01:08:51 -04:00
2b87fd14cc Fix chatparse_1204 error handler 2024-07-31 01:08:25 -04:00
5b8f9852a0 20w13b bugfix 2024-07-31 00:31:43 -04:00
83fc1d169d Add per-server version override in settings 2024-07-31 00:24:13 -04:00
5ab32db8d5 Fix legacy chat 2024-07-31 00:24:00 -04:00
5b77fae298 Remove unused and un-implemented Minecraft format 2024-07-30 18:13:27 -04:00
c3fa4ae039 Bugfixes 2024-07-30 18:11:47 -04:00
4c99aa3d4b BugFix white terminal 2024-07-30 17:17:30 -04:00
93c4835728 Add support for 8/4 bit color and white terminals 2024-07-30 17:14:41 -04:00
9f99a1bbf1 Add error handler to this for some reason
I got a maximum call stack size exceeded error in this code...
2024-07-30 15:40:28 -04:00
b5da5fe50c Re-add everything 2024-07-30 05:56:23 -04:00
3ba92d1460 Remove everything 2024-07-30 05:55:39 -04:00
7cc5c4f330d47060
a50c6bdd4c "minecraft-protocol": "^1.45.0", 2024-07-30 03:44:42 -04:00
cea4fd0388 revert 2249b4bb44
revert revert 6c7b4815c6

revert Update package.json
2024-07-30 03:44:13 -04:00
7cc5c4f330d47060
edf56e36ec Copyright (c) 2024 7cc5c4f330d47060 2024-07-30 03:43:14 -04:00
d36fbc0209 I have to manually revert...
revert Update package.json
2024-07-30 03:41:36 -04:00
b68856e416 I have to manually revert...
revert revert d1a1f9145d

revert Update LICENSE
2024-07-30 03:41:10 -04:00
7cc5c4f330d47060
1694977ddb const os = require('os')
const cp = require('child_process')
const version = require('../../version.json')
const {getMessage,formatTime} = require('../../util/lang.js')
const fs = require('fs')
const gr = function (l, text, value, color) {
  if (!color) color = 'white'
  return {
    translate: '%s: %s',
    color: color.primary,
    with: [
      {
        text,
        color: color.secondary
      },
      {
        text: value,
        color: color.primary
      }
    ],
    hoverEvent: {
      action: 'show_text',
      contents: {
        text: getMessage(l, 'copyText')
      }
    },
    clickEvent: {
      action: 'copy_to_clipboard',
      value
    }
  }
}

const os2 = function (o2, l) {
  switch (o2) {
    case 'win32':
      return `${os.version()} (${os.release})`
    case 'android':
      return getMessage(l, 'command.serverinfo.os.android')
    case 'linux':
      return getMessage(l, 'command.serverinfo.os.linux', [os.release()])
    default:
      return o2
  }
}
module.exports = {
  execute: function (c) {
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os'), os2(process.platform, c.lang), c.colors))
    if (os.cpus()[0]) c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.processor'), os.cpus()[0].model, c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.arch'), os.machine(), c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.osUsername'), `${os.userInfo().username} (${os.userInfo().uid})`, c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.hostName'), os.hostname(), c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.workingDir'), process.cwd(), c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.runTime'), formatTime(process.uptime() * 1000, c.lang), c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.upTime'), formatTime(os.uptime() * 1000, c.lang), c.colors))
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.nodeVersion'), process.version, c.colors))
    if (process.platform === 'linux' || process.platform === 'freebsd') {
      try {
        const osrelease = fs.readFileSync('/etc/os-release').toString('UTF-8').split('\n')
        const osrelease2 = {}
        for (const i in osrelease) {
          if (!osrelease[i].includes('=')) continue
          let osrvalue = osrelease[i].split('=')[1]
          if (osrvalue.startsWith('"') && osrvalue.endsWith('"')) { osrvalue = osrvalue.slice(1, osrvalue.length - 1) };
          osrelease2[osrelease[i].split('=')[0]] = osrvalue
        }

        if (osrelease2.PRETTY_NAME) {
          c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.osRelease'), osrelease2.PRETTY_NAME, c.colors))
        }
      } catch (e) {
        c.reply({ text: getMessage(c.lang, 'command.serverinfo.osRelease.missing') })
      }
    } else if (process.platform === 'android') {
      const androidVersion = cp.execSync('getprop ro.build.version.release').toString('UTF-8').split('\n')[0]
      c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os.android.version'), androidVersion, c.colors))
      const dModel = cp.execSync('getprop ro.product.model').toString('UTF-8').split('\n')[0]
      const dBrand = cp.execSync('getprop ro.product.brand').toString('UTF-8').split('\n')[0]
      c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os.android.model'), dBrand + ' ' + dModel, c.colors))
    }
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.botName'), version.botName, c.colors))
    let botVersion = version.botVersion
    let gitCommit
    let gitBranch
    try {
      gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0]
      gitBranch = cp.execSync('git rev-parse --abbrev-ref HEAD').toString('UTF-8').split('\n')[0]
    } catch (e) {
      gitCommit = false
      gitBranch = false
    }
    if (gitCommit) {
      botVersion += ` (${gitCommit} - ${gitBranch})`
    }
    c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.botVer'), botVersion, c.colors))
  }
}
2024-07-30 03:39:39 -04:00
7cc5c4f330d47060
1f691af405 move formattime to the language file 2024-07-30 03:38:44 -04:00
7cc5c4f330d47060
49b217901c Fix commands 2024-07-30 03:11:35 -04:00
7cc5c4f330d47060
7458a8e1a2 Make errors work properly 2024-07-30 03:05:47 -04:00
7cc5c4f330d47060
bb01a69fac Merge branch 'main' of https://code.chipmunk.land/7cc5c4f330d47060/botvX 2024-07-30 03:03:26 -04:00
7cc5c4f330d47060
45fb241752 Break the bot (I have to work on the other branch) 2024-07-30 03:03:22 -04:00
d6710b7eca revert d1a1f9145d
revert Update LICENSE
2024-07-30 02:24:23 -04:00
2249b4bb44 revert 6c7b4815c6
revert Update package.json
2024-07-30 02:24:09 -04:00
6c7b4815c6 Update package.json 2024-07-30 02:23:12 -04:00
d1a1f9145d Update LICENSE 2024-07-30 02:22:49 -04:00
7cc5c4f330d47060
887518b813 Lint 2024-07-30 01:41:20 -04:00
7cc5c4f330d47060
831f6e2878 Rewrite username generator 2024-07-30 01:39:26 -04:00
7cc5c4f330d47060
49d18bfff3 Bugfix 2024-07-30 00:42:56 -04:00
7cc5c4f330d47060
76719a0f9b Merge branch 'main' of https://code.chipmunk.land/7cc5c4f330d47060/botvX 2024-07-30 00:37:16 -04:00