Commit graph

429 commits

Author SHA1 Message Date
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
7cc5c4f330d47060
47b007cf9a Remove prefix from help 2024-07-30 00:36:53 -04:00
5fbd6a2650 Remove ubot branding 2024-07-29 23:19:42 -04:00
5b31f4727b Remove ubot branding 2024-07-29 23:18:57 -04:00
7cc5c4f330d47060
ccca43c919 Add tpr to readme 2024-07-29 19:12:45 -04:00
7cc5c4f330d47060
77a07ea3f4 -s does not exist anymore 2024-07-29 19:12:08 -04:00
7cc5c4f330d47060
9c3a240f2e Add npm install to readme 2024-07-29 19:11:18 -04:00
7cc5c4f330d47060
014707a843 Make tpr use translations 2024-07-29 19:06:52 -04:00
7cc5c4f330d47060
7eb57edaa8 Update bash launcher 2024-07-29 18:27:16 -04:00
7cc5c4f330d47060
813704d0c3 Update Windows launcher 2024-07-29 18:23:51 -04:00
7cc5c4f330d47060
f37d62f571 Seperate stop and restart 2024-07-29 18:20:00 -04:00
7cc5c4f330d47060
4cdc4f22fe Make tpr work at console 2024-07-29 18:11:03 -04:00
7cc5c4f330d47060
6e97bae39e pink eraser 2024-07-29 18:04:08 -04:00