Merge branch 'main' of https://code.chipmunk.land/7cc5c4f330d47060/botvX
This commit is contained in:
commit
b950a12be3
30 changed files with 1153 additions and 1 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -151,3 +151,14 @@ dist
|
|||
|
||||
# Bot Settings
|
||||
settings.json
|
||||
|
||||
# Default secret file
|
||||
secret.json
|
||||
|
||||
# botvX user settings
|
||||
userPref/
|
||||
|
||||
# botvX log files
|
||||
UBotLogs/
|
||||
botvXLogs/
|
||||
logs/
|
||||
|
|
88
commands/serverinfo.js
Executable file
88
commands/serverinfo.js
Executable file
|
@ -0,0 +1,88 @@
|
|||
const os = require('os')
|
||||
const cp = require('child_process')
|
||||
const { getMessage, formatTime } = require('../util/lang.js')
|
||||
const fs = require('fs')
|
||||
const botVersion = require('../util/version.js')
|
||||
|
||||
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')
|
||||
},
|
||||
value: { // Added twice for backwards compatibility
|
||||
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.botVer'), botVersion, c.colors))
|
||||
}
|
||||
}
|
34
commands/test.js
Normal file
34
commands/test.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const { getMessage } = require('../util/lang.js')
|
||||
module.exports = {
|
||||
execute: (c) => {
|
||||
const reply = function (name, item) {
|
||||
return {
|
||||
translate: '%s: %s',
|
||||
color: c.colors.primary,
|
||||
with: [
|
||||
{
|
||||
text: getMessage(c.lang, `command.test.${name}`),
|
||||
color: c.colors.secondary
|
||||
},
|
||||
{
|
||||
text: item,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
c.reply(reply('uuid', c.uuid))
|
||||
c.reply(reply('username', c.username))
|
||||
c.reply(reply('nickname', c.nickname))
|
||||
c.reply(reply('command', c.command))
|
||||
c.reply(reply('msgType', c.msgType))
|
||||
c.reply(reply('prefix', c.prefix))
|
||||
c.reply(reply('args', c.args.join(', ')))
|
||||
c.reply(reply('verify', c.verify.toString()))
|
||||
c.reply(reply('host', c.host))
|
||||
c.reply(reply('port', c.port.toString()))
|
||||
c.reply(reply('lang', c.lang))
|
||||
c.reply(reply('colorPrimary', c.colors.primary))
|
||||
c.reply(reply('colorSecondary', c.colors.secondary))
|
||||
}
|
||||
}
|
118
lang/en-US.json
Normal file
118
lang/en-US.json
Normal file
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
"language.name": "English",
|
||||
"language.region": "United States",
|
||||
"time.week": " week ",
|
||||
"time.weekPlural": " weeks ",
|
||||
"time.day": " day ",
|
||||
"time.dayPlural": " days ",
|
||||
"time.hour": " hour ",
|
||||
"time.hourPlural": " hours ",
|
||||
"time.minute": " minute ",
|
||||
"time.minutePlural": " minutes ",
|
||||
"time.second": " second ",
|
||||
"time.secondPlural": " seconds ",
|
||||
"command.about.usage": "",
|
||||
"command.about.desc": "About the bot",
|
||||
"command.cb.usage": " <command>",
|
||||
"command.cb.desc": "Run a command in a command block",
|
||||
"command.cloop.usage": " add <rate> <command>|| remove <index>|| list|| clear",
|
||||
"command.cloop.desc": "Manage command loops",
|
||||
"command.eval.usage": " <code>",
|
||||
"command.eval.desc": "Run JavaScript code",
|
||||
"command.help.usage": " [cmd]",
|
||||
"command.help.desc": "Shows command help",
|
||||
"command.logoff.usage": "",
|
||||
"command.logoff.desc": "Disconnect and reconnect the bot from a server",
|
||||
"command.netmsg.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.settings.usage": " get|| set <key> <value>",
|
||||
"command.settings.desc": "Set your user preferences",
|
||||
"command.stop.usage": "",
|
||||
"command.stop.desc": "Restart bot",
|
||||
"command.template.usage": " <required> [optional]",
|
||||
"command.template.desc": "Does nothing",
|
||||
"command.test.usage": " [args...]",
|
||||
"command.test.desc": "Chat parsing debugger command",
|
||||
"command.tpr.usage": "",
|
||||
"command.tpr.desc": "Teleport to a random location",
|
||||
"command.verify.usage": " [args...]",
|
||||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minecraft bot made by %s for Kaboom and clones",
|
||||
"command.about.version": "Version %s",
|
||||
"command.about.preRelease": "This is a development version - there may be errors, and features may be changed or removed at any time. Please report any errors to the bot's developer.",
|
||||
"command.about.sourceCode": "Source code: %s",
|
||||
"command.about.sourceCode.openInBrowser": "Click to open the source code link in your default browser",
|
||||
"command.cloop.error.tooShort": "Command loops must have a rate above 20ms.",
|
||||
"command.cloop.error.subcommand": "Unknown subcommand, please do %s",
|
||||
"command.cloop.success.add": "Added command loop with command %s and rate %s",
|
||||
"command.cloop.success.remove": "Removed command loop %s",
|
||||
"command.cloop.success.clear": "Cleared all command loops",
|
||||
"command.cloop.list": "%s: Command: %s Rate: %s",
|
||||
"command.help.cmdList": "Commands:",
|
||||
"command.help.commandInfo": "%s%s - %s",
|
||||
"command.help.commandUsage": "Usage - %s%s",
|
||||
"command.help.commandDesc": "Description - %s",
|
||||
"command.help.commandPerms": "Required permissions - %s",
|
||||
"command.help.permsNormal": "Normal",
|
||||
"command.help.permsTrusted": "Trusted",
|
||||
"command.help.permsOwner": "Owner",
|
||||
"command.help.permsConsole": "Console",
|
||||
"command.help.noCommand": "Command does not exist",
|
||||
"command.help.alias": "Alias to %s",
|
||||
"command.netmsg.disabled": "This command has been disabled on this server.",
|
||||
"command.settings.get.colorPrimary": "Primary color",
|
||||
"command.settings.get.colorSecondary": "Secondary color",
|
||||
"command.settings.get.language": "Language",
|
||||
"command.settings.setLanguage": "Run %s to set this as your language",
|
||||
"command.settings.error.invalidKey": "Invalid key",
|
||||
"command.settings.error.invalidLanguage": "Invalid language",
|
||||
"command.settings.error.mustProvideValue": "You must provide a value",
|
||||
"command.settings.saved": "Settings saved.",
|
||||
"command.test.uuid": "UUID",
|
||||
"command.test.username": "Username",
|
||||
"command.test.nickname": "Nickname",
|
||||
"command.test.command": "Command",
|
||||
"command.test.msgType": "Message type",
|
||||
"command.test.prefix": "Prefix",
|
||||
"command.test.args": "Arguments",
|
||||
"command.test.verify": "Permission level",
|
||||
"command.test.host": "Server host",
|
||||
"command.test.port": "Server port",
|
||||
"command.test.lang": "Language",
|
||||
"command.test.colorPrimary": "Primary color",
|
||||
"command.test.colorSecondary": "Secondary color",
|
||||
"command.about.serverInfo.os.android": "Android %s",
|
||||
"command.about.serverInfo.os.android.noVersion": "Android",
|
||||
"command.about.serverInfo.os.freebsd": "FreeBSD",
|
||||
"command.about.serverInfo.os.linux": "Linux",
|
||||
"command.about.serverInfo.os.macos": "macOS",
|
||||
"command.about.serverInfo.os.macos_old": "OS X",
|
||||
"command.about.serverInfo.os": "Operating system",
|
||||
"command.about.serverInfo.kernelVer": "Kernel version",
|
||||
"command.about.serverInfo.processor": "CPU",
|
||||
"command.about.serverInfo.arch": "Architecture",
|
||||
"command.about.serverInfo.osUsername": "Username",
|
||||
"command.about.serverInfo.hostName": "Hostname",
|
||||
"command.about.serverInfo.workingDir": "Working directory",
|
||||
"command.about.serverInfo.runTime": "Bot uptime",
|
||||
"command.about.serverInfo.upTime": "System uptime",
|
||||
"command.about.serverInfo.nodeVersion": "Node.js version",
|
||||
"command.about.serverInfo.osRelease": "Linux release",
|
||||
"command.about.serverInfo.osRelease.missing": "/etc/os-release does not exist. Information may be limited.",
|
||||
"command.about.serverInfo.os.android.version": "Android version",
|
||||
"command.about.serverInfo.os.android.model": "Device model",
|
||||
"command.about.serverInfo.botName": "Bot name",
|
||||
"command.about.serverInfo.botVer": "Bot version",
|
||||
"command.about.serverListItem": "Server %s - %s",
|
||||
"command.tpr.success": "Teleporting %s to %s, %s, %s",
|
||||
"command.verify.success": "Successfully verified with permission level %s",
|
||||
"command.error": "An error occured (check console for more info)",
|
||||
"command.disallowed.perms": "You do not have permission to run this command. If you do have permission, please make sure you put the command hash at the end, or ran the command through your client's hashing system.",
|
||||
"command.disallowed.perms.yourLevel": "Your permission level: %s",
|
||||
"command.disallowed.perms.cmdLevel": "Command requires: %s",
|
||||
"copyText": "Click to copy!"
|
||||
}
|
32
plugins/chatlog.js
Executable file
32
plugins/chatlog.js
Executable file
|
@ -0,0 +1,32 @@
|
|||
const chatlog = require('../util/chatlog.js')
|
||||
const fs = require('fs')
|
||||
const settings = require('../settings.json')
|
||||
|
||||
const checkLog = () => {
|
||||
if (settings.disableLogging) return
|
||||
try {
|
||||
if (!fs.readdirSync('.').includes('logs')) fs.mkdirSync('logs')
|
||||
const dateToday = new Date(Date.now())
|
||||
const dateTomorrow = new Date(Date.now() + 86400000)
|
||||
const filenameToday = `${dateToday.getUTCMonth() + 1}-${dateToday.getUTCDate()}-${dateToday.getUTCFullYear()}`
|
||||
const filenameTomorrow = `${dateTomorrow.getUTCMonth() + 1}-${dateTomorrow.getUTCDate()}-${dateTomorrow.getUTCFullYear()}`
|
||||
if (!fs.readdirSync('./logs').includes(filenameToday)) fs.mkdirSync(`logs/${filenameToday}`)
|
||||
if (!fs.readdirSync('./logs').includes(filenameTomorrow)) fs.mkdirSync(`logs/${filenameTomorrow}`) // Create tomorrow's log directory early
|
||||
} catch (e) {
|
||||
console.log(e) // Prevents some crashes when disk space is full or when the permissions are incorrect
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(checkLog, 3600000) // Runs once every hour,
|
||||
checkLog() // and at bot startup.
|
||||
|
||||
module.exports = {
|
||||
load: (b) => {
|
||||
b.on('plainchat', (msg, type) => {
|
||||
if (!settings.disableLogging && !settings.disableChatLogging) chatlog(`chat_${b.host.host}_${b.host.port}`, `[${type}] ${msg}`)
|
||||
})
|
||||
b.on('command', (name, uuid, text) => {
|
||||
if (!settings.disableLogging && !settings.disableCommandLogging) chatlog(`cmd_${b.host.host}_${b.host.port}`, `${name} (${uuid}): ${text}`)
|
||||
})
|
||||
}
|
||||
}
|
79
plugins/commands/about.js
Normal file
79
plugins/commands/about.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
const version = require("../../version.json")
|
||||
const settings = require('../../settings.json')
|
||||
const getMessage = require('../../util/lang.js')
|
||||
const cp = require('child_process')
|
||||
module.exports = {
|
||||
execute: function (c) {
|
||||
c.reply({
|
||||
translate: getMessage(c.lang,"command.about.author"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:settings.name,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
});
|
||||
c.reply({text:""});
|
||||
let botVersion=version.bot;
|
||||
let gitCommit;
|
||||
try {
|
||||
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0];
|
||||
} catch(e){
|
||||
gitCommit = false
|
||||
}
|
||||
if(gitCommit){
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.version"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
[
|
||||
{
|
||||
text:botVersion,
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
translate:" (%s)",
|
||||
color: "white",
|
||||
with:[
|
||||
{
|
||||
text:gitCommit,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
} else {
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.version"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:botVersion,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
c.reply({text:""});
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.serverinfo"),
|
||||
color: c.colors.secondary,
|
||||
with: [
|
||||
{
|
||||
translate: "\"%s\"",
|
||||
color: "white",
|
||||
with: [
|
||||
{
|
||||
text: "serverinfo",
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
},
|
||||
aliases: ["info"]
|
||||
}
|
7
plugins/commands/cb.js
Normal file
7
plugins/commands/cb.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
c.bot.ccq.push(c.args.join(" "))
|
||||
},
|
||||
consoleIndex: true,
|
||||
aliases: ["commandblock", "cmdblock"]
|
||||
}
|
79
plugins/commands/cloop.js
Normal file
79
plugins/commands/cloop.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
const getMessage = require('../../util/lang.js')
|
||||
module.exports={
|
||||
execute: (c)=>{
|
||||
const subcmd=c.args.splice(0,1)[0];
|
||||
switch(subcmd){
|
||||
case "add":
|
||||
const rate=+(c.args.splice(0,1)[0]);
|
||||
const command=c.args.join(" ");
|
||||
if(rate<20){
|
||||
c.reply({
|
||||
text:getMessage(c.lang,"command.cloop.error.tooShort")
|
||||
})
|
||||
}
|
||||
c.bot.addCloop(command,rate)
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.success.add"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:command,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:rate+"",
|
||||
color:c.colors.primary
|
||||
},
|
||||
]
|
||||
})
|
||||
break
|
||||
case "remove":
|
||||
const index=+c.args[0];
|
||||
c.bot.removeCloop(c.args[0]);
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.success.remove"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:index+"",
|
||||
color:c.colors.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
break
|
||||
case "list":
|
||||
for(const i in c.bot.cloops){
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.list"),
|
||||
color: c.colors.secondary,
|
||||
with: [
|
||||
{
|
||||
text:i,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:c.bot.cloops[i].command,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:c.bot.cloops[i].rate+"",
|
||||
color:c.colors.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
break
|
||||
case "clear":
|
||||
c.bot.clearCloops();
|
||||
c.reply({
|
||||
text:getMessage(c.lang,"command.cloop.success.clear"),
|
||||
color: c.colors.secondary
|
||||
})
|
||||
break
|
||||
default:
|
||||
c.reply(`Unknown subcommand, please do ${c.prefix}help cloop`)
|
||||
}
|
||||
},
|
||||
consoleIndex: true,
|
||||
level: 0
|
||||
}
|
11
plugins/commands/eval.js
Normal file
11
plugins/commands/eval.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const index=require("../../index.js") // Not used in the code, but may be used by users of the command
|
||||
module.exports={
|
||||
execute: (c)=>{
|
||||
try{
|
||||
console.log(eval(c.args.join(" ")));
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
level: 3
|
||||
}
|
12
plugins/commands/help.js
Normal file
12
plugins/commands/help.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
if(c.args.length>0){
|
||||
c.bot.printCmdHelp(c.uuid,c.args[0],c.lang);
|
||||
} else {
|
||||
c.bot.printHelp(c.uuid,c.prefix,c.lang);
|
||||
}
|
||||
},
|
||||
aliases: [
|
||||
"heko" //Parker2991 request
|
||||
]
|
||||
}
|
7
plugins/commands/logoff.js
Normal file
7
plugins/commands/logoff.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
c.bot._client.end();
|
||||
},
|
||||
consoleIndex: true,
|
||||
level: 2
|
||||
}
|
35
plugins/commands/netmsg.js
Normal file
35
plugins/commands/netmsg.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const {bot}=require("../../index.js");
|
||||
module.exports={
|
||||
execute: (c)=>{
|
||||
const json={
|
||||
translate: "[%s] %s: %s",
|
||||
with:[
|
||||
{
|
||||
translate: "%s:%s",
|
||||
with:[
|
||||
{
|
||||
text: c.host,
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
text: c.port+"",
|
||||
color: c.colors.primary
|
||||
}
|
||||
],
|
||||
color: c.colors.secondary
|
||||
},
|
||||
{
|
||||
text: c.username,
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
text: c.args.join(" ")
|
||||
},
|
||||
],
|
||||
color: "white"
|
||||
}
|
||||
for(const i in bot){
|
||||
bot[i].tellraw("@a",json)
|
||||
}
|
||||
}
|
||||
}
|
7
plugins/commands/refill.js
Normal file
7
plugins/commands/refill.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
c.bot.chat(`/fill ~ 55 ~ ~3 60 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`)
|
||||
},
|
||||
consoleIndex: true,
|
||||
aliases: ["refillcore", "rc"]
|
||||
}
|
7
plugins/commands/say.js
Normal file
7
plugins/commands/say.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
if(c.args[0].startsWith("/") && c.verify<1) return;
|
||||
c.bot.chat(c.args.join(" "))
|
||||
},
|
||||
consoleIndex: true
|
||||
}
|
99
plugins/commands/serverinfo.js
Executable file
99
plugins/commands/serverinfo.js
Executable file
|
@ -0,0 +1,99 @@
|
|||
const os = require('os')
|
||||
const cp = require('child_process')
|
||||
const settings = require('../../settings.json')
|
||||
const timeformat = require('../../util/timeformat.js')
|
||||
const version = require("../../version.json")
|
||||
const getMessage = 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()
|
||||
break
|
||||
case 'android':
|
||||
return getMessage(l,"command.serverinfo.os.android")
|
||||
break
|
||||
case 'linux':
|
||||
return getMessage(l,"command.serverinfo.os.linux",[os.release()])
|
||||
break
|
||||
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"), timeformat(process.uptime() * 1000),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.upTime"), timeformat(os.uptime() * 1000),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");
|
||||
let osrelease2={};
|
||||
for(const i in osrelease){
|
||||
if(!osrelease[i].includes("=")) continue;
|
||||
let osr_value=osrelease[i].split("=")[1];
|
||||
if(osr_value.startsWith("\"") && osr_value.endsWith("\"")){osr_value=osr_value.slice(1,osr_value.length-1)};
|
||||
osrelease2[osrelease[i].split("=")[0]]=osr_value;
|
||||
}
|
||||
|
||||
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 android_version = 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"), android_version,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"), settings.name,c.colors))
|
||||
let botVersion=version.bot;
|
||||
let gitCommit;
|
||||
try {
|
||||
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0];
|
||||
} catch(e){
|
||||
gitCommit = false
|
||||
}
|
||||
if(gitCommit){
|
||||
botVersion+=` (${gitCommit})`
|
||||
}
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botVer"), botVersion,c.colors))
|
||||
}
|
||||
}
|
7
plugins/commands/stop.js
Normal file
7
plugins/commands/stop.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
process.exit(0);
|
||||
},
|
||||
aliases: ["restart", "exit"],
|
||||
level: 2
|
||||
}
|
42
plugins/commands/template.js
Normal file
42
plugins/commands/template.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
//Blank template
|
||||
/*
|
||||
c.send(text, user?): Send text to all ("/tellraw @a")
|
||||
c.reply(text): Send text to command sender
|
||||
c.uuid: Unique identifier (UUID for Minecraft, Discord ID for Discord)
|
||||
c.username: Username of sender
|
||||
c.nickname: Nickname of sender when applicable
|
||||
c.command: Command string
|
||||
c.args: Arguments of command (above without the first section, and split at every space)
|
||||
c.prefix: Prefix being used to send the command (when applicable)
|
||||
c.bot: Bot that received the command. Will be different type based on where it was received
|
||||
c.type: Type of bot receiving the command ("minecraft", "console", "discord")
|
||||
c.lang: The language the player has selected, or the default if none
|
||||
c.colors: The color palette the player has selected, or the default if none
|
||||
*/
|
||||
},
|
||||
/*
|
||||
Command description and usage have been moved to the message files. The format for a basic command is:
|
||||
"command.(name).usage": " <required> [optional]",
|
||||
"command.(name).desc": "Insert description here...",
|
||||
replacing (name) with the name of the new command.
|
||||
Some more complex commands may have messages of their own, which should be placed there too.
|
||||
First, insert the following line near the top of the command's file (not in the execute function):
|
||||
const getMessage = require('../../util/lang.js')
|
||||
Then, to get a specific message:
|
||||
getMessage(c.lang,"(message key)",[(arguments, in an array (optional))])
|
||||
For example, this will show the "about" command's redirection to "serverinfo":
|
||||
getMessage(c.lang,"command.about.serverinfo")
|
||||
The with array can be used to add information to a message. For example:
|
||||
getMessage(lang,"command.help.commandInfo",["cmd","usage","desc"])
|
||||
shows the "help" command's formatting for command information, with some strings as items.
|
||||
That message would render as (in en-US):
|
||||
cmdusage - desc
|
||||
Extra information is inserted wherever there is a "%s" or a "%n$s", with n being the index of the item in the array.
|
||||
*/
|
||||
hidden: true, // To show the command on the help command list, remove this line (optional)
|
||||
consoleIndex: true, // When run from console, the second argument will be a bot ID (optional)
|
||||
aliases: ["example", "testing"], // Other command names that will work the same (optional)
|
||||
level: 0 // Permission level required to run this command (optional)
|
||||
}
|
11
plugins/commands/verify.js
Normal file
11
plugins/commands/verify.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
module.exports={
|
||||
execute: (c)=>{
|
||||
c.reply({
|
||||
text: c.verify+""
|
||||
})
|
||||
c.reply({
|
||||
text: c.command
|
||||
})
|
||||
},
|
||||
level: 1
|
||||
}
|
34
plugins/sc.js
Executable file
34
plugins/sc.js
Executable file
|
@ -0,0 +1,34 @@
|
|||
class SCTask{
|
||||
constructor (failTask,chatCommand,startFailed=false){
|
||||
/*
|
||||
* failed: Whether to run this task
|
||||
* failTask: Command to run when failed is true
|
||||
* chatCommand: Whether to run failTask in chat rather than in command block
|
||||
*/
|
||||
this.failed=startFailed;
|
||||
this.failTask=failTask;
|
||||
this.chatCommand=chatCommand;
|
||||
}
|
||||
}
|
||||
module.exports={
|
||||
load:()=>{
|
||||
|
||||
},
|
||||
loadBot:(b)=>{
|
||||
b.sc_tasks={};
|
||||
b.interval.sc=setInterval(()=>{
|
||||
for(const i in b.sc_tasks){
|
||||
if(b.sc_tasks[i].failed){
|
||||
if(b.sc_tasks[i].chatCommand){
|
||||
b.chat(b.sc_tasks[i].failTask)
|
||||
} else {
|
||||
b.ccq.push(b.sc_tasks[i].failTask) //Does not automatically reset
|
||||
}
|
||||
}
|
||||
}
|
||||
},1000)
|
||||
b.add_sc_task=(name,failTask,chatCommand,startFailed)=>{
|
||||
b.sc_tasks[name] = new SCTask(failTask,chatCommand,startFailed);
|
||||
}
|
||||
}
|
||||
}
|
16
plugins/sc_cspy.js
Executable file
16
plugins/sc_cspy.js
Executable file
|
@ -0,0 +1,16 @@
|
|||
|
||||
module.exports={
|
||||
load:()=>{
|
||||
|
||||
},
|
||||
loadBot:(b)=>{
|
||||
b.add_sc_task("cspy","/cspy on", true, true)
|
||||
b.on('plainchat', (msg) => {
|
||||
if (msg == "Successfully disabled CommandSpy") {
|
||||
b.sc_tasks["cspy"].failed = 1
|
||||
} else if (msg == "Successfully enabled CommandSpy") {
|
||||
b.sc_tasks["cspy"].failed = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
16
plugins/sc_gamemode.js
Executable file
16
plugins/sc_gamemode.js
Executable file
|
@ -0,0 +1,16 @@
|
|||
|
||||
module.exports={
|
||||
load:()=>{
|
||||
|
||||
},
|
||||
loadBot:(b)=>{
|
||||
b.add_sc_task("gamemode","/minecraft:gamemode creative", true)
|
||||
b._client.on('game_state_change', (p) => {
|
||||
if (p.reason == 3 && p.gameMode != 1) {
|
||||
b.sc_tasks["gamemode"].failed = 1
|
||||
} else if (p.reason == 3 && p.gameMode == 1) {
|
||||
b.sc_tasks["gamemode"].failed = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
19
plugins/sc_op.js
Executable file
19
plugins/sc_op.js
Executable file
|
@ -0,0 +1,19 @@
|
|||
|
||||
module.exports={
|
||||
load:()=>{
|
||||
|
||||
},
|
||||
loadBot:(b)=>{
|
||||
b.add_sc_task("op","/op @s[type=player]", true)
|
||||
b._client.on('login', (p) => {
|
||||
b.entityId = p.entityId
|
||||
})
|
||||
b._client.on('entity_status', (p) => {
|
||||
if (p.entityId == b.entityId && p.entityStatus == 24) {
|
||||
b.sc_tasks["op"].failed = 1
|
||||
} else if (p.entityId == b.entityId && p.entityStatus == 28) {
|
||||
b.sc_tasks["op"].failed = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
19
settings2.json
Executable file
19
settings2.json
Executable file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"secret":"./settings_s.json",
|
||||
"name": "Minecraft Bot",
|
||||
"version_mc": "1.20.4",
|
||||
"defaultLang": "en-US",
|
||||
"prefix":[
|
||||
"ubot:",
|
||||
"\""
|
||||
],
|
||||
"servers":[
|
||||
{
|
||||
"host": "kaboom.pw",
|
||||
"port": 25565,
|
||||
"options":{
|
||||
"name": "kaboom"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
17
util/chatlog.js
Normal file
17
util/chatlog.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const fs = require('fs')
|
||||
const settings = require('../settings.json')
|
||||
|
||||
module.exports = function (fileName, item) {
|
||||
if (settings.disableLogging) return
|
||||
const dateToday = new Date(Date.now())
|
||||
const UTCYears = dateToday.getUTCFullYear()
|
||||
const UTCMonths = dateToday.getUTCMonth() + 1
|
||||
const UTCDays = dateToday.getUTCDate()
|
||||
const UTCHours = dateToday.getUTCHours()
|
||||
const UTCMinutes = dateToday.getUTCMinutes().toString().padStart(2, '0')
|
||||
const UTCSeconds = dateToday.getUTCSeconds().toString().padStart(2, '0')
|
||||
const UTCMilliSeconds = dateToday.getUTCMilliseconds().toString().padStart(3, '0')
|
||||
const filenameToday = `${UTCMonths}-${UTCDays}-${UTCYears}`
|
||||
const logDate = `${UTCMonths}/${UTCDays}/${UTCYears} ${UTCHours}:${UTCMinutes}:${UTCSeconds}.${UTCMilliSeconds}`
|
||||
fs.appendFileSync(`logs/${filenameToday}/${fileName}.txt`, `[${logDate}] ${item}\n`)
|
||||
}
|
133
util/chatparse.js
Normal file
133
util/chatparse.js
Normal file
|
@ -0,0 +1,133 @@
|
|||
const _lang = require("minecraft-data")("1.20.2").language;
|
||||
let lang=Object.create(null); //Without constructor function
|
||||
for(const i in _lang){
|
||||
lang[i]=_lang[i];
|
||||
}
|
||||
const consoleColors={
|
||||
"dark_red":"\x1B[0m\x1B[38;2;170;0;0m",
|
||||
"red":"\x1B[0m\x1B[38;2;255;85;85m",
|
||||
"dark_green":"\x1B[0m\x1B[38;2;0;170;0m",
|
||||
"green":"\x1B[0m\x1B[38;2;85;255;85m",
|
||||
"gold":"\x1B[0m\x1B[38;2;255;170;0m",
|
||||
"yellow":"\x1B[0m\x1B[38;2;255;255;85m",
|
||||
"dark_blue":"\x1B[0m\x1B[38;2;0;0;170m",
|
||||
"blue":"\x1B[0m\x1B[38;2;85;85;255m",
|
||||
"dark_purple":"\x1B[0m\x1B[38;2;170;0;170m",
|
||||
"light_purple":"\x1B[0m\x1B[38;2;255;85;255m",
|
||||
"dark_aqua":"\x1B[0m\x1B[38;2;0;170;170m",
|
||||
"aqua":"\x1B[0m\x1B[38;2;85;255;255m",
|
||||
"black":"\x1B[0m\x1B[48;2;220;220;220m\x1B[38;2;0;0;0m",
|
||||
"gray":"\x1B[0m\x1B[38;2;170;170;170m",
|
||||
"dark_gray":"\x1B[0m\x1B[38;2;85;85;85m",
|
||||
"white":"\x1B[0m\x1B[38;2;255;255;255m",
|
||||
"reset":"\x1B[0m\x1B[38;2;255;255;255m"
|
||||
}
|
||||
const hexColorParser=(color)=>{
|
||||
let out="\x1B[0m";
|
||||
const redChannel=Number("0x"+color.slice(1,3));
|
||||
const greenChannel=Number("0x"+color.slice(3,5));
|
||||
const blueChannel=Number("0x"+color.slice(5,7));
|
||||
if(redChannel < 96 && greenChannel < 96 && blueChannel < 96){
|
||||
out+="\x1B[48;2;220;220;220m";
|
||||
}
|
||||
return out+`\x1B[38;2;${redChannel};${greenChannel};${blueChannel}m`
|
||||
}
|
||||
const processColor=(col,rcol)=>{
|
||||
let out=["",""]
|
||||
if(col=="reset"){
|
||||
out[0]=rcol[0]
|
||||
} else if (col.startsWith("#")){
|
||||
out[0]=hexColorParser(col);
|
||||
} else {
|
||||
out[0]=consoleColors[col];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const parse=function(_data, l = 0, resetColor = [consoleColors.reset]){
|
||||
if (l >= 12) {
|
||||
return ['', '', '']
|
||||
}
|
||||
let data;
|
||||
if(typeof _data == "string"){
|
||||
data={text:_data, color: "reset"}
|
||||
} else if(typeof _data == "number"){
|
||||
data={text:_data+"", color: "reset"}
|
||||
} else {
|
||||
data=_data;
|
||||
}
|
||||
let nkt=false;
|
||||
const out=["","",""]; //console plain minecraft
|
||||
if(data[""]){
|
||||
data.text=data[""];
|
||||
nkt=true;
|
||||
}
|
||||
if(data.color){
|
||||
if(data.color=="reset"){
|
||||
out[0]+=resetColor[0]
|
||||
} else if (data.color.startsWith("#")){
|
||||
out[0]+=hexColorParser(data.color);
|
||||
} else {
|
||||
out[0]+=consoleColors[data.color];
|
||||
}
|
||||
} else {
|
||||
out[0]+=resetColor[0]
|
||||
}
|
||||
if(data.text){
|
||||
let _text=data.text;
|
||||
if(typeof _text=="number"){
|
||||
_text=_text.toString()
|
||||
}
|
||||
if(nkt){
|
||||
out[0]+=resetColor[0];
|
||||
out[2]+=resetColor[1];
|
||||
}
|
||||
out[0]+=_text.replace(/\u001b/g,"").replace(/\u000e/g,""); //Remove escape codes and [SO] from console format
|
||||
out[1]+=_text;
|
||||
out[2]+=_text;
|
||||
}
|
||||
if (data.translate) {
|
||||
let trans = data.translate.replace(/%%/g, '\ue123').replace(/\u001b/g,""); //Remove escape codes from console format
|
||||
let trans2 = data.translate.replace(/%%/g, '\ue123')
|
||||
let trans3 = data.translate.replace(/%%/g, '\ue123')
|
||||
if (lang[trans] !== undefined) {
|
||||
trans = lang[trans].replace(/%%/g, '\ue123')
|
||||
trans2 = lang[trans2].replace(/%%/g, '\ue123')
|
||||
trans3 = lang[trans3].replace(/%%/g, '\ue123')
|
||||
}
|
||||
for (const i in data.with) {
|
||||
const j2 = parse(data.with[i], l + 1, data.color?processColor(data.color,resetColor):resetColor)
|
||||
trans = trans.replace(/%s/, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
trans2 = trans2.replace(/%s/, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
trans3 = trans3.replace(/%s/, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
trans = trans.replaceAll(`%${+i+1}$s`, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
trans2 = trans2.replaceAll(`%${+i+1}$s`, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
trans3 = trans3.replaceAll(`%${+i+1}$s`, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125'))
|
||||
}
|
||||
out[0] += trans.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
|
||||
out[1] += trans2.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
|
||||
out[2] += trans3.replace(/\ue123/g, '%').replace(/\ue124/g, '%s').replace(/\ue125/g, '$s')
|
||||
}
|
||||
if(data.extra){
|
||||
for(const i in data.extra){
|
||||
parsed=parse(data.extra[i], l, data.color?processColor(data.color,resetColor):resetColor)
|
||||
out[0]+=parsed[0];
|
||||
out[1]+=parsed[1];
|
||||
out[2]+=parsed[2];
|
||||
}
|
||||
}
|
||||
out[0]+=resetColor[0];
|
||||
return out;
|
||||
}
|
||||
const parse2=function(_data, l, resetColor){
|
||||
try{
|
||||
return parse(_data)
|
||||
} catch(e){
|
||||
console.error(e)
|
||||
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),
|
||||
"An error occured while parsing a message. See console for more information. JSON that caused the error: "+JSON.stringify(_data),
|
||||
"§cAn error occured while parsing a message. See console for more information. JSON that caused the error: "+JSON.stringify(_data)
|
||||
]
|
||||
}
|
||||
}
|
||||
module.exports = parse2
|
11
util/chatparse_1204.js
Normal file
11
util/chatparse_1204.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const {processNbtMessage} = require("prismarine-chat");
|
||||
const parse=function(data){
|
||||
if(typeof data.type=="string"){
|
||||
return JSON.parse(processNbtMessage(data));
|
||||
} else if(typeof data=="string"){
|
||||
return JSON.parse(data);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
module.exports = parse
|
89
util/lang/en-UW.json
Normal file
89
util/lang/en-UW.json
Normal file
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"time.week": " week ",
|
||||
"time.weekPlural": " weeks ",
|
||||
"time.day": " day ",
|
||||
"time.dayPlural": " days ",
|
||||
"time.hour": " houw ",
|
||||
"time.hourPlural": " houws ",
|
||||
"time.minute": " minyute ",
|
||||
"time.minutePlural": " minyutes ",
|
||||
"time.second": " second ",
|
||||
"time.secondPlural": " seconds ",
|
||||
"command.about.usage": "",
|
||||
"command.about.desc": "About the bot",
|
||||
"command.cb.usage": " <command>",
|
||||
"command.cb.desc": "Wun a command in a command bwock",
|
||||
"command.cloop.usage": " add <wate> <command>|| remove <index>|| list|| clear",
|
||||
"command.cloop.desc": "Manage command woops",
|
||||
"command.eval.usage": " <code>",
|
||||
"command.eval.desc": "Wun JavaScwipt code",
|
||||
"command.help.usage": " [cmd]",
|
||||
"command.help.desc": "Shows command hewp",
|
||||
"command.logoff.usage": "",
|
||||
"command.logoff.desc": "Disconnyect and weconnyect the bot fwom a sewvew",
|
||||
"command.netmsg.usage": " <message>",
|
||||
"command.netmsg.desc": "Send a message to aww sewvews the bot is connyected to",
|
||||
"command.refill.usage": "",
|
||||
"command.refill.desc": "Wefiww cowe",
|
||||
"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": "Westawt bot",
|
||||
"command.template.usage": " <wequiwed> [optionyaw]",
|
||||
"command.template.desc": "Does nyothing",
|
||||
"command.tpr.desc": "Tewepowt to a wandom wocation",
|
||||
"command.tpr.usage": "",
|
||||
"command.verify.usage": " [awgs...]",
|
||||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minyecwaft bot made by %s",
|
||||
"command.about.version": "Vewsion %s",
|
||||
"command.about.preRelease": "This is pwewewease softwawe - thewe may be ewwows, and featuwes may be changed ow wemoved at any time.",
|
||||
"command.about.sourceCode": "Souwce code: %s",
|
||||
"command.about.sourceCode.openInBrowser": "Cwick to open the souwce code wink in youw defauwt bwowsew",
|
||||
"command.about.serverinfo": "To view system infowmation, wun the command %s.",
|
||||
"command.cloop.error.tooShort": "Command woops must have a wate above 20ms.",
|
||||
"command.cloop.error.subcommand": "Unknyown subcommand, pwease do %s",
|
||||
"command.cloop.success.add": "Added command woop with command %s and wate %s",
|
||||
"command.cloop.success.remove": "Wemoved command woop %s",
|
||||
"command.cloop.success.clear": "Cweawed aww command woops",
|
||||
"command.cloop.list": "%s: Command: %s Wate: %s",
|
||||
"command.help.cmdList": "Commands:",
|
||||
"command.help.commandInfo": "%s%s - %s",
|
||||
"command.help.commandUsage": "Usage - %s%s",
|
||||
"command.help.commandDesc": "Descwiption - %s",
|
||||
"command.help.commandPerms": "Wequiwed pewmissions - %s",
|
||||
"command.help.permsNormal": "Nyowmaw",
|
||||
"command.help.permsTrusted": "Twusted",
|
||||
"command.help.permsOwner": "Ownyew",
|
||||
"command.help.permsConsole": "Consowe",
|
||||
"command.help.noCommand": "Command does nyot exist",
|
||||
"command.serverinfo.os.android": "Andwoid",
|
||||
"command.serverinfo.os.freebsd": "FweeBSD",
|
||||
"command.serverinfo.os.linux": "Winyux %s",
|
||||
"command.serverinfo.os.macos": "macOS",
|
||||
"command.serverinfo.os.macos_old": "OS X",
|
||||
"command.serverinfo.os": "Opewating system",
|
||||
"command.serverinfo.processor": "CPU",
|
||||
"command.serverinfo.arch": "Awchitectuwe",
|
||||
"command.serverinfo.osUsername": "Usewnyame",
|
||||
"command.serverinfo.hostName": "Hostnyame",
|
||||
"command.serverinfo.workingDir": "Wowking diwectowy",
|
||||
"command.serverinfo.runTime": "Bot uptime",
|
||||
"command.serverinfo.upTime": "System uptime",
|
||||
"command.serverinfo.nodeVersion": "Nyode.js vewsion",
|
||||
"command.serverinfo.osRelease": "Winyux wewease",
|
||||
"command.serverinfo.osRelease.missing": "/etc/os-release does nyot exist. Infowmation may be wimited.",
|
||||
"command.serverinfo.os.android.version": "Andwoid vewsion",
|
||||
"command.serverinfo.os.android.model": "Device modew",
|
||||
"command.serverinfo.botName": "Bot nyame",
|
||||
"command.serverinfo.botVer": "Bot vewsion",
|
||||
"command.tpr.success": "Tewepowting %s to %s, %s, %s",
|
||||
"command.verify.success": "Successfuwwy vewified with pewmission wevew %s",
|
||||
"command.error": "An ewwow occuwed (check consowe fow mowe info)",
|
||||
"command.disallowed.perms": "You do nyot have pewmission to wun this command. If you do have pewmission, pwease make suwe you put the command hash at the end, ow wan the command thwough youw cwient's hashing system.",
|
||||
"command.disallowed.perms.yourLevel": "Youw pewmission wevew: %s",
|
||||
"command.disallowed.perms.cmdLevel": "Command wequiwes: %s",
|
||||
"copyText": "Cwick to copy!"
|
||||
}
|
71
util/lang/he-IL.json
Normal file
71
util/lang/he-IL.json
Normal file
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"command.about.usage": "",
|
||||
"command.about.desc": "About the bot",
|
||||
"command.cb.usage": " <command>",
|
||||
"command.cb.desc": "Wun a command in a command bwock",
|
||||
"command.cloop.usage": " add <wate> <command>|| remove <index>|| list|| clear",
|
||||
"command.cloop.desc": "Manage command woops",
|
||||
"command.eval.usage": " <code>",
|
||||
"command.eval.desc": "Wun JavaScwipt code",
|
||||
"command.help.usage": " [cmd]",
|
||||
"command.help.desc": "Shows command hewp",
|
||||
"command.logoff.usage": "",
|
||||
"command.logoff.desc": "Disconnyect and weconnyect the bot fwom a sewvew",
|
||||
"command.netmsg.usage": " <message>",
|
||||
"command.netmsg.desc": "Send a message to aww sewvews the bot is connyected to",
|
||||
"command.refill.usage": "",
|
||||
"command.refill.desc": "Wefiww cowe",
|
||||
"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": "Westawt bot",
|
||||
"command.template.usage": " <wequiwed> [optionyaw]",
|
||||
"command.template.desc": "Does nyothing",
|
||||
"command.verify.usage": " [awgs...]",
|
||||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minyecwaft bot made by 77c8f4699b732c11 / a5a06d596f15c7db\nThis is currently set to uwu language to test support for other languages. It is stored internally as Hebrew (Israel) - language code he-IL.",
|
||||
"command.about.version": "Vewsion %s",
|
||||
"command.about.serverinfo": "To view system infowmation, wun the command %s.",
|
||||
"command.cloop.error.tooShort": "Command woops must have a wate above 20ms.",
|
||||
"command.cloop.success.add": "Added command woop with command %s and wate %s",
|
||||
"command.cloop.success.remove": "Wemoved command woop %s",
|
||||
"command.cloop.success.clear": "Cweawed aww command woops",
|
||||
"command.cloop.list": "%s: Command: %s Rate: %s",
|
||||
"command.help.cmdList": "Commands",
|
||||
"command.help.commandInfo": "%s%s - %s",
|
||||
"command.help.commandUsage": "Usage - %s%s",
|
||||
"command.help.commandDesc": "Descwiption - %s",
|
||||
"command.help.commandPerms": "Wequiwed pewmissions - %s",
|
||||
"command.help.permsNormal": "Nyowmaw",
|
||||
"command.help.permsTrusted": "Twusted",
|
||||
"command.help.permsOwner": "Ownyew",
|
||||
"command.help.permsConsole": "Consowe",
|
||||
"command.help.noCommand": "Command does nyot exist",
|
||||
"command.serverinfo.os.android": "Andwoid",
|
||||
"command.serverinfo.os.freebsd": "FweeBSD",
|
||||
"command.serverinfo.os.linux": "Winyux",
|
||||
"command.serverinfo.os.macos": "macOS",
|
||||
"command.serverinfo.os.macos_old": "OS X",
|
||||
"command.serverinfo.os": "Opewating system",
|
||||
"command.serverinfo.processor": "CPU",
|
||||
"command.serverinfo.arch": "Awchitectuwe",
|
||||
"command.serverinfo.osUsername": "Usewnyame",
|
||||
"command.serverinfo.hostName": "Hostnyame",
|
||||
"command.serverinfo.workingDir": "Wowking diwectowy",
|
||||
"command.serverinfo.runTime": "Bot uptime",
|
||||
"command.serverinfo.upTime": "System uptime",
|
||||
"command.serverinfo.nodeVersion": "Nyode.js vewsion",
|
||||
"command.serverinfo.osRelease": "Winyux wewease",
|
||||
"command.serverinfo.osRelease.missing": "/etc/os-release does nyot exist. Infowmation may be wimited.",
|
||||
"command.serverinfo.os.android.version": "Andwoid vewsion",
|
||||
"command.serverinfo.os.android.model": "Device modew",
|
||||
"command.serverinfo.botName": "Bot nyame",
|
||||
"command.serverinfo.botVer": "Bot vewsion",
|
||||
"command.error": "An ewwow occuwed (check consowe fow mowe info)",
|
||||
"command.disallowed.perms": "You do nyot have pewmission to wun this command. If you do have pewmission, pwease make suwe you put the command hash at the end, ow wan the command thwough youw cwient's hashing system.",
|
||||
"command.disallowed.perms.yourLevel": "Youw pewmission wevew: %s",
|
||||
"command.disallowed.perms.cmdLevel": "Command wequiwes: %s",
|
||||
"copyText": "Cwick to copy!"
|
||||
}
|
17
util/textformat.js
Normal file
17
util/textformat.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const settings=require("../settings.json");
|
||||
module.exports = function (text) {
|
||||
return JSON.stringify({
|
||||
translate: "[%s] %s",
|
||||
color: "#FFAAFF",
|
||||
with:[
|
||||
{
|
||||
text: settings.name,
|
||||
color: "light_purple"
|
||||
},
|
||||
{
|
||||
text: text,
|
||||
color: "white"
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
24
util/timeformat.js
Executable file
24
util/timeformat.js
Executable file
|
@ -0,0 +1,24 @@
|
|||
module.exports = function (time) {
|
||||
let finalString = ''
|
||||
const seconds = Math.floor(time / 1000) % 60
|
||||
const minutes = Math.floor(time / 60000) % 60
|
||||
const hours = Math.floor(time / 3600000) % 24
|
||||
const days = Math.floor(time / 86400000) % 7
|
||||
const weeks = Math.floor(time / 604800000)
|
||||
if (weeks != 0) {
|
||||
finalString += `${weeks} week${weeks == 1 ? '' : 's'} `
|
||||
}
|
||||
if (days != 0) {
|
||||
finalString += `${days} day${days == 1 ? '' : 's'} `
|
||||
}
|
||||
if (hours != 0) {
|
||||
finalString += `${hours} hour${hours == 1 ? '' : 's'} `
|
||||
}
|
||||
if (minutes != 0) {
|
||||
finalString += `${minutes} minute${minutes == 1 ? '' : 's'} `
|
||||
}
|
||||
if (seconds != 0) {
|
||||
finalString += `${seconds} second${seconds == 1 ? '' : 's'} `
|
||||
}
|
||||
return finalString
|
||||
}
|
Loading…
Reference in a new issue