forked from afspiegeling/NitoriBot
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
899d34188b | ||
|
|
6d849ff07f | ||
|
|
c3f153b1bf | ||
|
|
eca78227ea | ||
|
|
34445d7029 | ||
|
|
e1bd39a5e7 | ||
|
|
f207710fc6 | ||
|
|
36db3269d8 | ||
|
|
79250b3325 | ||
|
|
4ed575eae1 | ||
|
|
6063dcb4a3 | ||
|
|
880ffc6f70 |
@@ -1,16 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'sus',
|
||||
description:['make me say something in chat'],
|
||||
aliases:['chatsay'],
|
||||
trustLevel: 0,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
|
||||
if (message.startsWith('/')) {
|
||||
bot.command(message.substring(1))
|
||||
return
|
||||
}
|
||||
bot.chat(message)
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'botsrun',
|
||||
description:[''],
|
||||
aliases:[],
|
||||
trustLevel: 2,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const client = context.client
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const message = context.arguments.join(' ')
|
||||
//const source = context.source
|
||||
// if (args.length === 0){
|
||||
//source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
const amogus = args.slice(1).join(' ');
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
try{
|
||||
switch (args[1]) {
|
||||
case 'source':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
case 'consolesource':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(bot.console.source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
default:
|
||||
context.source.sendError([ { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
source.sendFeedback({text:'Args are source and consolesource', color:'green'})
|
||||
}
|
||||
|
||||
}catch(error){
|
||||
source.sendFeedback(error.stack)
|
||||
}
|
||||
// context.source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })
|
||||
|
||||
|
||||
}//
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
const convert = require('color-convert')
|
||||
|
||||
function inject (bot) {
|
||||
bot.bruhifyTextTellraw = ''
|
||||
let startHue = 0
|
||||
const timer = setInterval(() => {
|
||||
if (bot.bruhifyTextTellraw === '') return
|
||||
|
||||
let hue = startHue
|
||||
const displayName = bot.bruhifyTextTellraw
|
||||
const increment = (360 / Math.max(displayName.length, 20))
|
||||
const component = []
|
||||
for (const character of displayName) {
|
||||
const color = convert.hsv.hex(hue, 100, 100)
|
||||
component.push({
|
||||
text: character,
|
||||
color: `#${color}`,
|
||||
|
||||
})
|
||||
|
||||
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
|
||||
hue = (hue + increment) % 360
|
||||
}
|
||||
bot.core.run(`tellraw @a ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}, 50)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
}
|
||||
module.exports = inject
|
||||
@@ -1,33 +0,0 @@
|
||||
const convert = require('color-convert')
|
||||
|
||||
function inject (bot) {
|
||||
bot.bruhifyTextTitle = ''
|
||||
let startHue = 0
|
||||
const timer = setInterval(() => {
|
||||
if (bot.bruhifyTextTitle === '') return
|
||||
|
||||
let hue = startHue
|
||||
const displayName = bot.bruhifyTextTitle
|
||||
const increment = (360 / Math.max(displayName.length, 20))
|
||||
const component = []
|
||||
for (const character of displayName) {
|
||||
const color = convert.hsv.hex(hue, 100, 100)
|
||||
component.push({
|
||||
text: character,
|
||||
color: `#${color}`,
|
||||
|
||||
})
|
||||
|
||||
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
|
||||
hue = (hue + increment) % 360
|
||||
}
|
||||
bot.core.run(`title @a title ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}, 100)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
}
|
||||
module.exports = inject
|
||||
@@ -1,74 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
module.exports = {
|
||||
name: 'calculator',
|
||||
description:['calculate maths'],
|
||||
trustLevel: 0,
|
||||
aliases:['calc'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const cmd = {//test.js
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
]
|
||||
}
|
||||
const operation = args[0]
|
||||
const operator1 = parseFloat(args[1])
|
||||
const operator2 = parseFloat(args[2])
|
||||
|
||||
//
|
||||
switch (operation) {
|
||||
case 'add':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{color: 'blue', text:'Calculator Cmd'},
|
||||
`${operator1} + ${operator2}`,
|
||||
operator1 + operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'subtract':
|
||||
context.source.sendFeedback({
|
||||
translate: `[%s] %s is %s`,
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} - ${operator2}`,
|
||||
operator1 - operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'multiply':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} x ${operator2}`,
|
||||
operator1 * operator2
|
||||
]
|
||||
});
|
||||
|
||||
break
|
||||
case 'divide':
|
||||
context.source.sendFeedback({
|
||||
translate: '[%s] %s is %s',
|
||||
with: [
|
||||
{ color: 'blue', text: 'Calculator Cmd'},
|
||||
`${operator1} / ${operator2}`,
|
||||
operator1 / operator2
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
break
|
||||
default:
|
||||
context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red' }])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
const { VM } = require('vm2')
|
||||
const util = require('util')
|
||||
const { stylize } = require('../util/eval_colors')
|
||||
|
||||
const options = {
|
||||
timeout: 1000
|
||||
}
|
||||
let vm = new VM(options)
|
||||
|
||||
module.exports = {
|
||||
name: 'evaljsvm2',
|
||||
trustLevel: 1,
|
||||
description:['old evaljs code'],
|
||||
aliases:['evaljsold', 'evalvm2', 'evalold'],
|
||||
execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
|
||||
const cmd = {
|
||||
translate: '[%s] ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
with: [
|
||||
{ color: 'dark_green', text: 'EvalJS Cmd'},
|
||||
]
|
||||
}
|
||||
|
||||
// throw new CommandError('temp disabled')
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'run':
|
||||
try {
|
||||
const output = vm.run(args.slice(2).join(' '))
|
||||
if (!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(output, { stylize }) }]).toMotd().replaceAll('§', '&'))
|
||||
}else
|
||||
source.sendFeedback([cmd, { text: util.inspect(output, { stylize }) }])
|
||||
} catch (e) {
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: e.toString(), color: 'black' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: e.toString(), color: 'black' }])
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'reset':
|
||||
vm = new VM(options)
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Successfully reset the eval context', color: 'green' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
|
||||
}
|
||||
break
|
||||
default:
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Invalid option!', color: 'dark_red' }]).toMotd().replaceAll('§', '&'))
|
||||
}else{
|
||||
source.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
const nbs = require('./nbs-file.js')
|
||||
const instrumentNames = [
|
||||
'harp',
|
||||
'bass',
|
||||
'basedrum',
|
||||
'snare',
|
||||
'hat',
|
||||
'guitar',
|
||||
'flute',
|
||||
'bell',
|
||||
'chime',
|
||||
'xylophone',
|
||||
'iron_xylophone',
|
||||
'cow_bell',
|
||||
'didgeridoo',
|
||||
'bit',
|
||||
'banjo',
|
||||
'pling'
|
||||
]
|
||||
|
||||
function convertNBS (buf) {
|
||||
const parsed = nbs.parse(buf)
|
||||
const song = {
|
||||
name: parsed.songName,
|
||||
notes: [],
|
||||
loop: false,
|
||||
loopPosition: 0,
|
||||
length: 0
|
||||
}
|
||||
if (parsed.loop > 0) {
|
||||
song.loop = true
|
||||
song.loopPosition = parsed.loopStartTick
|
||||
}
|
||||
for (const note of parsed.nbsNotes) {
|
||||
let instrument = note.instrument
|
||||
if (note.instrument < instrumentNames.length) {
|
||||
instrument = instrumentNames[note.instrument]
|
||||
} else continue
|
||||
|
||||
if (note.key < 33 || note.key > 55) continue
|
||||
|
||||
const layerVolume = 100
|
||||
// will add layer volume later
|
||||
|
||||
const time = tickToMs(note.tick, parsed.tempo)
|
||||
song.length = Math.max(song.length, time)
|
||||
|
||||
song.notes.push({
|
||||
instrument,
|
||||
pitch: note.key - 33,
|
||||
volume: note.velocity * layerVolume / 10000,
|
||||
time
|
||||
})
|
||||
}
|
||||
return song
|
||||
}
|
||||
|
||||
function tickToMs (tick = 1, tempo) {
|
||||
return Math.floor(1000 * tick * 100 / tempo)
|
||||
}
|
||||
|
||||
module.exports = convertNBS
|
||||
@@ -1,42 +0,0 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'time',
|
||||
description:['check the time'],
|
||||
aliases:['clock', 'timezone'],
|
||||
trustLevel: 0,
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
const moment = require('moment-timezone')
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const timezone = args.join(' ')
|
||||
if (!bot.options.Core.enabled) {
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
if (!moment.tz.names().map((zone) => zone.toLowerCase()).includes(timezone.toLowerCase()) && !bot.options.Core.enabled) {
|
||||
bot.chat('Invalid timezone')
|
||||
}else{
|
||||
throw new CommandError('Invalid timezone')
|
||||
}
|
||||
|
||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
|
||||
|
||||
|
||||
if (!bot.options.Core.enabled) {
|
||||
|
||||
bot.chat(`The current time and date for the timezone &b${timezone}`)
|
||||
await sleep(1000)
|
||||
bot.chat(`is:`)
|
||||
await sleep(1000)
|
||||
bot.chat(`&a${momented}`)
|
||||
|
||||
}else{
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
function selfcaretoggle (bot, options, context) {
|
||||
bot.visibility = {
|
||||
on () {
|
||||
enabled = true
|
||||
bot.options.selfcare.vanished = true
|
||||
},
|
||||
off () {
|
||||
enabled = false
|
||||
bot.options.selfcare.vanished = false
|
||||
bot.command('v off')
|
||||
}
|
||||
},
|
||||
bot.unmuted = {
|
||||
on () {
|
||||
enabled = true
|
||||
bot.options.selfcare.unmuted = true
|
||||
bot.core.run(`mute ${bot.uuid}`)
|
||||
|
||||
},
|
||||
off () {
|
||||
enabled = false
|
||||
bot.options.selfcare.unmuted = false
|
||||
}
|
||||
},
|
||||
bot.tptoggle = {
|
||||
on () {
|
||||
bot.options.selfcare.tptoggle = false
|
||||
bot.command('tptoggle on')
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.tptoggle = true
|
||||
bot.command('tptoggle off')
|
||||
}
|
||||
},
|
||||
bot.god = {
|
||||
on () {
|
||||
bot.options.selfcare.god = true
|
||||
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.god = false
|
||||
bot.command('god off')
|
||||
}
|
||||
},
|
||||
bot.prefix = {
|
||||
on () {
|
||||
bot.options.selfcare.prefix = true
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.prefix = false
|
||||
}
|
||||
},
|
||||
bot.Username = {
|
||||
on () {
|
||||
bot.options.selfcare.username = true
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.username = false
|
||||
}
|
||||
},
|
||||
bot.skin = {
|
||||
on () {
|
||||
bot.options.selfcare.skin = true
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.skin = false
|
||||
}
|
||||
},
|
||||
bot.cspy = {
|
||||
on () {
|
||||
bot.options.selfcare.cspy = true
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.cspy = false
|
||||
}
|
||||
},
|
||||
bot.nickname = {
|
||||
on () {
|
||||
bot.options.selfcare.nickname = true
|
||||
},
|
||||
off () {
|
||||
bot.options.selfcare.nickname = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
module.exports = selfcaretoggle
|
||||
@@ -1,47 +0,0 @@
|
||||
const mc = require('minecraft-protocol')
|
||||
const crypto = require('crypto')
|
||||
const colorConvert = require('color-convert')
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const uuid = require('uuid-by-string')
|
||||
const moment = require('moment-timezone')
|
||||
const cowsay = require('cowsay2')
|
||||
const cows = require('cowsay2/cows')
|
||||
const ivm = require('isolated-vm')
|
||||
const randomstring = require('randomstring')
|
||||
const mineflayer = require('mineflayer')
|
||||
const Vec3 = require('vec3')
|
||||
function inject (bot) {
|
||||
const chatMessage = require('prismarine-chat')
|
||||
const mcData = require('minecraft-data')(bot.version)
|
||||
bot.vmOptions = {
|
||||
timeout: 2000,
|
||||
sandbox: {
|
||||
run (cmd) {
|
||||
bot.core.run(cmd)
|
||||
},
|
||||
mc,
|
||||
mineflayer,
|
||||
CommandError,
|
||||
chat: bot.chat,
|
||||
moment,
|
||||
randomstring,
|
||||
uuid,
|
||||
chatMessage,
|
||||
crypto,
|
||||
colorConvert,
|
||||
bruhifyText (message) {
|
||||
if (
|
||||
typeof message !== 'string'
|
||||
) throw new SyntaxError('message must be a string')
|
||||
bot.bruhifyText = message.substring(0, 1000)
|
||||
},
|
||||
cowsay,
|
||||
cows,
|
||||
mcData,
|
||||
Vec3
|
||||
}
|
||||
}
|
||||
bot.vm = new ivm.Isolate({ memoryLimit: 50 })
|
||||
};
|
||||
//let isolate = new ivm.Isolate({ memoryLimit: 50 })
|
||||
module.exports = inject
|
||||
Reference in New Issue
Block a user