Compare commits
6 commits
v10.0.1
...
10.0.0-rel
Author | SHA1 | Date | |
---|---|---|---|
ac9ce2d957 | |||
8ddee3cf3a | |||
5a7a6548d7 | |||
7ce5949d86 | |||
171b6a2f9a | |||
a85269ecce |
9 changed files with 30 additions and 24 deletions
|
@ -7,6 +7,10 @@ owobot is a Minecraft bot originally designed for [Kaboom](https://kaboom.pw/) a
|
||||||
- a command core, to run commands quickly
|
- a command core, to run commands quickly
|
||||||
- a hashing system, to enable trusted users to securely run certain commands in chat
|
- a hashing system, to enable trusted users to securely run certain commands in chat
|
||||||
|
|
||||||
|
If you are not sure if this code is safe to run, you can read through every line of code. You can also see the commit history by clicking on the (n) commits button, to make sure nobody added any exploits to the code.
|
||||||
|
|
||||||
|
If you find any exploits, security issues, etc in the code, please send me an issue or pull request and I will try to respond to it whenever I see it.
|
||||||
|
|
||||||
## How to install?
|
## How to install?
|
||||||
|
|
||||||
1. Install [Node.js](https://nodejs.org/) for your operating system.
|
1. Install [Node.js](https://nodejs.org/) for your operating system.
|
||||||
|
|
|
@ -239,8 +239,8 @@ const displayServerList = function (c) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: function (c) {
|
execute: function (c) {
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args[0].toLowerCase()
|
||||||
if (subcmd === 'servers') subcmd = 'serverlist'
|
if (subcmd === 'servers') subcmd = 'serverlist'
|
||||||
if (c.cmdName.toLowerCase() === 'serverinfo' || c.cmdName.toLowerCase() === 'specs') subcmd = 'server'
|
if (c.cmdName.toLowerCase() === 'serverinfo' || c.cmdName.toLowerCase() === 'specs') subcmd = 'server'
|
||||||
if (c.cmdName.toLowerCase() === 'serverlist' || c.cmdName.toLowerCase() === 'servers') subcmd = 'serverlist'
|
if (c.cmdName.toLowerCase() === 'serverlist' || c.cmdName.toLowerCase() === 'servers') subcmd = 'serverlist'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const { getMessage } = require('../util/lang.js')
|
const { getMessage } = require('../util/lang.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args.splice(0, 1)[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case 'add': {
|
case 'add': {
|
||||||
const rate = +(c.args.splice(0, 1)[0])
|
const rate = +(c.args.splice(0, 1)[0])
|
||||||
|
|
|
@ -65,8 +65,8 @@ const printHelp = (c) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const printCmdHelp = (c) => {
|
const printCmdHelp = (c) => {
|
||||||
let cmd;
|
let cmd
|
||||||
if(c.args.length>=1) cmd = c.args[0].toLowerCase();
|
if (c.args.length >= 1) cmd = c.args[0].toLowerCase()
|
||||||
if (!cmds[cmd] || (cmds[cmd].hidden && c.type !== 'console')) {
|
if (!cmds[cmd] || (cmds[cmd].hidden && c.type !== 'console')) {
|
||||||
c.reply({ text: getMessage(c.lang, 'command.help.noCommand') })
|
c.reply({ text: getMessage(c.lang, 'command.help.noCommand') })
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,8 +17,8 @@ module.exports = {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args.splice(0, 1)[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case 'set':{
|
case 'set':{
|
||||||
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
||||||
|
|
|
@ -32,16 +32,18 @@
|
||||||
"command.say.desc": "Sends a message to chat",
|
"command.say.desc": "Sends a message to chat",
|
||||||
"command.settings.usage": " get|| set <key> <value>",
|
"command.settings.usage": " get|| set <key> <value>",
|
||||||
"command.settings.desc": "Set your user preferences",
|
"command.settings.desc": "Set your user preferences",
|
||||||
|
"command.restart.usage": "",
|
||||||
|
"command.restart.desc": "Restart bot",
|
||||||
"command.stop.usage": "",
|
"command.stop.usage": "",
|
||||||
"command.stop.desc": "Restart bot",
|
"command.stop.desc": "Stop bot",
|
||||||
"command.template.usage": " <required> [optional]",
|
"command.template.usage": " <required> [optional]",
|
||||||
"command.template.desc": "Does nothing",
|
"command.template.desc": "Does nothing",
|
||||||
"command.test.usage": " [args...]",
|
"command.test.usage": " [args...]",
|
||||||
"command.test.desc": "Chat parsing debugger command",
|
"command.test.desc": "Chat parsing debugger command",
|
||||||
"command.tpr.usage": "",
|
"command.tpr.usage": "",
|
||||||
"command.tpr.desc": "Teleport to a random location",
|
"command.tpr.desc": "Teleport to a random location",
|
||||||
"command.verify.usage": " [args...]",
|
"command.validate.usage": " [args...]",
|
||||||
"command.verify.desc": "Check the hashing system",
|
"command.validate.desc": "Check the hashing system",
|
||||||
"command.about.author": "%s - a Minecraft bot made by %s for Kaboom and clones",
|
"command.about.author": "%s - a Minecraft bot made by %s for Kaboom and clones",
|
||||||
"command.about.version": "Version %s",
|
"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.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.",
|
||||||
|
|
|
@ -117,8 +117,8 @@ module.exports = {
|
||||||
|
|
||||||
b._client.on('system_chat', (data) => {
|
b._client.on('system_chat', (data) => {
|
||||||
const json = parse1204(data.content)
|
const json = parse1204(data.content)
|
||||||
if(json.translate == '%s %s › %s'){ // ChipmunkMod format
|
if (json.translate === '%s %s › %s') { // ChipmunkMod format
|
||||||
if(json.with && json.with[1] && json.with[2]){
|
if (json.with && json.with[1] && json.with[2]) {
|
||||||
const username = parsePlain(json.with[1])
|
const username = parsePlain(json.with[1])
|
||||||
const uuid = b.findUUID(username)
|
const uuid = b.findUUID(username)
|
||||||
const nickname = b.findDisplayName(uuid)
|
const nickname = b.findDisplayName(uuid)
|
||||||
|
@ -135,13 +135,13 @@ module.exports = {
|
||||||
b.emit('chat', {
|
b.emit('chat', {
|
||||||
json,
|
json,
|
||||||
type: 'system',
|
type: 'system',
|
||||||
uuid: "00000000-0000-0000-0000-000000000000",
|
uuid: '00000000-0000-0000-0000-000000000000',
|
||||||
message: "",
|
message: '',
|
||||||
nickname: "",
|
nickname: '',
|
||||||
username: ""
|
username: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
|
} else if (json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text === ' » ') { // ChipmunkMod format - m_c_player
|
||||||
const username = parsePlain(json.extra[3])
|
const username = parsePlain(json.extra[3])
|
||||||
const uuid = b.findUUID(username)
|
const uuid = b.findUUID(username)
|
||||||
const nickname = b.findDisplayName(uuid)
|
const nickname = b.findDisplayName(uuid)
|
||||||
|
@ -181,19 +181,19 @@ module.exports = {
|
||||||
let username
|
let username
|
||||||
let message
|
let message
|
||||||
let uuid
|
let uuid
|
||||||
if(json.translate == '%s %s › %s'){ // ChipmunkMod format
|
if (json.translate === '%s %s › %s') { // ChipmunkMod format
|
||||||
if(json.with && json.with[1] && json.with[2]){
|
if (json.with && json.with[1] && json.with[2]) {
|
||||||
username = parsePlain(json.with[1])
|
username = parsePlain(json.with[1])
|
||||||
uuid = b.findUUID(username)
|
uuid = b.findUUID(username)
|
||||||
nickname = b.findDisplayName(uuid)
|
nickname = b.findDisplayName(uuid)
|
||||||
message = parsePlain(json.with[2].extra)
|
message = parsePlain(json.with[2].extra)
|
||||||
}
|
}
|
||||||
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
|
} else if (json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text === ' » ') { // ChipmunkMod format - m_c_player
|
||||||
username = parsePlain(json.extra[3])
|
username = parsePlain(json.extra[3])
|
||||||
uuid = b.findUUID(username)
|
uuid = b.findUUID(username)
|
||||||
nickname = b.findDisplayName(uuid)
|
nickname = b.findDisplayName(uuid)
|
||||||
message = parsePlain(json.extra[5])
|
message = parsePlain(json.extra[5])
|
||||||
} else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat
|
} else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat
|
||||||
if (json.with && json.with.length >= 2) {
|
if (json.with && json.with.length >= 2) {
|
||||||
message = parsePlain(json.with[1])
|
message = parsePlain(json.with[1])
|
||||||
username = parsePlain(json.with[0])
|
username = parsePlain(json.with[0])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const index = require('../index.js')
|
const index = require('../index.js')
|
||||||
const parse = require('../util/chatparse_console.js')
|
const parse = require('../util/chatparse_console.js')
|
||||||
const settings = require('../settings.json')
|
const settings = require('../settings.json')
|
||||||
const version = require("../version.json")
|
const version = require('../version.json')
|
||||||
class ConsoleCommand {
|
class ConsoleCommand {
|
||||||
constructor (cmd, index2) {
|
constructor (cmd, index2) {
|
||||||
this.send = () => {}
|
this.send = () => {}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"botName": "owobot",
|
"botName": "owobot",
|
||||||
"botVersion": "10.0.1",
|
"botVersion": "10.0.3",
|
||||||
"botAuthor": "SundanceNanshan",
|
"botAuthor": "SundanceNanshan",
|
||||||
"isPreRelease": false,
|
"isPreRelease": false,
|
||||||
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot"
|
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot"
|
||||||
|
|
Loading…
Reference in a new issue