From 5000abf90d7272da18634c2e2a3ce9243960cbb1 Mon Sep 17 00:00:00 2001 From: Parker2991 Date: Mon, 22 Apr 2024 19:07:29 +0200 Subject: [PATCH] FNFBoyfriendBot v5.0.7b --- .gitignore | 8 +- src/main.sh => main.sh | 2 +- music.js | 201 +++++++ src/package-lock.json => package-lock.json | 556 +++++++++++++++++- src/package.json => package.json | 6 + random-bullshit/amogus | 0 random-bullshit/amogus.js | 16 - random-bullshit/botsrun.js | 45 -- random-bullshit/bruhifytellraw.js | 33 -- random-bullshit/bruhifytitle.js | 33 -- random-bullshit/calculator.js | 74 --- random-bullshit/chatqueue.js | 0 random-bullshit/evaljsvm2.js | 65 -- random-bullshit/nbs-converter.js | 62 -- random-bullshit/time.js | 42 -- random-bullshit/visibility.js | 90 --- random-bullshit/vm.js | 47 -- src/CommandModules/command_source.js | 15 +- src/bot.js | 114 ++-- src/commands/bots.js | 116 +++- src/commands/bruhify.js | 2 +- src/commands/changelog.js | 16 +- src/commands/changelogPreV5.0.js | 2 +- src/commands/cloop.js | 155 +++-- src/commands/cmdtest.js | 6 +- src/commands/core.js | 8 +- src/commands/cowsay.js | 2 +- src/commands/crash.js | 4 +- src/commands/discordmsg.js | 8 +- src/commands/echo.js | 14 +- src/commands/end.js | 4 +- src/commands/eval.js | 56 ++ src/commands/help.js | 259 ++++++-- src/commands/info.js | 311 +++++++--- src/commands/kick.js | 71 ++- src/commands/list.js | 87 ++- src/commands/memusage.js | 4 +- src/commands/music.js | 89 +-- src/commands/netmsg.js | 2 +- src/commands/playerinfo.js | 39 ++ src/commands/rc.js | 2 +- src/commands/reconnect.js | 2 +- src/commands/reload.js | 23 +- src/commands/sctoggle.js | 48 +- src/commands/servereval.js | 72 +-- src/commands/terminal.js | 43 ++ src/commands/theme.js | 34 +- src/commands/time.js | 2 +- src/commands/tpr.js | 19 +- src/commands/tps.js | 4 +- src/commands/translate.js | 4 +- src/commands/troll.js | 2 +- src/commands/urban.js | 12 +- src/commands/validate.js | 59 +- src/commands/weather.js | 16 +- src/commands/wiki.js | 2 +- src/commandtemplate.js | 13 + src/default.js | 161 ++--- src/{commands => }/evaljs.js | 16 +- src/index.js | 66 +-- src/logger.js | 32 + src/logs/2024-03-27.txt | 0 src/logs/2024-03-28.txt | 0 src/logs/2024-03-29.txt | 0 src/midis/README.txt | 6 - src/midis/badpiggies.mid | Bin 37347 -> 0 bytes src/midis/ballistic.mid | Bin 135203 -> 0 bytes src/midis/hell.mid | Bin 26867 -> 0 bytes src/midis/manifest.mid | Bin 55561 -> 0 bytes src/modules/bruhify.js | 2 +- src/modules/chat.js | 11 +- src/modules/chat_command_handler.js | 42 +- src/modules/command_core.js | 16 +- src/modules/command_manager.js | 176 +++--- src/modules/console.js | 79 +-- src/modules/discord.js | 114 ++-- src/modules/hashing.js | 11 +- src/modules/logger.js | 98 ++- src/modules/matrix.js | 8 +- src/modules/memusage.js | 7 +- src/modules/music.js | 120 ++-- src/modules/player_list.js | 37 +- src/modules/reconnect.js | 25 +- src/modules/registry.js | 1 + src/modules/reload.js | 20 +- src/modules/selfcare.js | 51 +- src/modules/tpsbar.js | 6 +- src/util/bots/hbot.json | 10 + src/util/bots/sc09.json | 10 + src/util/getFilenameFromUrl.js | 8 + src/util/minecraftVersionToNumber.js | 6 +- src/util/music/midi-proxy.js | 28 + .../midi_converter/convert_note.js | 0 .../midi_converter/instrument_map.js | 0 .../midi_converter/instruments.json | 0 src/util/{ => music}/midi_converter/main.js | 0 .../{ => music}/midi_converter/package.json | 0 .../midi_converter/percussion_map.js | 0 src/util/{ => music}/nbs_converter.js | 0 src/util/{ => music}/nbs_file.js | 0 src/util/{ => music}/txt_song_parser.js | 0 101 files changed, 2601 insertions(+), 1587 deletions(-) rename src/main.sh => main.sh (51%) create mode 100644 music.js rename src/package-lock.json => package-lock.json (76%) rename src/package.json => package.json (76%) delete mode 100644 random-bullshit/amogus delete mode 100644 random-bullshit/amogus.js delete mode 100644 random-bullshit/botsrun.js delete mode 100644 random-bullshit/bruhifytellraw.js delete mode 100644 random-bullshit/bruhifytitle.js delete mode 100644 random-bullshit/calculator.js delete mode 100644 random-bullshit/chatqueue.js delete mode 100644 random-bullshit/evaljsvm2.js delete mode 100644 random-bullshit/nbs-converter.js delete mode 100644 random-bullshit/time.js delete mode 100644 random-bullshit/visibility.js delete mode 100644 random-bullshit/vm.js create mode 100644 src/commands/eval.js create mode 100644 src/commands/playerinfo.js create mode 100644 src/commands/terminal.js create mode 100644 src/commandtemplate.js rename src/{commands => }/evaljs.js (88%) create mode 100644 src/logger.js delete mode 100644 src/logs/2024-03-27.txt delete mode 100644 src/logs/2024-03-28.txt delete mode 100644 src/logs/2024-03-29.txt delete mode 100644 src/midis/README.txt delete mode 100644 src/midis/badpiggies.mid delete mode 100644 src/midis/ballistic.mid delete mode 100644 src/midis/hell.mid delete mode 100644 src/midis/manifest.mid create mode 100644 src/util/bots/hbot.json create mode 100644 src/util/bots/sc09.json create mode 100644 src/util/music/midi-proxy.js rename src/util/{ => music}/midi_converter/convert_note.js (100%) rename src/util/{ => music}/midi_converter/instrument_map.js (100%) rename src/util/{ => music}/midi_converter/instruments.json (100%) rename src/util/{ => music}/midi_converter/main.js (100%) rename src/util/{ => music}/midi_converter/package.json (100%) rename src/util/{ => music}/midi_converter/percussion_map.js (100%) rename src/util/{ => music}/nbs_converter.js (100%) rename src/util/{ => music}/nbs_file.js (100%) rename src/util/{ => music}/txt_song_parser.js (100%) diff --git a/.gitignore b/.gitignore index 75da103..941e4c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -src/node_modules -src/config.js -src/.env +node_modules +logs +midis +config.js +.env amog diff --git a/src/main.sh b/main.sh similarity index 51% rename from src/main.sh rename to main.sh index 765b28a..1ba92ac 100644 --- a/src/main.sh +++ b/main.sh @@ -1,5 +1,5 @@ while true; do echo "Starting FNFBoyfriendBot...." -node --trace-warnings . +node --max-old-space-size=1000 --trace-warnings src/index.js sleep 1 done diff --git a/music.js b/music.js new file mode 100644 index 0000000..d4f34ae --- /dev/null +++ b/music.js @@ -0,0 +1,201 @@ +const path = require('path') +const fs = require('fs') +const { Midi } = require('@tonejs/midi') +const { convertMidi } = require('../util/midi_converter') +const convertNBS = require('../util/nbs_converter') +const parseTXTSong = require('../util/txt_song_parser') +const midiproxy = require('../util/midi-proxy') +midiproxy() +const soundNames = { + harp: 'minecraft:block.note_block.harp', + basedrum: 'minecraft:block.note_block.basedrum', + snare: 'minecraft:block.note_block.snare', + hat: 'minecraft:block.note_block.hat', + bass: 'minecraft:block.note_block.bass', + flute: 'minecraft:block.note_block.flute', + bell: 'minecraft:block.note_block.bell', + guitar: 'minecraft:block.note_block.guitar', + chime: 'minecraft:block.note_block.chime', + xylophone: 'minecraft:block.note_block.xylophone', + iron_xylophone: 'minecraft:block.note_block.iron_xylophone', + cow_bell: 'minecraft:block.note_block.cow_bell', + didgeridoo: 'minecraft:block.note_block.didgeridoo', + bit: 'minecraft:block.note_block.bit', + banjo: 'minecraft:block.note_block.banjo', + pling: 'minecraft:block.note_block.pling' +} + +async function inject (bot) { + bot.music = function () {} + bot.music.song = null + bot.music.loop = 0 + bot.music.queue = [] + let time = 0 + let startTime = 0 + let noteIndex = 0 + bot.music.skip = function () { + if (bot.music.loop === 2) { + bot.music.queue.push(bot.music.queue.shift()) + bot.music.play(bot.music.queue[0]) + } else { + bot.music.queue.shift() + } + resetTime() + } +const midisFolder = path.join(__dirname, '../../midis'); // idfk +//why is it not trying to find the folder tf +// i am having a stroke from this + try { + if (!fs.existsSync(midisFolder)) { + fs.mkdirSync(midisFolder); + } +}catch(e) {} + const bossbarName = 'music' // maybe make this in the config? + + const selector = '@a[tag=!nomusic]' + + const interval = setInterval(async () => { + if (!bot.music.queue.length) return + bot.music.song = bot.music.queue[0] + time = Date.now() - startTime + + // bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent())) + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea? + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} players ${selector}`) + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(bot.getMessageAsPrismarine(toComponent()).toMotd())}`) + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`) + await bot.chatDelay(150) + bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`) + await bot.chatDelay(150) + bot.core.run(`title @a actionbar ${JSON.stringify(bot.getMessageAsPrismarine(toComponent()).toMotd())}`) + await bot.chatDelay(150) + + while (bot.music.song?.notes[noteIndex]?.time <= time) { + const note = bot.music.song.notes[noteIndex] + const floatingPitch = 2 ** ((note.pitch - 12) / 12.0) + bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`) + noteIndex++ + if (noteIndex >= bot.music.song.notes.length) { + bot.tellraw([ + { + text: 'Finished playing ' + }, + { + text: bot.music.song.name, + color: 'gold' + } + ]) + + if (bot.music.loop === 1) { + resetTime() + return + } + if (bot.music.loop === 2) { + resetTime() + bot.music.queue.push(bot.music.queue.shift()) + bot.music.play(bot.music.queue[0]) + return + } + bot.music.queue.shift() + bot.music.song = null // useless? + if (!bot.music.queue[0]) { + bot.music.stop() + return + } + if (bot.music.queue[0].notes.length > 0) { + if (bot.music.queue.length !== 1) resetTime() + bot.music.play(bot.music.queue[0]) + return + } + } + } + }, 100) + + bot.on('end', () => { +// clearInterval(interval) + bot.music.stop() + }) + + bot.music.load = async function (buffer, fallbackName = '[unknown]') { + let song + switch (path.extname(fallbackName)) { + case '.nbs': + song = convertNBS(buffer) + if (song.name === '') song.name = fallbackName + break + case '.txt': + song = parseTXTSong(buffer.toString()) + song.name = fallbackName + break + default: + // TODO: use worker_threads so the entire bot doesn't freeze (for example parsing we are number 1 black midi) + + // eslint-disable-next-line no-case-declarations + const midi = new Midi(buffer) + song = convertMidi(midi) + if (song.name === '') song.name = fallbackName + break + } + return song + } + + bot.music.play = function (song) { + if (bot.music.queue.length === 1) resetTime() + } + + bot.music.stop = function () { + bot.music.song = null + bot.music.loop = 0 + bot.music.queue = [] + resetTime() + } + + function resetTime () { + time = 0 + startTime = Date.now() + noteIndex = 0 + bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk + } + + function formatTime (time) { + const seconds = Math.floor(time / 1000) + + return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, '0')}` + } + + function toComponent () { + const component = [ + + { text: bot.music.song.name, color: 'green' }, + { text: ' | ', color: 'dark_gray' }, + { text: formatTime(time), color: 'gray' }, + { text: ' / ', color: 'dark_gray' }, + { text: formatTime(bot.music.song.length), color: 'gray' }, + { text: ' | ', color: 'dark_gray' }, + { text: noteIndex, color: 'gray' }, + { text: ' / ', color: 'dark_gray' }, + { text: bot.music.song.notes.length, color: 'gray' } + ] + + if (bot.music.loop === 1) { + component.push({ text: ' | ', color: 'dark_gray' }) + component.push({ text: 'Looping Current', color: 'green' }) + } + if (bot.music.loop === 2) { + component.push({ text: ' | ', color: 'dark_gray' }) + component.push({ text: 'Looping All', color: 'green' }) + } + + return component + } +} + +module.exports = inject diff --git a/src/package-lock.json b/package-lock.json similarity index 76% rename from src/package-lock.json rename to package-lock.json index 691880a..50b5017 100644 --- a/src/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "src", + "name": "FridayNightFunkinBoyfriendBot", "lockfileVersion": 3, "requires": true, "packages": { @@ -9,16 +9,22 @@ "@vitalets/google-translate-api": "^9.2.0", "axios": "^1.6.8", "color-convert": "^2.0.1", + "cowsay2": "^2.0.4", "discord.js": "^14.14.1", + "dockerode": "^4.0.2", "dotenv": "^16.4.5", + "final-stream": "^2.0.4", "http-proxy-agent": "^7.0.2", "isolated-vm": "^4.7.2", "matrix-js-sdk": "^31.6.1", "minecraft-protocol": "^1.47.0", + "moment-timezone": "^0.5.45", "prismarine-chat": "^1.10.0", "prismarine-registry": "^1.7.0", "readline": "^1.3.0", + "stream": "^0.0.2", "urban-dictionary": "git+https://code.chipmunk.land/chipmunkMC/urban-dictionary.git", + "weather-js": "^2.0.0", "wikipedia": "^2.1.2" } }, @@ -54,6 +60,11 @@ "node": ">=6.9.0" } }, + "node_modules/@balena/dockerignore": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz", + "integrity": "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==" + }, "node_modules/@discordjs/builders": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.7.0.tgz", @@ -338,6 +349,14 @@ "resolved": "https://registry.npmjs.org/another-json/-/another-json-0.2.0.tgz", "integrity": "sha512-/Ndrl68UQLhnCdsAzEXLMFuOR546o2qbYRqCglaNHbjXrwG1ayTcdwr3zkSGOGtGXDyR5X9nCFfnyG2AFJIsqg==" }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/array-flatten": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz", @@ -348,11 +367,32 @@ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "integrity": "sha512-6i37w/+EhlWlGUJff3T/Q8u1RGmP5wgbiwYnOnbOqvtrPxT63/sYFyP9RcpxtxGymtfA075IvmOnL7ycNOWl3w==" }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" + }, "node_modules/axios": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", @@ -387,6 +427,14 @@ } ] }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -480,6 +528,15 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" }, + "node_modules/buildcheck": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", + "integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==", + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -488,6 +545,11 @@ "node": ">=4" } }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -533,6 +595,50 @@ "node": ">= 0.6" } }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "node_modules/cowsay2": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/cowsay2/-/cowsay2-2.0.4.tgz", + "integrity": "sha512-q8iyB0HMF+HSoYeE5Pk4vNdk0mBDFakIzoFPmi1u5ZhcetvUogz2bdKM2pgF+Drn5oYoFr1a7OHwUq54A1HXlw==", + "dependencies": { + "string-width": "^4" + }, + "bin": { + "cowsay2": "cli.js" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cpu-features": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.9.tgz", + "integrity": "sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "buildcheck": "~0.0.6", + "nan": "^2.17.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -629,6 +735,57 @@ "node": ">=16.11.0" } }, + "node_modules/docker-modem": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.3.tgz", + "integrity": "sha512-89zhop5YVhcPEt5FpUFGr3cDyceGhq/F9J+ZndQ4KfqNvfbJpPMfgeixFgUj5OjCYAboElqODxY5Z1EBsSa6sg==", + "dependencies": { + "debug": "^4.1.1", + "readable-stream": "^3.5.0", + "split-ca": "^1.0.1", + "ssh2": "^1.15.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/docker-modem/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/dockerode": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.2.tgz", + "integrity": "sha512-9wM1BVpVMFr2Pw3eJNXrYYt6DT9k0xMcsSCjtPvyQ+xa1iPg/Mo3T/gUcwI0B2cczqCeCYRPF8yFYDwtFXT0+w==", + "dependencies": { + "@balena/dockerignore": "^1.0.2", + "docker-modem": "^5.0.3", + "tar-fs": "~2.0.1" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/dockerode/node_modules/tar-fs": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", + "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.0.0" + } + }, "node_modules/dotenv": { "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", @@ -640,6 +797,15 @@ "url": "https://dotenvx.com" } }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -648,6 +814,19 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/emitter-component": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.2.tgz", + "integrity": "sha512-QdXO3nXOzZB4pAjM0n6ZE+R9/+kPpECA/XSELIcc54NeYVnBqIk+4DFiBgK+8QbV3mdvTG6nedl7dTYgO+5wDw==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -685,6 +864,19 @@ "node": ">=6" } }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ] + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -695,6 +887,11 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "node_modules/final-stream": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/final-stream/-/final-stream-2.0.4.tgz", + "integrity": "sha512-kBaHWwbW2oRFp1WZeY28QrCwv5yJVJTO/tPHYIWLs3ezd2DvCXrBayqgG096tJPqZhUaCM/y1439LkAjnr7xaA==" + }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -714,6 +911,14 @@ } } }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "engines": { + "node": "*" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -732,11 +937,40 @@ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -764,6 +998,20 @@ "node": ">= 14" } }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -805,6 +1053,19 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, "node_modules/isolated-vm": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/isolated-vm/-/isolated-vm-4.7.2.tgz", @@ -817,6 +1078,11 @@ "node": ">=16.0.0" } }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "node_modules/jose": { "version": "4.15.5", "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.5.tgz", @@ -825,11 +1091,26 @@ "url": "https://github.com/sponsors/panva" } }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, "node_modules/jsonwebtoken": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", @@ -851,6 +1132,20 @@ "npm": ">=6" } }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -1116,6 +1411,25 @@ "nearley": "^2.19.5" } }, + "node_modules/moment": { + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "engines": { + "node": "*" + } + }, + "node_modules/moment-timezone": { + "version": "0.5.45", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.45.tgz", + "integrity": "sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==", + "dependencies": { + "moment": "^2.29.4" + }, + "engines": { + "node": "*" + } + }, "node_modules/moo": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", @@ -1126,6 +1440,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/nan": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.19.0.tgz", + "integrity": "sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==", + "optional": true + }, "node_modules/napi-build-utils": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", @@ -1190,6 +1510,14 @@ "asn1": "0.2.3" } }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, "node_modules/oidc-client-ts": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/oidc-client-ts/-/oidc-client-ts-3.0.1.tgz", @@ -1221,6 +1549,11 @@ "node": ">=8" } }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, "node_modules/prebuild-install": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.2.tgz", @@ -1347,6 +1680,11 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -1364,6 +1702,14 @@ "node": ">=6" } }, + "node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/railroad-diagrams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", @@ -1420,6 +1766,59 @@ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/request/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -1441,6 +1840,16 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" + }, "node_modules/sdp-transform": { "version": "2.14.2", "resolved": "https://registry.npmjs.org/sdp-transform/-/sdp-transform-2.14.2.tgz", @@ -1520,6 +1929,60 @@ "npm": ">= 3.0.0" } }, + "node_modules/split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", + "integrity": "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==" + }, + "node_modules/ssh2": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.15.0.tgz", + "integrity": "sha512-C0PHgX4h6lBxYx7hcXwu3QWdh4tg6tZZsTfXcdvc5caW/EMxaB4H9dWsl7qk+F7LAW762hp8VbXOX7x4xUYvEw==", + "hasInstallScript": true, + "dependencies": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2" + }, + "engines": { + "node": ">=10.16.0" + }, + "optionalDependencies": { + "cpu-features": "~0.0.9", + "nan": "^2.18.0" + } + }, + "node_modules/ssh2/node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/sshpk": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", + "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -1528,6 +1991,14 @@ "node": ">= 0.8" } }, + "node_modules/stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", + "integrity": "sha512-gCq3NDI2P35B2n6t76YJuOp7d6cN/C7Rt0577l91wllh0sY9ZBuw9KaSGqH/b0hzn3CWWJbpbW0W0WvQ1H/Q7g==", + "dependencies": { + "emitter-component": "^1.1.1" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1555,6 +2026,30 @@ } ] }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -1610,6 +2105,18 @@ "node": ">=0.6" } }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -1636,6 +2143,11 @@ "node": "*" } }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, "node_modules/undici": { "version": "5.27.2", "resolved": "https://registry.npmjs.org/undici/-/undici-5.27.2.tgz", @@ -1694,6 +2206,28 @@ "macaddress": "^0.5.1" } }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/weather-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/weather-js/-/weather-js-2.0.0.tgz", + "integrity": "sha512-vM7BUa+QUOu4mW48Gdnqe6HRPFpBkNy0gjKvnOHwYpbdylvJorIG5+EjUVaf2SmWrkE0Je1tfsJG+pWQBEs16g==", + "dependencies": { + "request": "2.x.x", + "xml2js": "0.4.x" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -1745,6 +2279,26 @@ } } }, + "node_modules/xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/src/package.json b/package.json similarity index 76% rename from src/package.json rename to package.json index 377f970..04bc204 100644 --- a/src/package.json +++ b/package.json @@ -4,16 +4,22 @@ "@vitalets/google-translate-api": "^9.2.0", "axios": "^1.6.8", "color-convert": "^2.0.1", + "cowsay2": "^2.0.4", "discord.js": "^14.14.1", + "dockerode": "^4.0.2", "dotenv": "^16.4.5", + "final-stream": "^2.0.4", "http-proxy-agent": "^7.0.2", "isolated-vm": "^4.7.2", "matrix-js-sdk": "^31.6.1", "minecraft-protocol": "^1.47.0", + "moment-timezone": "^0.5.45", "prismarine-chat": "^1.10.0", "prismarine-registry": "^1.7.0", "readline": "^1.3.0", + "stream": "^0.0.2", "urban-dictionary": "git+https://code.chipmunk.land/chipmunkMC/urban-dictionary.git", + "weather-js": "^2.0.0", "wikipedia": "^2.1.2" } } diff --git a/random-bullshit/amogus b/random-bullshit/amogus deleted file mode 100644 index e69de29..0000000 diff --git a/random-bullshit/amogus.js b/random-bullshit/amogus.js deleted file mode 100644 index 9582b5f..0000000 --- a/random-bullshit/amogus.js +++ /dev/null @@ -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) - } -} diff --git a/random-bullshit/botsrun.js b/random-bullshit/botsrun.js deleted file mode 100644 index f8fb0b6..0000000 --- a/random-bullshit/botsrun.js +++ /dev/null @@ -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) }) - - - }// -} diff --git a/random-bullshit/bruhifytellraw.js b/random-bullshit/bruhifytellraw.js deleted file mode 100644 index 75b7cb4..0000000 --- a/random-bullshit/bruhifytellraw.js +++ /dev/null @@ -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 diff --git a/random-bullshit/bruhifytitle.js b/random-bullshit/bruhifytitle.js deleted file mode 100644 index f42018b..0000000 --- a/random-bullshit/bruhifytitle.js +++ /dev/null @@ -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 diff --git a/random-bullshit/calculator.js b/random-bullshit/calculator.js deleted file mode 100644 index e12ca72..0000000 --- a/random-bullshit/calculator.js +++ /dev/null @@ -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' }]) - } - } -} - diff --git a/random-bullshit/chatqueue.js b/random-bullshit/chatqueue.js deleted file mode 100644 index e69de29..0000000 diff --git a/random-bullshit/evaljsvm2.js b/random-bullshit/evaljsvm2.js deleted file mode 100644 index 49bccb7..0000000 --- a/random-bullshit/evaljsvm2.js +++ /dev/null @@ -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' }]) - - } - } - } - } diff --git a/random-bullshit/nbs-converter.js b/random-bullshit/nbs-converter.js deleted file mode 100644 index 563723d..0000000 --- a/random-bullshit/nbs-converter.js +++ /dev/null @@ -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 diff --git a/random-bullshit/time.js b/random-bullshit/time.js deleted file mode 100644 index e4c5afb..0000000 --- a/random-bullshit/time.js +++ /dev/null @@ -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) - } - } -} -} diff --git a/random-bullshit/visibility.js b/random-bullshit/visibility.js deleted file mode 100644 index 4ba92a9..0000000 --- a/random-bullshit/visibility.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/random-bullshit/vm.js b/random-bullshit/vm.js deleted file mode 100644 index bcd075e..0000000 --- a/random-bullshit/vm.js +++ /dev/null @@ -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 diff --git a/src/CommandModules/command_source.js b/src/CommandModules/command_source.js index 18922fc..32a6676 100644 --- a/src/CommandModules/command_source.js +++ b/src/CommandModules/command_source.js @@ -1,26 +1,17 @@ class CommandSource { - constructor (player, sources, hash, owner, discordMessageEvent = null, consoleOnly, name, profile, bot, prefix = "~") { + constructor (player, sources, hash, owner,) { this.player = player//kaboom on crack! // idk fr // mabe // /shrug //am i good to restart it? this.sources = sources - this.profile = bot this.hash = hash this.owner = owner - this.consoleOnly = consoleOnly - this.discordMessageEvent = discordMessageEvent - this.prefix = prefix - + } - - sendFeedback () {} - sendError (message) { - this.sendFeedback([{ text: '', color: 'red' }, message], false) - - } + } module.exports = CommandSource diff --git a/src/bot.js b/src/bot.js index a2a4821..328bbfe 100644 --- a/src/bot.js +++ b/src/bot.js @@ -1,4 +1,4 @@ - const mc = require("minecraft-protocol"); +const mc = require("minecraft-protocol"); const { EventEmitter } = require("node:events"); const fs = require("fs"); const path = require("path"); @@ -13,96 +13,94 @@ function createBot(options = {}) { bot.options = { host: options.host ??= "localhost", username: options.username ??= "FNFBoyfriendBot", - hideErrors: options.hideErrors ??= false, // HACK: Hide errors by default as a lazy fix to console being spammed with the console + hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with the console version: options.version ??= '1.20.2', -} + +}, + bot.options = options; // Create our client object, put it on the bot, and register some events bot.on("init_client", (client) => { client.on("packet", (data, meta) => { bot.emit("packet", data, meta); - try{ - bot.emit('packet.' + meta.name, data) - } catch(e) { - if(e.toString() === 'RangeError: Invalid string length'){ -bot._client.end() -}else{ -console.log(e) -} + try{ + bot.emit('packet.' + meta.name, data) + } catch(e) { + if(e.toString() === 'RangeError: Invalid string length'){ + bot._client.chat('Leaving to prevent crashing') + bot._client.end() + } else { + console.log(e) + } } }); const timer = setInterval(() => { -if(!bot.options.endcredits){ -return -}else{ -bot.chat(`Join the FNFBoyfriendBot discord ${bot.options.discord.invite}`) - -} - }, 280000) + if(!bot.options.endcredits){ + return + }else{ + bot.chat(`Join the FNFBoyfriendBot discord ${bot.options.discord.invite}`) + } +}, 280000) client.on("login", async function (data) { bot.uuid = client.uuid; bot.username = client.username; bot.port = bot.options.port; bot.version = bot.options.version; - - - -var day = new Date().getDay() -if(day === 5){ -bot.chat('Getting freaky on a Friday Night!') -}else{ -const buildstring = process.env["buildstring"] - bot.chat(ChatMessage.fromNotch(JSON.stringify(process.env['buildstring'])).toMotd().replaceAll('§', '&')) -} - -timer -}) + if (bot.options.isCreayun) { + bot.command('server creative') + } + try { + var day = new Date().getDay() + if (day === 5) { + bot.sendFeedback({text:"Gettin' freaky on a Friday Night!"}) + } else { + bot.sendFeedback({text:`${process.env.buildstring}`}) + } + }catch(e){ + } + timer + }) client.on("end", (reason) => { - bot.emit("end", reason); - bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`); - bot.cloop.clear() - bot.memusage.off() -bot.tps.off() - clearInterval(timer) -bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' ) - }); + bot.emit("end", reason); + bot.console.warn(`Disconnected: ${reason.toString()}`); + bot.cloop.clear() + bot.memusage.off() + bot.tps.off() + bot.bruhifyText = '' + clearInterval(timer) + bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``' ) + + }); client.on("disconnect", (reason) => { bot.emit("disconnect", reason); - bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`); - -bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' ) - }); + bot.console.warn(`Disconnected: ${reason.toString()}`); + bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``' ) + + }); client.on("kick_disconnect", (reason) => { bot.emit("kick_disconnect", reason); - bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`); -//console.log(reason) -bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' ) - }); + bot.console.warn(`Disconnected: ${reason.toString()}`); + bot?.discord?.channel?.send('``Disconnected:' + reason.toString() + '``') + }); client.on("keep_alive", ({ keepAliveId }) => { bot.emit("keep_alive", { keepAliveId }); }); client.on("error", (error) => { - -bot?.discord?.channel?.send('``' + error.toString() + '``' ) -bot.emit("error", error) -}) -}); + bot?.discord?.channel?.send('``' + error.toString() + '``' ) + bot.emit("error", error) + }) + }); const client = options.client ?? mc.createClient(options); bot._client = client; bot.emit("init_client", client); - - bot.bots = options.bots ?? [bot]; - - - - + bot.bots = options.bots ?? [bot]; return bot; } diff --git a/src/commands/bots.js b/src/commands/bots.js index 6939ae0..7ffb68d 100644 --- a/src/commands/bots.js +++ b/src/commands/bots.js @@ -1,11 +1,28 @@ // TODO: Maybe add more authors -const bots = [ +/*const bots = [ { name: { text: "HBot", color: "aqua", bold: false }, authors: ["hhhzzzsss"], exclaimer: "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO", foundation: "java/mcprotocollib", prefixes: ["#"], + maintained:'false', + }, + { + name: { text: "SC09", color: "gray", bold: false }, + authors: ["spyingcreeper09"], + exclaimer: "i approve :3", + foundation: "NodeJS/node-minecraft-protocol", + prefixes: ["@"], + maintained:'true', + }, +{ + name: { text: "FBot", color: "gold", bold: false }, + authors: ["aaa"], + exclaimer: "frog :3", + foundation: "NodeJS/Node-minecraft-protocol", + prefixes: ["+"], + maintained:'true?', }, { name: { text: "64Bot", color: "gold", bold: false }, @@ -13,6 +30,7 @@ const bots = [ exclaimer: "NINTENDO 64?!?!??!?! 69Bot when??????", foundation: "NodeJS/Mineflayer", prefixes: ["w="], + maintained:'false', }, { name: { text: "Nebulabot", color: "dark_purple", bold: false }, @@ -20,6 +38,7 @@ const bots = [ exclaimer: "the void", foundation: "NodeJS/Node-minecraft-protocol", prefixes: ["["], + maintained:'false', }, { name: [ @@ -30,6 +49,8 @@ const bots = [ exclaimer: "prismarine :3", foundation: "NodeJS/Node-minecraft-protocol", prefixes: ["["], + maintained:'true', + }, { name: { text: "SharpBot", color: "aqua", bold: false }, @@ -38,6 +59,7 @@ const bots = [ "sharp as in the tv? idfk im out of jokes also the first c# bot on the list??", foundation: "C#/MineSharp", prefixes: ["s="], + maintained:'false', }, { @@ -46,6 +68,7 @@ const bots = [ exclaimer: "stop mooning/mooing me ", foundation: "NodeJS/Mineflayer", prefixes: ["m="], + maintained:'false', }, { name: { text: "TableBot", color: "yellow", bold: false }, @@ -53,6 +76,7 @@ const bots = [ exclaimer: "TABLE CLOTH BOT?!?! ", foundation: "NodeJS/Node-minecraft-protocol", prefixes: ["t!"], + maintained:'false?', }, { name: [ @@ -63,18 +87,21 @@ const bots = [ exclaimer: "", foundation: "Java/Custom", prefixes: ["!"], + maintained:'false?', }, { name: { text: "SBot Java", color: "white", bold: false }, // TODO: Gradient authors: ["evkc"], foundation: "Java/MCProtocolLib", prefixes: [":"], + maintained:'true', }, { name: { text: "SBot Rust", color: "white", bold: false }, // TODO: Gradient authors: ["evkc"], foundation: "Rust", prefixes: ["re:"], + maintained:':shrug:', }, { name: { text: "Z-Boy-Bot", color: "dark_purple", bold: false }, // TODO: Gradient @@ -82,6 +109,7 @@ const bots = [ authors: ["Romnci"], foundation: "NodeJS/mineflayer or Java/mcprotocollib idfk", prefixes: ["Z]"], + maintained:'false', }, { name: { text: "ABot", color: "gold", bold: true }, // TODO: Gradient @@ -89,6 +117,7 @@ const bots = [ authors: [{ text: "_yfd", color: "light_purple" }], foundation: "NodeJS/Node-Minecraft-Protocol", prefixes: ["<"], + maintained:'false', }, { name: { text: "ABot-V2", color: "gold", bold: true }, // TODO: Gradient @@ -96,6 +125,7 @@ const bots = [ authors: [{ text: "_yfd", color: "light_purple" }], foundation: "NodeJS/Node-Minecraft-Protocol", prefixes: ["<"], + maintained:'false', }, { name: { text: "FardBot", color: "light_purple", bold: false }, @@ -103,6 +133,7 @@ const bots = [ exclaimer: "bot is dead lol", foundation: "NodeJS/Mineflayer", prefixes: ["<"], + maintained:'false', }, { @@ -113,17 +144,20 @@ const bots = [ foundation: "Java/MCProtocolLib", prefixes: ["'", "/'"], + maintained:'false', }, { name: { text: "ChipmunkBot NodeJS", color: "green", bold: false }, authors: ["_ChipMC_"], foundation: "NodeJS/Node-Minecraft-Protocol", - }, + maintained:'true', +}, { name: { text: "TestBot", color: "aqua", bold: false }, authors: ["Blackilykat"], foundation: "Java/MCProtocolLib", prefixes: ["-"], + maintained:'false', }, { name: { text: "UBot", color: "grey", bold: false }, @@ -132,6 +166,7 @@ const bots = [ foundation: "NodeJS/node-minecraft-protocol", prefixes: ['"'], + maintained:'false', }, { name: { text: "ChomeNS Bot Java", color: "yellow", bold: false }, @@ -139,6 +174,7 @@ const bots = [ exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak", foundation: "Java/MCProtocolLib", prefixes: ["*", "cbot ", "/cbot "], + maintained:'false', }, { name: { text: "ChomeNS Bot NodeJS", color: "yellow", bold: false }, @@ -146,6 +182,7 @@ const bots = [ foundation: "NodeJS/Node-Minecraft-Protocol", prefixes: ["*", "cbot", "/cbot"], + maintained:'false', }, { name: { text: "RecycleBot", color: "dark_green", bold: false }, @@ -153,6 +190,7 @@ const bots = [ exclaimer: "nice bot", language: "NodeJS/node-minecraft-protocol", prefixes: ["="], + maintained:'true', }, { name: { text: "neobot", color: "blue", bold: false }, @@ -160,6 +198,7 @@ const bots = [ authors: ["mirkokral"], foundation: "java/MCProtocolLib", prefixes: ["_"], + maintained:'false', }, { name: { text: "ManBot", color: "dark_green", bold: false }, @@ -168,6 +207,7 @@ const bots = [ authors: ["Man/LogintimedOut"], foundation: "NodeJS/mineflayer", prefixes: ["(Note:I dont remember!!)"], + maintained:'false', }, { name: [ @@ -178,16 +218,18 @@ const bots = [ authors: ["IuCC"], foundation: "NodeJS/node-minecraft-protocol", prefixes: ["["], + maintained:'false', }, { name: [ { text: "Blurry", color: "dark_purple", bold: false }, { text: "Bot", color: "red" }, ], - exclaimer: "", + exclaimer: "§4§kfuck you", authors: ["SirLennox"], - foundation: "Java/custom", + foundation: "???", prefixes: [","], + maintained:'false', }, { name: [{ text: "SnifferBot", color: "gold", bold: false }], @@ -195,6 +237,7 @@ const bots = [ authors: ["popbob"], foundation: "NodeJS/Node-minecraft-protocol", prefixes: [">"], + maintained:'false', }, { name: [{ text: "XBot", color: "dark_purple", bold: false }], @@ -202,6 +245,7 @@ const bots = [ authors: ["popbob"], foundation: "ts-Node/Node-minecraft-protocol", prefixes: ["$"], + maintained:':shrug:', }, { name: [ @@ -212,6 +256,7 @@ const bots = [ authors: ["ginlang , G6_, ArrayBuffer, and i guess more??"], foundation: "NodeJS/node-minecraft-protocol", prefixes: ["^"], + maintained:'false', }, { @@ -231,6 +276,7 @@ const bots = [ exclaimer: "FNFBoyfriendBot NMP Rewrite", foundation: "NodeJS/node-minecraft-protocol", prefixes: ["~ % &"], + maintained:'true', }, { name: [ @@ -247,9 +293,13 @@ const bots = [ "1037 LINES OF CODE WTFARD!??! also this version is in console commands only", foundation: "NodeJS/mineflayer", prefixes: [], + maintained:'false', }, ]; +*/ const CommandError = require('../CommandModules/command_error') +const fs = require('fs') +const path = require('path') module.exports = { name: "bots", description: ["shows a list of known bots"], @@ -257,24 +307,47 @@ module.exports = { trustLevel: 0, usage:[""], execute(context) { - const query = context.arguments.join(" ").toLowerCase(); + +//const bots = fs.readdirSync(path.join(__dirname,'../util/bots')).forEach(file => require(`../util/bots/${file}`)) +//const bots = require(fs.readdirSync(path.join(__dirname,'../util/bots')).forEach(file => (file))) +//const bots = require(['../util/bots'].forEach(file => file)) + const query = context.arguments.join(" ").toLowerCase(); const bot = context.bot; +const botsFiles = path.join(__dirname, '../util/bots'); + //list = []; +//for (const file of fs.readdirSync('./util/bots')) { +//bots.push(require(path.join(__dirname, '../util/bots', file))) +//}; + //name = Object.values(bots.map(name => name)) +//auth = Object.values(bots).map(sus => sus.authors) + //exclaimer = Object.values(bots).map(sus => sus.exclaimer) + //prefixes = Object.values(bots).map(sus => sus.prefixes) + //foundation = Object.values(bots).map(sus => sus.foundation) + //prefix = Object.values(bots).map(sus => sus.prefixes) +// maintained = Object.values(bots).map(sus => sus.maintained) +//amongus = Object.values(bots).map(sus => sus) if (query.length === 0) { - const list = []; + const list = []; if(!bot.options.Core.enabled){ throw new CommandError('Coreless mode is active can not execute command!') }else{ - for (const info of bots) { - if (list.length !== 0) list.push({ text: ", ", color: "gray" }); // list.push(info.name) +//for (const file of fs.readdirSync('./util/bots')) { +//bots.push(require(path.join(__dirname, '../util/bots', file))) +//}; +//bots = fs.readdirSync('./util/bots') +for (const file of fs.readdirSync('./util/bots')) { +list.push(require(path.join(__dirname,'../util/bots',file))) +} + for (const info of bots) { + if (bots.length !== 0) list.push({ text: ", ", color: "gray" }); // list.push(info.name) list.push(info.name); } - - context.source.sendFeedback( - bot.getMessageAsPrismarine(["Known bots (", bots.length, ") - ", ...list]).toMotd().replaceAll('\xa7','\xa7'), - false, - ); +bot.tellraw(bots.name) +console.log(Object.values(bots).map(name => name)) +//const ping = Object.values(bot.players).map(player =>player.latency) + bot.sendFeedback(bot.getMessageAsPrismarine(["Known bots (", bots.length, ") - ", ...list])?.toMotd().replaceAll('\xa7','\xa7'),false); return; - } +} } for (const info of bots) { const plainName = String( @@ -286,8 +359,17 @@ if(!bot.options.Core.enabled){ sendBotInfo(info, bot) { const component = [""]; - component.push("Name: ", info.name); - if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer); + //component.push("Name: ", amongus.name); +//const name = Object.values(bots.map(name => name.name)) +//const auth = Object.values(bots).map(sus => sus.authors) +//const exclaimer = Object.values(bots).map(sus => sus.exclaimer) +//const prefixes = Object.values(bots).map(sus => sus.prefixes) +//const foundation = Object.values(bots).map(sus => sus.foundation) +//const prefix = Object.values(bots).map(sus => sus.prefixes) +//const maintained = Object.values(bots).map(sus => sus.maintained) + component.push("Name: ", Object.values(bots).map(name => name.name)); +console.log(name) +if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer); if (info.authors && info.authors.length !== 0) { component.push("\n", "Authors: "); for (const author of info.authors) { @@ -303,6 +385,8 @@ if(!bot.options.Core.enabled){ } component.pop(); } + if(info.maintained) component.push("\n","Maintained: ",info.maintained) + bot.tellraw([component]); }, }; diff --git a/src/commands/bruhify.js b/src/commands/bruhify.js index bffc626..5856c0d 100644 --- a/src/commands/bruhify.js +++ b/src/commands/bruhify.js @@ -13,7 +13,7 @@ const args = context.arguments bot.bruhifyText = args.join(' ') -context.source.sendFeedback(JSON.stringify(bot.bruhifyText)) +bot.sendFeedback(JSON.stringify(bot.bruhifyText)) } diff --git a/src/commands/changelog.js b/src/commands/changelog.js index 6ad91ce..56b3823 100644 --- a/src/commands/changelog.js +++ b/src/commands/changelog.js @@ -56,6 +56,20 @@ const bots = [ foundation: '2/15/24', exclaimer:'added music finally fixed coreless mode made a seperate function for discord in the command manager and idk what all', }, +{// + name: { text: 'v5.0.7a', color: 'gold', bold:false }, + authors: ['Ski'], + + foundation: '3/29/24', + exclaimer:'rewrote alot of shiiiiiiit :3 and added matrix support', + }, + {// + name: { text: 'v5.0.7b', color: 'gold', bold:false }, + authors: ['Ski'], + + foundation: '4/22/24', + exclaimer:'a lot of clean up adding shit and more', + }, ]// //back @@ -102,7 +116,7 @@ const bot = context.bot ] } - context.source.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\u00a7','\u00a7'), false) + bot.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\u00a7','\u00a7'), false) return } diff --git a/src/commands/changelogPreV5.0.js b/src/commands/changelogPreV5.0.js index 35ea696..081c38a 100644 --- a/src/commands/changelogPreV5.0.js +++ b/src/commands/changelogPreV5.0.js @@ -375,7 +375,7 @@ const bot = context.bot ] } - context.source.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\xa7','\xa7'), false) + bot.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\xa7','\xa7'), false) return } diff --git a/src/commands/cloop.js b/src/commands/cloop.js index 6a3c963..42340ef 100644 --- a/src/commands/cloop.js +++ b/src/commands/cloop.js @@ -1,4 +1,5 @@ - const CommandError = require('../CommandModules/command_error') +const CommandError = require('../CommandModules/command_error') +const {EmbedBuilder} = require('discord.js') module.exports = { name: 'cloop', trustLevel: 1, @@ -11,53 +12,53 @@ usage:[ "list", ], execute (context, selector) { - const args = context.arguments + const args = context.arguments const bot = context.bot const source = context.source - if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return - - // throw new CommandError('temp disabled') - - - switch (selector, args[1]) { +if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return + switch (args[1]) { case 'add': - - if (parseInt(args[2]) === NaN) source.sendFeedback({ text: 'Invalid interval', color: 'red' }, false) + if (parseInt(args[1]) === NaN) source.sendFeedback({ text: 'Invalid interval', color: 'red' }) const interval = parseInt(args[2]) const command = args.slice(3).join(' ') - + bot.cloop.add(command, interval) - source.sendFeedback({ + bot.sendFeedback({ translate: 'Added \'%s\' with interval %s to the cloops', - color:'gray', with: [ command, interval ] }) - break case 'remove': - if (bot.cloop.list[args[2]].id === undefined) source.sendFeedback({ text: 'Invalid index', color: 'red' }, false) +//const aaa = args[2] +var id +// if (bot.cloop.list[args[2]].id === undefined) new CommandError({text:'Invalid index'}) +try{ - const index = (args[2]) + const index = (args[2]) bot.cloop.remove(index) - source.sendFeedback({ + bot.sendFeedback({ translate: 'Removed cloop %s', - color: 'gray', with: [ index ] }) - +} catch(e) { +if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'id')"){ +bot.sendError({text:'Invalid Index'}) +} +} + break case 'clear': bot.cloop.clear() - source.sendFeedback({ text: 'Cleared all cloops', color:'gray' }, false) + bot.sendFeedback({ text: 'Cleared all cloops' }) break - case 'list': + case 'list': const component = [] const listComponent = [] @@ -65,9 +66,91 @@ usage:[ for (const cloop of bot.cloop.list) { listComponent.push({ translate: '%s \u203a %s (%s)', - color: 'gray', with: [ - i, + `id ${i}`, + cloop.command, + cloop.interval + ] + }) + listComponent.push('\n') + + i++ + } + + listComponent.pop() + + component.push({ + translate: "Cloops (%s):", + with: [ JSON.stringify(bot.cloop.list.length) ] + }) + component.push('\n') + component.push(listComponent) +if(bot.cloop.list.length === 0){ +bot.sendFeedback({ translate: "Cloops (%s):", with: [ JSON.stringify(bot.cloop.list.length) ] }) +}else{ + bot.sendFeedback(component) + } + break + default: + bot.sendFeedback({ text: 'Invalid action', color: 'red' }) +break + } +}, +discordExecute(context) { +const args = context.arguments +const bot = context.bot +switch(args[0]) { +case 'add': + const interval = parseInt(args[1]) + const command = args.slice(2).join(' ') + + bot.cloop.add(command, interval) +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`Added ${command} with the interval ${interval} to the cloops`) + bot?.discord?.Message?.reply({ embeds: [Embed] }) +break +case 'remove': + + + + try { + + var index = (args[1]) +bot.cloop.remove(index) +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`removed cloop ${index}`) + bot?.discord?.Message?.reply({ embeds: [Embed] }) + + +} catch(e) { +if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'id')"){ +throw new CommandError({text:'Invalid Index'}) +} +} +break +case 'clear': +bot.cloop.clear() +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`cleared cloops`) + bot?.discord?.Message?.reply({ embeds: [Embed] }) +break +case 'list': + + const component = [] + + const listComponent = [] + let i = 0 + for (const cloop of bot.cloop.list) { + listComponent.push({ + translate: '%s \u203a %s (%s)', + with: [ + `id ${i}`, cloop.command, cloop.interval ] @@ -81,21 +164,23 @@ usage:[ component.push({ translate: 'Cloops (%s):', - color:'gray', with: [ bot.cloop.list.length ] }) component.push('\n') -component.push(listComponent) + component.push(listComponent) + + var Embed = new EmbedBuilder() + .setColor(`#00FFFF`) + .setTitle(`${this.name} Command`) + .setDescription(bot.getMessageAsPrismarine(component)?.toString()) + bot?.discord?.Message?.reply({ embeds: [Embed] }) + - source.sendFeedback(component,true) -//console.log(`tellraw @a ${JSON.stringify(component)}`) - - break - default: - source.sendFeedback({ text: 'Invalid action', color: 'red' }) - - break - } - } +break +default: +throw new CommandError('Invalid argument') +break } +} + } diff --git a/src/commands/cmdtest.js b/src/commands/cmdtest.js index 8f30029..3415b87 100644 --- a/src/commands/cmdtest.js +++ b/src/commands/cmdtest.js @@ -79,7 +79,7 @@ bot.tellraw([component]) const uuid = context.source.player.uuid const message = context.arguments.join(' ') // WHY SECTION SIGNS!! - context.source.sendFeedback(`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`, false) + bot.sendFeedback(`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`, false) */ break case 'error': @@ -96,8 +96,8 @@ bot.tellraw([component]) sleep(500) bot.chat('the usages are msg and error') }else{ - context.source.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }]) - context.source.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }]) + bot.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }]) + bot.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }]) } } } diff --git a/src/commands/core.js b/src/commands/core.js index 10a3261..c353159 100644 --- a/src/commands/core.js +++ b/src/commands/core.js @@ -11,15 +11,17 @@ usage:[""], // const client = context.client const args = context.arguments const source = context.source - const message = context.arguments.join(' ') + const message = context.arguments.join(' ') + + // const command = `${prefix}${args.shift()} ${hash} ${args.join(' ')}` // if (args.length === 0){ //source.sendFeedback({translate:"Too few Arguments!", color:"red"}) if (message.startsWith('/')) { bot.core.run(message.substring(1)) return } - bot.core.run(message) + bot.core.run(`${args.join(' ')}`) } - } + } \ No newline at end of file diff --git a/src/commands/cowsay.js b/src/commands/cowsay.js index fcbd62d..dae8bd5 100644 --- a/src/commands/cowsay.js +++ b/src/commands/cowsay.js @@ -26,7 +26,7 @@ usage:["list"], color: (!((primary = !primary)) ? 'gold' : 'yellow'), clickEvent: { action: 'suggest_command', - value: `${context.bot.options.commands.prefixes[0]}cowsay ${value} ` + value: `${bot.Commands.prefixes[0]}cowsay ${value} ` } }) } diff --git a/src/commands/crash.js b/src/commands/crash.js index a30aa26..e6c2863 100644 --- a/src/commands/crash.js +++ b/src/commands/crash.js @@ -44,8 +44,8 @@ const args = context.arguments bot.console.info([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }]) // bot.console.info([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }]) }else{ - context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }]) - // context.source.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }]) + bot.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }]) + // bot.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }]) } } } diff --git a/src/commands/discordmsg.js b/src/commands/discordmsg.js index 2ab636e..494a865 100644 --- a/src/commands/discordmsg.js +++ b/src/commands/discordmsg.js @@ -15,11 +15,11 @@ usage:["message"], // throw new CommandError('u202e detected') if (!args[0]) { - context.source.sendFeedback({text:'Message is empty', color:'red'}, false) + bot.sendFeedback({text:'Message is empty', color:'red'}, false) } else { bot.discord.channel.send(args.join(' ')) console.log(args[0]) - context.source.sendFeedback({ text: `Recieved: ${args.join(' ')}`, color:'green'}) + bot.sendFeedback({ text: `Recieved: ${args.join(' ')}`, color:'green'}) //} @@ -30,11 +30,11 @@ usage:["message"], //bot.discord.channel.send(args.join(' ')) /* if(!args[0]) - context.source.sendFeedback('message is empty') + bot.sendFeedback('message is empty') else if (args[0]) bot.discord.channel.send(args[0]) console.log(args[0]) -context.source.sendFeedback(`Recieved: ${args[0]}`) +bot.sendFeedback(`Recieved: ${args[0]}`) return; */ diff --git a/src/commands/echo.js b/src/commands/echo.js index 4454cde..5f4c129 100644 --- a/src/commands/echo.js +++ b/src/commands/echo.js @@ -15,5 +15,17 @@ usage:[ return } bot.chat(message) - } + + }, + +discordExecute(context) { + const bot = context.bot + const message = context.arguments.join(' ') + if (message.startsWith('/')) { + bot.command(message.substring(1)) + return + } + + bot.chat(message) } +} \ No newline at end of file diff --git a/src/commands/end.js b/src/commands/end.js index c6f0476..84c4707 100644 --- a/src/commands/end.js +++ b/src/commands/end.js @@ -9,8 +9,8 @@ usage:[""], const bot = context.bot const message = context.arguments.join(' ') const args = context.arguments -const source = context.source - source.sendFeedback(`${bot.username} fell out of the world`) + const source = context.source + bot.sendFeedback(`${bot.username} fell out of the world`) process.exit() } } diff --git a/src/commands/eval.js b/src/commands/eval.js new file mode 100644 index 0000000..161d1f2 --- /dev/null +++ b/src/commands/eval.js @@ -0,0 +1,56 @@ +const ivm = require('isolated-vm'); +const isolate = new ivm.Isolate({ memoryLimit: 128 }); +const { stylize } = require('../util/eval_colors') +const util = require('util') +module.exports = { + name: 'eval', + description:[''], + aliases:[], + trustLevel: 0, +usage:[ +"", +], +async execute (context) { + const bot = context.bot; + const args = context.arguments; + + +// Create a new isolate limited to 128MB +const ivm = require('isolated-vm'); +const isolate = new ivm.Isolate({ memoryLimit: 128 }); + +// Create a new context within this isolate. Each context has its own copy of all the builtin +// Objects. So for instance if one context does Object.prototype.foo = 1 this would not affect any +// other contexts. +const cOntext = isolate.createContextSync(); + +// Get a Reference{} to the global object within the context. +const jail = cOntext.global; + +// This makes the global object available in the context as `global`. We use `derefInto()` here +// because otherwise `global` would actually be a Reference{} object in the new isolate. +jail.setSync('global', jail.derefInto()); + +// We will create a basic `log` function for the new isolate to use. +jail.setSync('log', function(...args) { + console.log(...args); +}); + +// And let's test it out: +cOntext.evalSync('let e'); +// > hello world + +const hostile = isolate.compileScriptSync(`${args.join(' ')}`) +//console.log(await hostile) +console.log(hostile.run(`e`)) + +// Using the async version of `run` so that calls to `log` will get to the main node isolate + +(`${hostile.run(context).catch(err => console.error(err))}`) + +}, +discordExecute(context) { + const bot = context.bot; + const args = context.arguments; +} +} diff --git a/src/commands/help.js b/src/commands/help.js index 9b74c71..6b0ded2 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,18 +1,18 @@ const CommandError = require('../CommandModules/command_error') - +const {EmbedBuilder } = require('discord.js') module.exports = { name: 'help', aliases:['heko', 'cmd', '?', 'commands', 'cmds' ], description:['shows the command list or the usage of a command'], - trustLevel: 0, -usage:'[COMMAND]', + trustLevel: 0, + usage:'[COMMAND]', async execute (context) { const bot = context.bot const commandList = [] const source = context.source const args = context.arguments -const {EmbedBuilder } = require('discord.js') -// const amogus = bot.prefix + + const ChatMessage = require('prismarine-chat')(bot.options.version) const CommandManager = bot.commandManager const cmd = { @@ -24,25 +24,28 @@ const CommandManager = bot.commandManager ] } const category = { - translate: ' (%s%s%s%s%s) ', + translate: '(%s%s%s%s%s) \u203a ', bold: false, - color: 'white', - with: [ - { color: `${bot.helpTheme.pub_lickColor}`, text: 'Public'}, + color: 'dark_gray', + with: [ + { color: `${bot.Commands.colors.help.pub_lickColor}`, text: 'Public'}, { color: 'white', text: ' | '}, - { color: `${bot.helpTheme.t_rustedColor}`, text: 'Trusted'}, + { color: `${bot.Commands.colors.help.t_rustedColor}`, text: 'Trusted'}, { color: 'white', text: ' | '}, - { color: `${bot.helpTheme.own_herColor}`, text: 'Owner'}, + { color: `${bot.Commands.colors.help.own_herColor}`, text: 'Owner'}, ] } if (args[0]) { let valid - for (const commands in bot.commandManager.commandlist) { // i broke a key woops - const command = bot.commandManager.commandlist[commands] - - if (args[0].toLowerCase() === command.name) +//if (command.aliases) { command.aliases.map((a) => (this.commands[a] = command)); } + for (const commands in bot.commandManager.commandlist) { // i broke a key woops + + const command = bot.commandManager.getCommand(`${args[0].toLowerCase()}`) + if (args[0].toLowerCase() === command.name) + + //bot.tellraw(`${bot.commandManager.commandlist['help'].aliases}`) { @@ -51,28 +54,51 @@ const CommandManager = bot.commandManager }//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi() valid = true - if(source.sources.console){ - bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`${command.aliases} › ${command.description}`,color:'dark_purple'}])?.toAnsi()) - -bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])?.toAnsi()) - - bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])?.toAnsi()) - }else if(!bot.options.Core.enabled && !source.sources.console){ - bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&')) - await sleep(1000) - bot.chat(ChatMessage.fromNotch([cmd, {text:`Trust Level: ${command.trustLevel}`}]).toMotd().replaceAll('§', '&'))//[cmd, {text:`Trust Level: ${command.trustLevel}`}] - await sleep(1000) - bot.chat(ChatMessage.fromNotch([cmd, `aliases: ${command.aliases}`]).toMotd().replaceAll('§', '&')) - }else{ +if (bot.options.useChat) { +bot.sendFeedback([{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}]) +await bot.chatDelay(100) +//bot.sendFeedback({text:`${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:'dark_purple'}]) +bot.sendFeedback({text: `${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'}) +await bot.chatDelay(100) +bot.sendFeedback({text:`Aliases`,color:'dark_purple'}) +await bot.chatDelay(100) +bot.sendFeedback({text:`${command.aliases}`,color:'dark_purple'}) +await bot.chatDelay(100) +bot.sendFeedback({text:`${command.description}`}) +await bot.chatDelay(100) +bot.sendFeedback([{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}]) +await bot.chatDelay(100) +if (command.trustLevel === 2) { +await bot.chatDelay(100) +bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) +await bot.chatDelay(100) +} else if (command.trustLevel === 1) { +await bot.chatDelay(100) +bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) +await bot.chatDelay(100) +} else { +await bot.chatDelay(100) +bot.sendFeedback([{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) +await bot.chatDelay(100) +} -source.sendFeedback([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(${command.aliases}) › ${command.description}`,color:'dark_purple'}]) -source.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}]) -source.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) - +} else { +bot.sendFeedback([cmd,{text:`Trust levels: -1 = disabled, 0 = public, 1 = trusted, 2 = owner, 3 = console`,color:'dark_purple'}]) +bot.sendFeedback([cmd, {text:`${bot.Commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(Aliases: ${command.aliases}) › ${command.description}`,color:'dark_purple'}]) +bot.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}]) + +if (command.trustLevel === 2) { +bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) +} else if (command.trustLevel === 1) { +bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) +} else { +bot.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.Commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}]) + } +} break - } + // } } else valid = false - } + } if (valid) { @@ -81,15 +107,16 @@ break const args = context.arguments - source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefixes[0]}help` } : undefined}]) + bot.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefixes[0]}help` } : undefined}]) } } else { - let pub_lick = [] - let t_rust = [] - let own_her = [] - let cons_ole = [] + let pub_lick = []; + let t_rust = []; + let own_her = []; + let cons_ole = []; + let disabled = []; for (const commands in CommandManager.commandlist) { const command = CommandManager.commandlist[commands] @@ -127,7 +154,7 @@ break else if (command.trustLevel === 2) { - if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ + if(bot.options.useChat && !source.sources.console && !source.sources.discord){ own_her.push(`&4${command.name + ' '}`) }else{ @@ -135,7 +162,7 @@ break own_her.push( { text: command.name + ' ', - color: `${bot.helpTheme.own_herColor}`, + color: `${bot.Commands.colors.help.own_herColor}`, translate:"", @@ -162,13 +189,13 @@ break } else if (command.trustLevel === 1){ - if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ + if(bot.options.useChat && !source.sources.console && !source.sources.discord){ t_rust.push(`&5${command.name + ' '}`) }else { t_rust.push( { text: command.name + ' ', - color:`${bot.helpTheme.t_rustedColor}`, + color:`${bot.Commands.colors.help.t_rustedColor}`, translate:"", @@ -193,13 +220,13 @@ break } else if (command.trustLevel === 0){ - if (!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){ + if (bot.options.useChat && !source.sources.console && !source.sources.discord){ pub_lick.push(`&b${command.name + ' '}`) } else{ pub_lick.push( { text: command.name + ' ', - color: `${bot.helpTheme.pub_lickColor}`, + color: `${bot.Commands.colors.help.pub_lickColor}`, translate:"", hoverEvent:{ @@ -222,7 +249,12 @@ break } - } +} else if (command.trustLevel === -1) { + disabled.push({ + text: command.name + ' ', + color:`dark_blue`, + }) +} } function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)) @@ -232,7 +264,7 @@ break if(source.sources.console && !source.sources.discord) { bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole] - } else if(source.sources.discord&& !source.sources.console){ + } /*else if(source.sources.discord&& !source.sources.console){ const Embed = new EmbedBuilder() .setColor('#00FFFF') @@ -244,26 +276,137 @@ const Embed = new EmbedBuilder() { name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true }, ) bot?.discord?.Message?.reply({ embeds: [Embed] }) - - }else if (!bot.options.Core.enabled) { + bot?.discord?.Message.react('♋') + }*/ else if (bot.options.useChat) { - const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length - - - bot.chat('Commands (' + JSON.stringify(length) + ') (&bPublic &f| &5Trusted &f| &4Owner&f)') - await sleep(3000) + const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length + bot.chat('&8Commands &3(&6' + JSON.stringify(length) + '&3) (&bPublic &f| &5Trusted &f| &4Owner&f)') + await bot.chatDelay(100) bot.chat(`${pub_lick}`) - await sleep(3000) + await bot.chatDelay(100) bot.chat(`${t_rust}`) - await sleep(3000) + await bot.chatDelay(100) bot.chat(`${own_her}`) }else { const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length - source.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length), ') ', category, ...pub_lick, t_rust ,own_her], false) - } +/* +bot.sendFeedback([ + 'Commands (', +{text:`${JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3 && c.trustLevel != -1).length)}`,color:'gold'}, ') ', +category, +...pub_lick, + t_rust +,own_her], +false)*/ +bot.sendFeedback([ + { text:'Commands ',color:'dark_gray'}, + { text:'(',color:'dark_blue'}, + { text:`${JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3 && c.trustLevel != -1).length)}`,color:'gold'}, + { text:') ',color:'dark_blue'}, + category, + ...pub_lick, + t_rust, + own_her, +]) + + } } +}, +discordExecute(context){ +const bot = context.bot +const args = context.arguments +const message = args.join(' ') +const CommandManager = bot.commandManager + if (args[0]) { + let valid + for (const commands in bot.commandManager.commandlist) { // i broke a key woops + const command = bot.commandManager.commandlist[commands] + + if (args[0].toLowerCase() === command.name) { + valid = true + /* const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle('help Command') + .setDescription(`help \u203a ${command.name}`) + .addFields( + { name: '', value:`` }, + ) + bot?.discord?.Message?.reply({embeds: [Embed]}) + bot?.discord?.Message.react('♋')*/ +const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`${command.name} info`) + .addFields( + // { name: '', value: `${bot.Discord.commandPrefix + command.name}` } + {name: `${bot.Discord.commandPrefix}${command.name} (Aliases: ${command.aliases}) \u203a ${command.description}`, value: `\u200b`,inline:false}, + { name: `Trust Level \u203a ${command.trustLevel}`,value:'\u200b'}, + { name: `Usage \u203a ${bot.Discord.commandPrefix}${command.name} ${command.usage}`,value:'\u200b'}, + ) +bot?.discord?.Message?.reply({embeds: [Embed]}) +bot?.discord?.Message.react('♋') + + + break + } else valid = false + } + //source is defined btw + //source.sendFeedback([cmd, 'This command is ' + valid + ' to this for loop']) + if (valid) { + + } else { + const args = context.arguments + +throw new CommandError(`Unknown command ${args[0]}. type "${bot.Discord.commandPrefix}" for help`) + + } + const length = context.bot.commandManager.commandlist.length // ok + + //context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...commandList], false) + } else { + let pub_lick = [] + let t_rust = [] + let own_her = [] + for (const commands in bot.commandManager.commandlist) { + const command = bot.commandManager.commandlist[commands] + + + // } + + if (command.trustLevel === 2) { + own_her.push( + { + text: command.name + ' ', + }) + } + else if (command.trustLevel === 1){ + t_rust.push( + { + text: command.name + ' ', + }) + } + else if (command.trustLevel === 0){ + pub_lick.push( + { + text: command.name + ' ', + }) + } } + + const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`${bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString()}`) + .addFields( + { name: 'Public', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`, inline: false }, + { name: 'Trusted', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: false }, + { name: 'Owner', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`,inline: false }, + ) + bot?.discord?.Message?.reply({embeds: [Embed]}) + bot?.discord?.Message.react('♋') + } } +} diff --git a/src/commands/info.js b/src/commands/info.js index 397a4ea..b17bd05 100644 --- a/src/commands/info.js +++ b/src/commands/info.js @@ -1,33 +1,13 @@ const CommandError = require("../CommandModules/command_error"); const path = require("path"); const fs = require("fs"); -const packageJSON = require("../package.json"); +const packageJSON = require("../../package.json"); const os = require('os'); const date = new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", }); -module.exports = { - name: "info", - description: [ - "check the bots info", - ], - aliases: ["information"], - trustLevel: 0, -usage:[ -"version", -"invite", -"server", -"packages", -"login", -"config", -"uptime", -"contributors", -], - async execute(context) { - const bot = context.bot; - const args = context.arguments; - const source = context.source - function format(seconds) { +const { EmbedBuilder } = require('discord.js') +function format(seconds) { function pad(s) { return (s < 10 ? "0" : "") + s; } @@ -38,77 +18,272 @@ usage:[ pad(`${minutes} Minutes`) + " " + pad(`${seconds} Seconds`)) } +module.exports = { + name: "info", + description: [ + "check the bots info", + ], + aliases: ["information"], + trustLevel: 0, + usage:[ + "version", + "invites", + "server", + "packages", + "login", + "config", + "uptime", + "contributors", + ], + async execute(context) { + const bot = context.bot; + const args = context.arguments; + const source = context.source switch(args.join(' ').toLowerCase()) { case 'version': - source.sendFeedback({text:`${process.env.buildstring}`}) - source.sendFeedback({text:`${process.env.FoundationBuildString}`}) - source.sendFeedback({text:`11/22/2022 - ${date}`}) + if (bot.options.useChat) { + bot.chat(`${bot.getMessageAsPrismarine({text:`${process.env.buildstring}`})?.toMotd().replaceAll('§',"&")}`) + await bot.chatDelay(100) + bot.sendFeedback({text:`${process.env.FoundationBuildString}`}) + await bot.chatDelay(100) + bot.sendFeedback({text:`11/22/2022 - ${date}`}) + } else { + bot.sendFeedback({text:`${process.env.buildstring}`}) + bot.sendFeedback({text:`${process.env.FoundationBuildString}`}) + bot.sendFeedback({text:`11/22/2022 - ${date}`}) + } break case 'invites': - source.sendFeedback({ text: 'Discord Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, }); - source.sendFeedback({ text: 'Matrix Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.matrix.invite}`, }, }); + bot.sendFeedback({ text: 'Discord Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, }); + bot.sendFeedback({ text: 'Matrix Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.matrix.invite}`, }, }); break case 'server': - source.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, }); - source.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, }); - source.sendFeedback({ color: "dark_gray", text: `${os.arch()}`}) - source.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`}) - source.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, }); - source.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, }); - source.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, }); - source.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, }); - source.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]); - source.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'}) - source.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'}) + if (bot.options.useChat) { + bot.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, }) + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, }); + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `${os.arch()}`}) + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`}) + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, }); + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, }); + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, }); + await bot.chatDelay(100) + bot.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, }); + await bot.chatDelay(100) + bot.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]); + await bot.chatDelay(100) + bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'}) + await bot.chatDelay(100) + bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'}) + } else { + bot.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, }); + bot.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, }); + bot.sendFeedback({ color: "dark_gray", text: `${os.arch()}`}) + bot.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`}) + bot.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, }); + bot.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, }); + bot.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, }); + bot.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, }); + bot.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]); + bot.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'}) + bot.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'}) + } break - case 'packages': + case 'loaded': + let src = fs.readdirSync('./src/').filter(f => path.extname(f).toLowerCase() === '.js').length; + let util = fs.readdirSync('./src/util/').filter(f => path.extname(f).toLowerCase() === '.js').length; + let utilJSON = fs.readdirSync('./src/util/').filter(f => path.extname(f).toLowerCase() === '.json').length; + let language = fs.readdirSync('./src/util/language').filter(f => path.extname(f).toLowerCase() === '.json').length; + let music = fs.readdirSync('./src/util/music').filter(f => path.extname(f).toLowerCase() === '.js').length; + let convertor = fs.readdirSync('./src/util/music/midi_converter').filter(f => path.extname(f).toLowerCase() === '.js').length; + let convertorJSON = fs.readdirSync('./src/util/music/midi_converter').filter(f => path.extname(f).toLowerCase() === '.json').length + let modules = fs.readdirSync('./src/modules').filter(f => path.extname(f).toLowerCase() === '.js').length; + let commands = fs.readdirSync('./src/commands').filter(f => path.extname(f).toLowerCase() === '.js').length; + let chat = fs.readdirSync('./src/chat').filter(f => path.extname(f).toLowerCase() === '.js').length; + let CommandModules = fs.readdirSync('./src/CommandModules').filter(f => path.extname(f).toLowerCase() === '.js').length; + let FileCount = `${src + util + utilJSON + language + music + convertor + convertorJSON + modules + commands + chat + CommandModules}` + + + // lazy file count :shrug: // source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) - source.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}]) - source.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) -break + if (bot.options.useChat) { + bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) + } else { +// bot.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}]) + bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) + bot.sendFeedback([{text:'File count ',color:'dark_gray'},{text:'(',color:'dark_blue'},{text:`${FileCount}`,color:'gold'},{text:')',color:'dark_blue'}]) + } +break case 'login': - source.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'}) - source.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'}) -if(bot.discord === undefined){ -source.sendFeedback({text:'Currently not logged into discord',color:'dark_red'}) +if (bot.options.useChat) { + bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'}) + await bot.chatDelay(150) + bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'}) + await bot.chatDelay(150) +/*if(bot.discord === undefined){ +bot.sendFeedback({text:'Currently not logged into discord',color:'dark_red'}) +await bot.chatDelay(150) }else{ -source.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'}) +bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'}) +await bot.chatDelay(150) +} */ +await bot.chatDelay(150) +/*if (bot.matrix.client === undefined){ + bot.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'}) + }else{ + bot.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'}) + }*/ + await bot.chatDelay(150) + bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'}) + await bot.chatDelay(150) + bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'}) + await bot.chatDelay(150) + source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'}) +} else { + bot.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'}) + bot.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'}) +if(bot.discord === undefined){ +bot.sendFeedback({text:'Currently not logged into discord',color:'dark_red'}) +}else{ +bot.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'}) } if (bot.matrix.client === undefined){ - source.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'}) + bot.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'}) }else{ - source.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'}) + bot.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'}) } - source.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'}) - source.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'}) - source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'}) + bot.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'}) + bot.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'}) + bot.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'}) + bot.sendFeedback({text:`Discord channel \u203a ${bot.discord.channel.name}`,color:'dark_gray'}) + } break case 'config': - source.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'}) - source.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}]) - source.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}]) - source.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}]) - source.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}]) - source.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}]) - source.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}]) + if (bot.options.useChat) { + bot.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'}) + await bot.chatDelay(100) + bot.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}]) + await bot.chatDelay(100) + //bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}]) + await bot.chatDelay(100) + //bot.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}]) + await bot.chatDelay(100) + bot.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}]) + await bot.chatDelay(100) + bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}]) + await bot.chatDelay(100) + bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}]) + } else { + bot.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'}) + bot.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}]) + bot.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}]) + bot.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}]) + bot.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}]) + bot.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}]) + bot.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}]) + } break case 'uptime': - source.sendFeedback([{text:`${format(process.uptime())}`,color:'dark_gray'}]) + bot.sendFeedback([{text:`${format(process.uptime())}`,color:'dark_gray'}]) break case 'contributors': - source.sendFeedback({ translate: "%s%s", with: [ { color: "dark_red", text: "Parker" }, { color: "black", text: "2991" }, ], hoverEvent: { action: "show_text", value: [ { text: "FNF", color: "dark_purple", bold: true, }, { text: "Boyfriend", color: "aqua", bold: true, }, { text: "Bot ", color: "dark_red", bold: true, }, { text: "Discord", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `${bot.Discord.invite}`, }, }); - source.sendFeedback({ text: "_ChipMC_", color: "dark_green", translate: "", hoverEvent: { action: "show_text", value: [ { text: "chipmunk dot land", color: "green", }, ], }, clickEvent: { action: "open_url", value: `https://chipmunk.land`, }, }); - source.sendFeedback({ text: "chayapak", color: "yellow", translate: "", hoverEvent: { action: "show_text", value: [ { text: "Chomens ", color: "yellow", }, { text: "Discord (dead)", color: "blue", }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/xdgCkUyaA4`, }, }); - source.sendFeedback({ text: "_yfd", color: "light_purple", translate: "", hoverEvent: { action: "show_text", value: [ { text: "ABot ", color: "gold", bold: true, }, { text: "Discord (gone)", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/CRfP2ZbG8T`, }, }); - source.sendFeedback({ text: "aaa", color: "gold" }); +if (bot.options.useChat) { +bot.chat('&4Parker&02991') +await bot.chatDelay(100) +bot.chat('&a_ChipMC_') +await bot.chatDelay(100) +bot.chat('&eChayapak') +await bot.chatDelay(100) +bot.chat(bot.getMessageAsPrismarine({ text: "_yfd", color: "light_purple"})?.toMotd().replaceAll('§','&')) +await bot.chatDelay(100) +bot.chat('&6aaa') +await bot.chatDelay(100) +bot.chat('&aMorganAnkan') +await bot.chatDelay(100) +bot.chat('&2TurtleKid') +} else { + bot.sendFeedback({ translate: "%s%s", with: [ { color: "dark_red", text: "Parker" }, { color: "black", text: "2991" }, ], hoverEvent: { action: "show_text", value: [ { text: "FNF", color: "dark_purple", bold: true, }, { text: "Boyfriend", color: "aqua", bold: true, }, { text: "Bot ", color: "dark_red", bold: true, }, { text: "Discord", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `${bot.Discord.invite}`, }, }); + bot.sendFeedback({ text: "_ChipMC_", color: "dark_green", translate: "", hoverEvent: { action: "show_text", value: [ { text: "chipmunk dot land", color: "green", }, ], }, clickEvent: { action: "open_url", value: `https://chipmunk.land`, }, }); + bot.sendFeedback({ text: "chayapak", color: "yellow", translate: "", hoverEvent: { action: "show_text", value: [ { text: "Chomens ", color: "yellow", }, { text: "Discord (dead)", color: "blue", }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/xdgCkUyaA4`, }, }); + bot.sendFeedback({ text: "_yfd", color: "light_purple", translate: "", hoverEvent: { action: "show_text", value: [ { text: "ABot ", color: "gold", bold: true, }, { text: "Discord (gone)", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/CRfP2ZbG8T`, }, }); + bot.sendFeedback({ text: "aaa", color: "gold" }); + bot.sendFeedback({text:"MorganAnkan",color:"dark_green"}) + bot.sendFeedback({text:"TurtleKid",color:'green'}) +} break case 'thankyou': var prefix = "&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r "; bot.core.run( "bcraw " + prefix + "Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!",) break default: -source.sendError({text:'Invalid Argument!!'}) +bot.sendError({text:'Invalid Argument!!'}) } - } + }, +discordExecute(context) { +const bot = context.bot +const source = context.source +const args = context.arguments +switch(args.join(' ').toLowerCase()) { +/* +const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`${bot.getMessageAsPrismarine({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }) })?.toString()}`) + bot.discord.Message.reply({embeds: [Embed]}) +*/ +case 'version': +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription('\u200b') + .addFields( + {name:`${process.env.buildstring}`,value:'\u200b'}, + {name:`${process.env.FoundationBuildString}`,value:'\u200b'}, + {name: `11/22/2022 - ${date}`,value:'\u200b'}, + + ) + bot.discord.Message.reply({embeds: [Embed]}) +break +case 'invites': +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription('\u200b') + .addFields( + {name:`${bot.Discord.invite}`,value:'\u200b'}, + {name:`${bot.matrix.invite}`,value:'\u200b'}, + ) + bot.discord.Message.reply({embeds: [Embed]}) +break +case 'server': +bot.discord.Message.reply(`Hostname \u203a ${os.hostname()}\nWorking Directory \u203a ${process.mainModule.path}\nOS \u203a ${os.platform()}\nKernal Version \u203a ${os.release()}\ncores \u203a ${os.cpus().length}\nCPU \u203a ${os.cpus()[0].model}\nServer Free memory ${Math.floor( os.freemem() / 1048576 )} MiB / ${Math.floor(os.totalmem() / 1048576)} MiB\nDevice uptime \u203a ${format(os.uptime())}\nNode version \u203a ${process.version}`) + + +break +case 'packages': +let packages = Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ') +var Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription('\u200b') + .addFields( + {name:`Packages \u203a ${JSON.stringify(packages)}`,value:'\u200b'}, + {name:`Package Count \u203a ${Object.keys(packageJSON.dependencies).length}`,value:'\u200b'}, + ) + bot.discord.Message.reply({embeds: [Embed]}) +break +/* + case 'packages': +// source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) + bot.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}]) + bot.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}]) +*/ + } + } } diff --git a/src/commands/kick.js b/src/commands/kick.js index 74ac875..b4a8910 100644 --- a/src/commands/kick.js +++ b/src/commands/kick.js @@ -1,42 +1,51 @@ const CommandError = require('../CommandModules/command_error') -let timer = null +const timer = null module.exports = { name: 'kick', - description:['kicks a player'], -usage:["re fucking doing"], - trustLevel: 1, - aliases:[], - execute(context) { - // throw new CommandError('temp disabled') - //throw new CommandError('command temporarily disabled until hashing is implemented') + description: ['kicks a player'], + + trustLevel: 1, + aliases: [], + usage: ['sussy ', 'invalidstring '], + execute (context) { + // throw new CommandError('temp disabled') + // throw new CommandError('command temporarily disabled until hashing is implemented') const args = context.arguments -if (!args && !args[0] && !args[1]) return - if (args[2] === 'clear' || args[2] === 'stop') { - clearInterval(this.timer) - this.timer = null + const bot = context.bot + if (!args && !args[0] && !args[1] && !args[2]) return + switch (args[1]) { + case 'sussy': + if (args[2] === 'clear' || args[2] === 'stop') { + clearInterval(this.timer) + this.timer = null - context.source.sendFeedback('Cloop Stopped', false) - return + bot.sendFeedback('Cloop Stopped', false) + return + } + + // if (this.timer !== null) throw new CommandError('The bot can currently only loop one command') + // anti fard + + const target = context.player// let me hashonly it rq + this.timer = setInterval(function () { // Wait, is this command public? + repeat(context.bot, 400, `tellraw ${args[2]} {"text":"${'ඞ'.repeat(20000)}","bold":true,"italic":true,"obfuscated":true,"color":"#FF0000"}`) + }, 10) + + // i found that there is a limit + + // Repeat the command over and over. + function repeat (bot, repetitions, cmd) { + for (let i = 0; i < repetitions; i++) { + bot.core.run(cmd) + } + } + break + case 'invalidstring': + bot.core.run(`minecraft:tellraw ${args[2]} ${process.env.invalidstring}`) + break } - - - // if (this.timer !== null) throw new CommandError('The bot can currently only loop one command') - // anti fard - - const target = context.player//let me hashonly it rq - this.timer = setInterval(function() { // Wait, is this command public? - repeat(context.bot, 400, `tellraw ${args[1]} {"text":"${'ඞ'.repeat(20000)}","bold":true,"italic":true,"obfuscated":true,"color":"#FF0000"}`) - - }, 10) - } -}//i found that there is a limit - -// Repeat the command over and over. -function repeat(bot, repetitions, cmd) { - for (let i = 0; i < repetitions; i++) { - bot.core.run(cmd) } } diff --git a/src/commands/list.js b/src/commands/list.js index f928c75..98a3ca1 100644 --- a/src/commands/list.js +++ b/src/commands/list.js @@ -1,5 +1,5 @@ const CommandError = require('../CommandModules/command_error') - +const { EmbedBuilder } = require('discord.js') module.exports = { name: 'list', description:['check the player list'], @@ -16,26 +16,20 @@ const source = context.source if (args.length !== 0){ throw new CommandError({translate:"Too many Arguments!", color:"red"}) } -/* -if (amonger2.length === 0) { - const list = []; - for (const host of bots) { - if (list.length !== 0) { - list.push(host.name); - } - } - } -*/ + for (const player of players) { component.push({ - translate: `%s \u203a %s [%s] %s`, + translate: `%s \u203a %s [%s %s %s %s %s]`, with: [ player.displayName ?? player.profile.name, player.uuid, - {text: `Ping: ${player.latency}`, color:'green'}, - player.gamemode + {text:`Ping:`,color:'dark_green'}, + {text:`${player.latency}`,color:'gold'}, + {text:'/',color:'dark_gray'}, + {text:`Gamemode:`, color:'dark_purple'}, + {text:`${player.gamemode}`,color:'gold'}, ] }) @@ -49,13 +43,15 @@ function sleep(ms) { /* for (const player of players) { component.push({ - translate: '%s \u203a %s [%s] %s', + translate: '%s \u203a %s [%s %s %s]', with: [ player.displayName ?? player.profile.name, player.uuid, - {text: `Ping: ${player.latency}`, color:'green'}, - player.gamemode + {text: `Ping: ${player.latency}`,color:'dark_green'}, + {text:'/',color:'dark_gray'}, + {text:`Gamemode: ${player.gamemode}`, color:'dark_purple'}, + ] }) @@ -78,12 +74,63 @@ for (const player of players){ //const players = bot.players -source.sendFeedback({text:`Players: (${JSON.stringify(bot.players.length)})`}) - source.sendFeedback(component, false) +bot.tellraw([{text:`Players: `,color:'dark_gray',},{text:'(',color:'blue'},{text:`${JSON.stringify(bot.players.length)}`,color:'gold'},{text:')',color:'blue'}]) + bot.tellraw(component) } +}, +discordExecute(context) { +const bot = context.bot +const players = bot.players +/* +const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle('help Command') + .setDescription(`help \u203a ${command.name}`) + .addFields( + { name: '', value:`` }, + ) + bot?.discord?.Message?.reply({embeds: [Embed]}) + bot?.discord?.Message.react('♋') + for (const player of players) { + component.push({ + translate: '%s \u203a %s [%s %s %s]', + with: [ + + player.displayName ?? player.profile.name, + player.uuid, + {text: `Ping: ${player.latency}`,color:'dark_green'}, + {text:'/',color:'dark_gray'}, + {text:`Gamemode: ${player.gamemode}`, color:'dark_purple'}, + + ] + }) + +*/ + const component = [] +for (const player of players) { + component.push({ + translate: '%s \u203a %s [%s %s %s]', + with: [ + + player.displayName ?? player.profile.name, + player.uuid, + {text: `Ping: ${player.latency}`,color:'dark_green'}, + {text:'/',color:'dark_gray'}, + {text:`Gamemode: ${player.gamemode}`, color:'dark_purple'}, + + ] + }) + + component.push('\n') + } +const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`${bot.getMessageAsPrismarine(`Players: (` + bot.players.length + ')')?.toString()}` + `${bot.getMessageAsPrismarine('\n')?.toString()}` + `${bot.getMessageAsPrismarine(component)?.toString()}`) + bot.discord.Message.reply({embeds: [Embed]}) } } //what is wi -// IDK +// IDK \ No newline at end of file diff --git a/src/commands/memusage.js b/src/commands/memusage.js index a98fa4c..5a75244 100644 --- a/src/commands/memusage.js +++ b/src/commands/memusage.js @@ -19,11 +19,11 @@ usage:[ case 'on': bot.memusage.on() - source.sendFeedback({text: 'Memusage is now enabled', color:'green'}) + bot.sendFeedback({text: 'Memusage is now enabled', color:'green'}) break case 'off': bot.memusage.off() - / source.sendFeedback({text:'Memusage is now disabled', color:'red'}) + bot.sendFeedback({text:'Memusage is now disabled', color:'red'}) break default: diff --git a/src/commands/music.js b/src/commands/music.js index 1a3fbd7..7064f28 100644 --- a/src/commands/music.js +++ b/src/commands/music.js @@ -1,4 +1,3 @@ -/* eslint-disable no-case-declarations */ const CommandError = require('../CommandModules/command_error') const fs = require('fs/promises') const { EmbedBuilder } = require('discord.js') @@ -11,15 +10,11 @@ const os = require('os') let SONGS_PATH -if (os.hostname() === ':3') { - SONGS_PATH = path.join(__dirname, '..', '..', 'nginx-html', 'midis') -} else { - SONGS_PATH = path.join(__dirname, '..', 'midis') -} + + SONGS_PATH = path.join(__dirname, '../../', 'midis') let song - -async function play (bot, values, discord, channeldc, selector, config) { +async function play (bot, values, selector, config) { try { const filepath = values.join(' ') @@ -36,7 +31,7 @@ async function play (bot, values, discord, channeldc, selector, config) { ) ) - // this part took a bunch of time to figure out, but still chomens moment!1! + const lowerCaseFile = pathSplitted.pop().toLowerCase() const file = songs.filter((song) => song.toLowerCase().includes(lowerCaseFile))[0] @@ -50,7 +45,7 @@ async function play (bot, values, discord, channeldc, selector, config) { song = await bot.music.load(await fs.readFile(absolutePath), path.basename(absolutePath)) - bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }]) + bot.sendFeedback([{ text: 'Added ', color: 'dark_gray' }, { text: song.name, color: '#00FFFF' }, { text: ' to the song queue', color: 'dark_gray' }]) bot.music.queue.push(song) @@ -58,16 +53,16 @@ async function play (bot, values, discord, channeldc, selector, config) { } catch (e) { bot.console.error(e.stack) - bot.tellraw({ text: 'SyntaxError: Invalid file', color: 'red' }) + bot.sendFeedback({ text: 'SyntaxError: Invalid file', color: 'red' }) } } -async function playUrl (bot, values, discord, channeldc, selector, config) { +async function playUrl (bot, values, selector, config) { let response try { const url = values.join(' ') - response = await axios.get('https://localhost:8080', { + response = await axios.get('http://localhost:8080', { params: { uri: url }, @@ -75,7 +70,7 @@ async function playUrl (bot, values, discord, channeldc, selector, config) { }) song = await bot.music.load(response.data, getFilenameFromUrl(url)) - bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }]) + bot.sendFeedback([{ text: 'Added ', color: 'dark_gray' }, { text: song.name, color: '#00FFFF' }, { text: ' to the song queue', color: 'dark_gray' }]) bot.music.queue.push(song) @@ -83,7 +78,7 @@ async function playUrl (bot, values, discord, channeldc, selector, config) { } catch (_err) { const e = _err.toString().includes('Bad MIDI file. Expected \'MHdr\', got: ') ? response.data.toString() : _err - bot.tellraw({ text: e, color: 'red' }) + bot.sendFeedback({ text: e, color: 'red' }) } } @@ -111,7 +106,7 @@ async function list (bot, discord, channeldc, prefix, selector, args, config) { const isFile = (await fs.lstat(path.join(absolutePath, value))).isFile() message.push({ text: value + ' ', - color: (!((primary = !primary)) ? 'gold' : 'yellow'), + color: (!((primary = !primary)) ? 'aqua' : 'blue'), clickEvent: { action: 'suggest_command', value: `${prefix}music ${isFile ? 'play' : 'list'} ${path.join(args.slice(1).join(' '), value)}` @@ -119,23 +114,22 @@ async function list (bot, discord, channeldc, prefix, selector, args, config) { hoverEvent: { action: 'show_text', contents: [ - { text: 'Name: ', color: 'white' }, - { text: value, color: 'gold' }, + { text: 'Name: ', color: 'dark_gray' }, + { text: value, color: '#00FFFF' }, '\n', { text: 'Click here to suggest the command!', color: 'green' } ] } }) }; - - bot.tellraw(message) + bot.sendFeedback([{ text: 'Songs ', color: 'dark_gray' },{ text: '(', color:'dark_blue' },{text: `${Object.keys(listed).length}`, color: 'gold' },{ text: ')', color: 'dark_blue' }]) + bot.sendFeedback(message) } catch (e) { - bot.tellraw({ text: e.toString(), color: 'red' }) - } + bot.sendFeedback({ text: e.toString(), color: 'red' }) + } }; - module.exports = { name: 'music', description: 'Plays music', @@ -153,8 +147,7 @@ module.exports = { execute (context, selector, config) { const args = context.arguments const bot = context.bot -const prefix = bot.options.commands.prefixes[0] -if (!bot.options.Core.enabled) throw new CommandError({text:':3'}) +const prefix = bot.Commands.prefixes[0] if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return switch (args[0]) { case 'play': @@ -167,24 +160,35 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return } break case 'stop': - bot.tellraw({ text: 'Cleared the song queue' }) + bot.sendFeedback({ text: 'Cleared the song queue', color: 'dark_gray' }) bot.music.stop() break case 'skip': try { - bot.tellraw([{ text: 'Skipping ' }, { text: bot.music.song.name, color: 'gold' }]) + bot.sendFeedback([{ text: 'Skipping ', color: 'dark_gray' }, { text: bot.music.song.name, color: '#00FFFF' }]) bot.music.skip() } catch (e) { throw new CommandError('No music is currently playing!') } break + case 'volume': + if (isNaN(args.slice(1))) { + throw new CommandError('Argument is not a number') + } else if(args.slice(1) >= 6) { + throw new CommandError('Too high!') + } else { + bot.music.volume = args.slice(1) + bot.sendFeedback([{ text: 'Setting music volume to ', color: 'dark_gray'},{ text: `${bot.music.volume}`, color: 'gold'}]) + } + break case 'loop': switch (args[1]) { case 'off': bot.music.loop = 0 - bot.tellraw([ + bot.sendFeedback([ { - text: 'Looping is now ' + text: 'Looping is now ', + color: 'dark_gray', }, { text: 'disabled', @@ -194,20 +198,22 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return break case 'current': bot.music.loop = 1 - bot.tellraw([ + bot.sendFeedback([ { - text: 'Now Looping ' + text: 'Now Looping ', + color: 'dark_gray' }, { text: song.name, - color: 'gold' + color: '#00FFFF' } ]) break case 'all': bot.music.loop = 2 - bot.tellraw({ - text: 'Now looping every song' + bot.sendFeedback({ + text: 'Now looping every song', + }) break default: @@ -218,27 +224,28 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return list(bot, false, null, prefix, selector, args, config) break case 'nowplaying': - bot.tellraw([ + bot.sendFeedback([ { - text: 'Now playing ' + text: 'Now playing ', + color: 'dark_gray', }, { text: bot.music.song.name, - color: 'gold' + color: '#00FFFF' } ]) break case 'queue': const queueWithName = [] for (const song of bot.music.queue) queueWithName.push(song.name) - bot.tellraw([ + bot.sendFeedback([ { text: 'Queue: ', - color: 'green' + color: 'dark_gray' }, { text: queueWithName.join(', '), - color: 'aqua' + color: '#00FFFF' } ]) break @@ -246,4 +253,4 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return throw new CommandError('Invalid argument') } } -} +} diff --git a/src/commands/netmsg.js b/src/commands/netmsg.js index a1aa64d..75ad705 100644 --- a/src/commands/netmsg.js +++ b/src/commands/netmsg.js @@ -43,7 +43,7 @@ module.exports = { ]//command.split(' ')[0] }//string.replace() if (!message[0]) { - context.source.sendFeedback({text:'Message is empty', color:'red'}, false) + bot.sendFeedback({text:'Message is empty', color:'red'}, false) } else { for (const eachBot of bot.bots) if(!bot.options.Core.enabled){ diff --git a/src/commands/playerinfo.js b/src/commands/playerinfo.js new file mode 100644 index 0000000..dd2f539 --- /dev/null +++ b/src/commands/playerinfo.js @@ -0,0 +1,39 @@ +const CommandError = require('../CommandModules/command_error') +const util = require('util') +const { stylize } = require('../util/eval_colors') +module.exports = { + name: 'playerinfo', + description:[''], + aliases:[], + trustLevel: 0, +usage:[ +"", +], + execute (context) { + const bot = context.bot + const args = context.arguments + const source = context.source +try{ + //const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`) +const player = bot.players.find(player => player.profile.name === `${args.join(' ')}`) +//bot.players.map(pl => pl.profile.name).filter((name) => name == "Ski") +if(player === undefined) { + +bot.tellraw('Unknown Player') +}else{ + bot.sendFeedback([{text:`Player Name: `,color:'dark_gray'},{text:`${player.profile.name}`}]) + bot.sendFeedback([{text:`Player UUID: `,color:'dark_gray'},{text:`${player.uuid}`,color:'gold'}]) + bot.sendFeedback([{text:`Player Gamemode: `,color:'dark_gray'},{text:`${player.gamemode}`,color:'gold'}]) + bot.sendFeedback([{text:`Player Latency: `,color:'dark_gray'},{text:`${player.latency}`,color:'gold'}]) + bot.sendFeedback([{text:`Player DisplayName: `,color:'dark_gray'},{text:`${bot.getMessageAsPrismarine(player.displayName ?? player.profile.name)?.toMotd().replaceAll('§','§')}`}]) + } +}catch(e){ +bot.tellraw(`${e}`) + }//bot.players.find(player => player.profile.name === `Ski`); bot.getMessageAsPrismarine(e.displayName)?.toMotd().replaceAll('§','§') +}, +discordExecute(context) { + const bot = context.bot + const args = context.arguments + const source = context.source + } +} diff --git a/src/commands/rc.js b/src/commands/rc.js index ccc5392..70a9ec6 100644 --- a/src/commands/rc.js +++ b/src/commands/rc.js @@ -13,7 +13,7 @@ if (!bot.options.Core.enabled){ }else { bot.core.refill() - context.source.sendFeedback('Successfully Refilled Core!') + bot.sendFeedback('Successfully Refilled Core!') } } } diff --git a/src/commands/reconnect.js b/src/commands/reconnect.js index eb21890..b454215 100644 --- a/src/commands/reconnect.js +++ b/src/commands/reconnect.js @@ -10,7 +10,7 @@ usage:[""], const message = context.arguments.join(' ') const args = context.arguments const source = context.source -context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'}) +bot.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'}) bot._client.end() diff --git a/src/commands/reload.js b/src/commands/reload.js index e4b0aa9..ada4633 100644 --- a/src/commands/reload.js +++ b/src/commands/reload.js @@ -1,6 +1,8 @@ +const { EmbedBuilder } = require('discord.js') +const CommandError = require('../CommandModules/command_error') module.exports = { name: 'reload', - description:[], + description:['Reload the bots files'], aliases:[], trustLevel: 0, usage:["reload"], @@ -9,11 +11,26 @@ usage:["reload"], const args = context.arguments const source = context.source try { -source.sendFeedback({text:'Reloading commands,..........'}); +bot.sendFeedback({text:'Reloading crap'}); for (const eachBot of bot.bots) eachBot.reload() }catch(e){ -source.sendFeedback(e.stack) +bot.sendFeedback(e.stack) +} +}, +discordExecute(context) { +const bot = context.bot +const source = context.source +try { +const Embed = new EmbedBuilder() + .setColor('#00FFFF') + .setTitle(`${this.name} Command`) + .setDescription(`reloading commands`) + bot.discord.Message.reply({embeds: [Embed]}) +for (const eachBot of bot.bots) +eachBot.reload() +}catch(e) { +throw new CommandError(e.stack) } } } diff --git a/src/commands/sctoggle.js b/src/commands/sctoggle.js index 62df3c7..c0f1744 100644 --- a/src/commands/sctoggle.js +++ b/src/commands/sctoggle.js @@ -14,12 +14,12 @@ const args = context.arguments switch (args[1]) { case 'vanish': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.vanished = false bot.command('essentials:vanish off') return }else if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.vanished = true bot.command('essentials:vanish on') return @@ -30,12 +30,12 @@ return break case 'mute': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.unmuted = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.unmuted = true return @@ -46,12 +46,12 @@ return break case 'prefix': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'Prefix selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Prefix selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.prefix = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'Prefix selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'Prefix selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.prefix = true return } @@ -63,12 +63,12 @@ return break case 'cspy': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'cspy selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'cspy selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.cspy = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'cspy selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'cspy selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.cspy = true return } @@ -79,12 +79,12 @@ return break case 'tptoggle': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'Tptoggle selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Tptoggle selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.tptoggle = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'Tptoggle selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'Tptoggle selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.tptoggle = true return } @@ -96,12 +96,12 @@ return break case 'skin': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'Skin selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'Skin selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.skin.enabled = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'Skin selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'Skin selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.skin.enabled = true return } @@ -113,12 +113,12 @@ return break case 'gmc': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'gmc selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'gmc selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.gmc = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'gmc selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'gmc selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.gmc = true return } @@ -130,12 +130,12 @@ return break case 'op': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'op selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'op selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.op = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'op selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'op selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.op = true return } @@ -147,12 +147,12 @@ return break case 'nickname': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'nickname selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'nickname selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.nickname = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'nickname selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'nickname selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.nickname = true return } @@ -164,12 +164,12 @@ return break case 'username': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'username selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'username selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.username = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'username selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'username selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.username = true return } @@ -181,12 +181,12 @@ return break case 'god': if (args[2] === 'false' || args[2] === 'off'){ -source.sendFeedback([{text:'god selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) +bot.sendFeedback([{text:'god selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}]) bot.options.selfcare.god = false return } if (args[2] === 'true' || args[2] === 'on'){ -source.sendFeedback([{text:'god selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) +bot.sendFeedback([{text:'god selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}]) bot.options.selfcare.god = true return } @@ -197,8 +197,8 @@ return } break default: -source.sendFeedback({text:'Invalid argument!',color:'dark_red'}) -source.sendFeedback({text:'vanish mute prefix cspy skin sctoggle gmc op nickname username god',color:'dark_green'}) +bot.sendFeedback({text:'Invalid argument!',color:'dark_red'}) +bot.sendFeedback({text:'vanish mute prefix cspy skin sctoggle gmc op nickname username god',color:'dark_green'}) } } } diff --git a/src/commands/servereval.js b/src/commands/servereval.js index 5d90242..029fba5 100644 --- a/src/commands/servereval.js +++ b/src/commands/servereval.js @@ -1,57 +1,27 @@ const CommandError = require('../CommandModules/command_error') +const { stylize } = require('../util/eval_colors') +const util = require('util') module.exports = { name: 'servereval', - description:['no'], + description:['run code unisolated'], trustLevel: 2, - aliases:['svreval'], -usage:[""], - async execute (context, arguments, selector) { - const bot = context.bot - // const args = context.arguments.join(' ') -const source = context.source - // throw new CommandError('temp disabled') - const { stylize } = require('../util/eval_colors') - const util = require('util') - const args = context.arguments - const ChatMessage = require('prismarine-chat')(bot.options.version) + aliases:['svreval'], + usage: [''], + execute (context, arguments, selector) { + const bot = context.bot; + const source = context.source; + const args = context.arguments; const script = args.slice(1).join(' '); - //bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&')) - if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return -function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -}//ChatMessage.fromNotch(await sleep(500) ).toMotd().replaceAll('§', '&') -//if - try { - if(source.sources.console){ - bot.console.info({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }).substring(0, 32700) }) - bot.console.info({ text: `Script input: ${script}` }) - } else - if(!bot.options.Core.enabled && !source.sources.console){ - - bot.chat(ChatMessage.fromNotch(await sleep(500) ?? { text: util.inspect(eval( args.slice(1).join(' ')), { stylize }).substring(0, 32700) }).toMotd().replaceAll('§', '&')) - }else { - - //{ text: util.inspect(eval(script), { stylize }).substring(0, 32700) } - source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }) - source.sendFeedback({ text: `Script input: ${script}` }) - } - } catch (err) { - if(!bot.options.Core.enabled && !source.sources.console){ - bot.chat(`&4${err.message}`) - }else if(source.sources.console){ -bot.console.warn({ text: err.message, color: 'red' }) + if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return + try { + if (bot.options.useChat) { + bot.chat(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&')) } else { - source.sendFeedback({ text: err.message, color: 'red' }) - source.sendFeedback({ text: `Script input: ${script}` }) -} -} - } -} - - -/* try { - bot.tellraw({ text: util.inspect(eval(context.arguments.slice().join(' ')), { stylize }).substring(0, 32700) }) - } catch (err) { - bot.tellraw({ text: util.inspect(err).replaceAll('runner', 'runner'), color: 'red' }) - } - */ + bot.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }) + bot.sendFeedback({ text: `Script input: ${script}` }) + } + } catch (err) { + bot.sendFeedback({ text: err.message, color: 'red' }) + } + } + } diff --git a/src/commands/terminal.js b/src/commands/terminal.js new file mode 100644 index 0000000..e47c2ee --- /dev/null +++ b/src/commands/terminal.js @@ -0,0 +1,43 @@ +const CommandError = require('../CommandModules/command_error') +const Docker = require('dockerode') +const stream = require('stream') +const { exec } = require('child_process') +const finalStream = require('final-stream') +module.exports = { + name: 'terminal', // command name here + description: ['run terminal commands in a docker image'], // command desc here + aliases: [], // command aliases here if there is any + trustLevel: 0, // 0 = public, 1 = trusted, 2 = owner, 3 = console + usage: [], // command usage here +async execute (context) { + const bot = context.bot + const args = context.arguments + const source = context.source + var id = null + const docker = new Docker() +if(!args && !args[0] && !args[1] && !args[2] && !args[3]) return + +switch(args[0].toLowerCase()){ + case 'run': +try { +const finalStream = require('final-stream'); + +const stdout = new stream.PassThrough(); + const docker = new Docker({ socketPath: '/var/run/docker.sock' }); + + const container = await docker.run('alpine', ['sh', '-c', `${args.slice(1).join(' ')}`], stdout); + const data = await finalStream(stdout).then(buffer => buffer.toString()); + + bot.tellraw(data); + + +}catch(e) { +bot.sendFeedback({text:`${e.stack}`}) +} + break + case "rebuild": + + break +} + } +} diff --git a/src/commands/theme.js b/src/commands/theme.js index f89fe12..a9103b4 100644 --- a/src/commands/theme.js +++ b/src/commands/theme.js @@ -1,17 +1,25 @@ +const CommandError = require('../CommandModules/command_error'); module.exports = { - name: 'theme', - description:['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], - aliases:[], - trustLevel: 0, -usage:[":3"], + name: 'theme', + description:['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], + aliases:[], + trustLevel: 0, + usage:[":3"], execute (context) { - const bot = context.bot - const message = context.arguments.join(' ') - - if (message.startsWith('/')) { - bot.command(message.substring(1)) - return - } - bot.chat(message) + const bot = context.bot; + const args = context.arguments; + const source = context.source; +if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return + bot.Commands.help.pub_lickColor = args[0] + bot.Commands.help.t_rustedColor = args[1] + bot.Comands.help.own_herColor = args[2] + bot.sendFeedback({text:`Set Help theme colors to ${bot.helpTheme.pub_lickColor} ${bot.helpTheme.t_rustedColor} ${bot.helpTheme.own_herColor}`}) } } +/* +helpTheme:{ +pub_lickColor:"#00FFFF", +t_rustedColor:"dark_purple", +own_herColor:"dark_red", +}, +*/ diff --git a/src/commands/time.js b/src/commands/time.js index 8d44a03..8df55c4 100644 --- a/src/commands/time.js +++ b/src/commands/time.js @@ -21,6 +21,6 @@ const source = context.source 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' }] - source.sendFeedback(component) + bot.sendFeedback(component) } } diff --git a/src/commands/tpr.js b/src/commands/tpr.js index dc660af..a1d77ba 100644 --- a/src/commands/tpr.js +++ b/src/commands/tpr.js @@ -3,24 +3,25 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'tpr', description:['teleport to a random place'], -trustLevel: 0, +trustLevel: 1, aliases:['rtp', 'teleportrandom', 'randomteleport'], usage:[""], - execute (context) { + async execute (context) { const bot = context.bot const sender = context.source.player -const source = context.source + const source = context.source if (!sender) return const x = between(-1_000_000, 1_000_000) const y = 100 const z = between(-1_000_000, 1_000_000) -if (!bot.options.Core.enabled){ - throw new CommandError('Coreless mode is active can not execute command!') -}else{ - source.sendFeedback(`Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `) + if (bot.options.useChat) { + bot.chat(`Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `) + await bot.chatDelay(100) + bot.command(`tp ${sender.uuid} ${x} ${y} ${z}`) + } else { + bot.sendFeedback(`Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `) bot.core.run(`tp ${sender.uuid} ${x} ${y} ${z}`) - } -} + } } diff --git a/src/commands/tps.js b/src/commands/tps.js index 5cbdc39..7263d85 100644 --- a/src/commands/tps.js +++ b/src/commands/tps.js @@ -15,13 +15,13 @@ usage:["on","off"], case 'on': bot.tps.on() - source.sendFeedback({text: 'TPSBar is now enabled', color:'green'}) + bot.sendFeedback({text: 'TPSBar is now enabled', color:'green'}) break case 'off': bot.tps.off() - source.sendFeedback({text:'TPSBar is now disabled', color:'red'}) + bot.sendFeedback({text:'TPSBar is now disabled', color:'red'}) break default: diff --git a/src/commands/translate.js b/src/commands/translate.js index d6c68f3..9e93034 100644 --- a/src/commands/translate.js +++ b/src/commands/translate.js @@ -18,9 +18,9 @@ if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return const agent = new HttpProxyAgent('http://103.152.112.162:80'); const { text } = await translate(`${args.slice(1).join(' ')}`, { to: 'args[0]', - fetchOptions: {agent} +// fetchOptions: {agent} }); -source.sendFeedback([{text:'Result \u203a '},{text:`${text}`,color:'gold'}]) +bot.sendFeedback([{text:'Result \u203a '},{text:`${text}`,color:'gold'}]) }catch(e){ //if (e.name === 'TooManyRequestsError') { // source.sendFeedback({text:'reconnecting proxy'}) diff --git a/src/commands/troll.js b/src/commands/troll.js index 6cf6520..96e145f 100644 --- a/src/commands/troll.js +++ b/src/commands/troll.js @@ -23,7 +23,7 @@ return clearInterval(this.timer) this.timer = undefined - context.source.sendFeedback('Cloop Stopped', false) + bot.sendFeedback('Cloop Stopped', false) return } } diff --git a/src/commands/urban.js b/src/commands/urban.js index 627e218..9510ca9 100644 --- a/src/commands/urban.js +++ b/src/commands/urban.js @@ -56,17 +56,17 @@ bot.chat(ChatMessage.fromNotch(await sleep(2300) for (const definition of definitions) { - source.sendFeedback([cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }]) - source.sendFeedback([cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ]) + bot.sendFeedback([cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }]) + bot.sendFeedback([cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ]) } urban.define(args.join(' ')).then((results) => { - source.sendFeedback([cmd,{text:`Definition: ${results[0].word}`, color:'dark_gray'}]) - source.sendFeedback([cmd,{text:`Author: ${results[0].author}`, color:'dark_gray'}]) + bot.sendFeedback([cmd,{text:`Definition: ${results[0].word}`, color:'dark_gray'}]) + bot.sendFeedback([cmd,{text:`Author: ${results[0].author}`, color:'dark_gray'}]) //source.sendFeedback(results[0].thumbs_down) - source.sendFeedback([cmd,{text:`👍 ${results[0].thumbs_up} | 👎 ${results[0].thumbs_down}`, color:'gray'}]) + bot.sendFeedback([cmd,{text:`👍 ${results[0].thumbs_up} | 👎 ${results[0].thumbs_down}`, color:'gray'}]) //source.sendFeedback(results[0].written_on) @@ -91,7 +91,7 @@ bot.chat(ChatMessage.fromNotch(await sleep(2300) const ChatMessage = require('prismarine-chat')(bot.options.version) bot.chat(ChatMessage.fromNotch([cmd,{ text: e.toString(), color: 'red' }]).toMotd().replaceAll('§', '&')) }else { - source.sendFeedback([cmd,{ text: e.toString(), color: 'red' }]) + bot.sendFeedback([cmd,{ text: e.toString(), color: 'red' }]) } } } diff --git a/src/commands/validate.js b/src/commands/validate.js index de8ae8a..61efcb2 100644 --- a/src/commands/validate.js +++ b/src/commands/validate.js @@ -1,37 +1,36 @@ module.exports = { name: 'validate', - description:['validate in the bot'], + description: ['validate in the bot'], -trustLevel: 1, - aliases:['val'], -usage:["hash"], - execute (context) { - const source = context.source - const bot = context.bot -const hash = bot.hash - const args = context.arguments - const ownerhash = bot.owner - const discordHash = bot.hashing.hash + trustLevel: 1, + aliases: ['val'], + usage: [''], + execute (context) { + const source = context.source + const bot = context.bot + const hash = bot.hash + const args = context.arguments + const ownerhash = bot.owner + const discordHash = bot.hashing.hash if (args[0] === hash) { - if(!bot.options.Core.enabled){ - bot.chat('&aValid Hash') - }else{ - source.sendFeedback({ text: 'Valid Hash', color: 'green' }) - } - }else if (args[0] === ownerhash) { - if(!bot.options.Core.enabled){ - bot.chat('&aValid Owner Hash') - }else{ - source.sendFeedback({text: 'Valid Owner Hash', color:'green'}) - } + if (!bot.options.Core.enabled) { + bot.chat('&aValid Hash') + } else { + bot.sendFeedback([{ text: 'Valid ', color: 'green' }, { text: 'Trusted ', color: 'dark_purple' }, { text: 'Hash', color: 'green' }]) + } + } else if (args[0] === ownerhash) { + if (!bot.options.Core.enabled) { + bot.chat('&aValid Owner Hash') + } else { + bot.sendFeedback([{ text: 'Valid ', color: 'green' }, { text: 'Owner ', color: 'dark_red' }, { text: 'Hash', color: 'green' }]) + } + } else if (discordHash) { + if (!bot.options.Core.enabled) { + bot.chat('&aValid Hash') + } else { + bot.sendFeedback([{ text: 'Valid ', color: 'green' }, { text: 'Trusted ', color: 'dark_purple' }, { text: 'Hash', color: 'green' }]) + } } - else if (discordHash) { - if(!bot.options.Core.enabled){ - bot.chat('&aValid Hash') - }else{ - source.sendFeedback({ text: 'Valid Hash', color: 'green' }) - } - } } } -//if (args[0] === hash) { +// if (args[0] === hash) { diff --git a/src/commands/weather.js b/src/commands/weather.js index a9efc0e..813caf8 100644 --- a/src/commands/weather.js +++ b/src/commands/weather.js @@ -15,19 +15,19 @@ const source = context.source weather.find({degreeType:args[0], search:args.slice(1).join(' ')}, function(err, result){ //"skytext" "feelslike" "humidity" "winddisplay" //{search: args.join(' '), degreeType: 'F'} - source.sendFeedback([{text:`Location: `,color:'gray'},{text:`${result[0].location.name}`,color:'dark_green'}]) + bot.sendFeedback([{text:`Location: `,color:'gray'},{text:`${result[0].location.name}`,color:'dark_green'}]) -source.sendFeedback([{text:`Temperature: `,color:'gray'},{text:`${result[0].current.temperature}${result[0].location.degreetype}`,color:'dark_green'}]) -source.sendFeedback([{text:'Date: ',color:'gray'},{text:result[0].current.date,color:'dark_green'}]) +bot.sendFeedback([{text:`Temperature: `,color:'gray'},{text:`${result[0].current.temperature}${result[0].location.degreetype}`,color:'dark_green'}]) +bot.sendFeedback([{text:'Date: ',color:'gray'},{text:result[0].current.date,color:'dark_green'}]) // console.log(JSON.stringify(result, null, 2)); -source.sendFeedback([{text:`${result[0].current.skytext}`,color:'dark_green'}]) -source.sendFeedback([{text:`Feels like `,color:'gray'},{text:`${result[0].current.feelslike}${result[0].location.degreetype}`,color:'dark_green'}]) -source.sendFeedback([{text:'Humidity ',color:'gray'},{text:`${result[0].current.humidity}`,color:'dark_green'}]) -source.sendFeedback([{text:'Wind Speed ',color:'gray'},{text:`${result[0].current.winddisplay}`,color:'dark_green'}]) +bot.sendFeedback([{text:`${result[0].current.skytext}`,color:'dark_green'}]) +bot.sendFeedback([{text:`Feels like `,color:'gray'},{text:`${result[0].current.feelslike}${result[0].location.degreetype}`,color:'dark_green'}]) +bot.sendFeedback([{text:'Humidity ',color:'gray'},{text:`${result[0].current.humidity}`,color:'dark_green'}]) +bot.sendFeedback([{text:'Wind Speed ',color:'gray'},{text:`${result[0].current.winddisplay}`,color:'dark_green'}]) //if(result[0].location.alert === ''){ //source.sendFeedback('There is no alerts!') //}else{ -source.sendFeedback(result[0].location.alert) +bot.sendFeedback(result[0].location.alert) //} }) diff --git a/src/commands/wiki.js b/src/commands/wiki.js index dc93d18..b00d973 100644 --- a/src/commands/wiki.js +++ b/src/commands/wiki.js @@ -19,7 +19,7 @@ const bot = context.bot } catch (error) { if(error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')"){ -source.sendFeedback({text:'Definition not found!',color:'dark_red'}) +bot.sendFeedback({text:'Definition not found!',color:'dark_red'}) } // source.sendFeedback(error.toString()); } diff --git a/src/commandtemplate.js b/src/commandtemplate.js new file mode 100644 index 0000000..8466d0c --- /dev/null +++ b/src/commandtemplate.js @@ -0,0 +1,13 @@ +const CommandError = require('../CommandModules/command_error') +module.exports = { + name: '', // command name here + description: [''], // command desc here + aliases: [], // command aliases here if there is any + trustLevel: 0, // 0 = public, 1 = trusted, 2 = owner, 3 = console + usages: [], // command usage here + execute (context) { + const bot = context.bot + const args = context.arguments + const source = context.source + } +} diff --git a/src/default.js b/src/default.js index 0fa42f3..93ea0a9 100644 --- a/src/default.js +++ b/src/default.js @@ -1,90 +1,111 @@ { module.exports = { - Commands:{ -prefixes:['!'] -//since the prefix array doesnt have a set number more prefixes can be set +Commands:{ + prefixes:['!'], //since the prefix array doesnt have a set number any number of prefixes can be set + colors: { + discord: { + error: "#ff0000", + embed: "#00ffff", + }, + help:{ + pub_lickColor: "#00FFFF", + t_rustedColor: "dark_purple", + own_herColor: "dark_red", + }, + error: "#FF0000", + } }, -Core:{ - -JSON:``,//needs to be a valid json -area:{ -start:{ x: 0, y: 0, z: 0 }, -end:{ x: 15, y: 0, z: 15 }, -} +Core: { +JSON: ``, //PLEASE make this a valid json or the bot will not be able to refill its core +area: { + start: { x: 0, y: 0, z: 0 }, + end: { x: 15, y: 0, z: 15 }, + } }, - -tellrawTag:{ -fnftellraw:{text:"FNF",color:"dark_purple"}, -boyfriendtellraw:{text:"Boyfriend",color:"#00FFFF"}, -bottellraw:{text:"Bot",color:"dark_red"}, +validation: { + discord: { + roles: { + trusted: "trusted", + owner: "owner", + }, + channelId: "channel validation here", + }, + keys: { + trustedKey: "trusted key here", + ownerKey: "owner key here", + } +}, +tellrawTag: { + fnftellraw: { text: "FNF", color: "dark_purple" }, + boyfriendtellraw: { text: "Boyfriend", color: "#00FFFF" }, + bottellraw: { text: "Bot", color: "dark_red" }, }, helpTheme:{ -pub_lickColor:"#00FFFF", -t_rustedColor:"dark_purple", -own_herColor:"dark_red", + pub_lickColor: "#00FFFF", + t_rustedColor: "dark_purple", + own_herColor: "dark_red", }, Discord: { -enabled:false, + enabled: false, invite: "https://discord.gg/GCKtG4erux", - commandPrefix: "!", -presence:{ - name:'', //set status text here - type:4, - status:'dnd',//status here -} + commandPrefix: "!", + presence:{ + name: 'amongus', //set status text here + type: 4, + status: 'online', //status here + } }, console:{ -filelogging:false, -prefix:'c.', + filelogging: false, + prefix: 'c.', }, bots: [ -{ + { host: "localhost", - username:username(), - version:"1.20.2", -serverName:'localhost', + useChat: false, + isKaboom: true, + isCreayun: false, + usernameGen: true, + username: username(), + version: "1.20.2", + serverName: 'localhost', reconnectDelay: 6000, endcredits:false, Console:{ - enabled:false, - ratelimit:10, -}, - - Core: { - enabled: true, - interval:180000 - }, - discord: { - channelId: "",//discord channel id here -}, -matrix:{ -roomId:'',//matrix room id here -}, - selfcare: { - vanished: false, - unmuted: false, - prefix: false, - cspy: false, - tptoggle:false, - skin:false, - gmc:false, - op:false, - nickname:false, - username:false, - god: false, - interval:500, -} - }, - + enabled: false, + ratelimit: 25, + }, + Core: { + enabled: true, + interval:180000 + }, + discord: { + channelId: "",//discord channel id here + log: false, + }, + matrix:{ + roomId: '', //matrix room id here + }, + selfcare: { + vanished: true, + unmuted: true, + prefix: true, + cspy: true, + tptoggle: true, + skin: true, + gmc: true, + op: true, + nickname: true, + username: true, + god: true, + interval: 500, + } + }, ] -} - - - - - - function username() { - const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever + } + + function username() { + const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\\!@#$%^*(){}[]|\;:,<.>/?§'; let username = ''; for (let i = 0; i < 9; i++) { const randomIndex = Math.floor(Math.random() * characters.length); @@ -92,4 +113,4 @@ roomId:'',//matrix room id here } return username; } -} + } diff --git a/src/commands/evaljs.js b/src/evaljs.js similarity index 88% rename from src/commands/evaljs.js rename to src/evaljs.js index 86318c9..954b861 100644 --- a/src/commands/evaljs.js +++ b/src/evaljs.js @@ -6,7 +6,7 @@ const { stylize } = require('../util/eval_colors') module.exports = { name: 'evaljs', -trustLevel: 1, +trustLevel: -1, aliases:['evaljsisolatedvm', 'evaljsnew', 'evaljsivm', 'eval', 'evalivm', 'evalisolatedvm', 'evaljsnew'], description:['run code in a vm note: amcforum members had a sh##fit over this command'], usage:["re fucking doing"], @@ -64,17 +64,17 @@ try { const script = await args.slice(2).join(' '); // Ensure script is a string const cOmtext = await isolate.createContextSync({options}); if (script.includes('for(;;);')){ -source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'}) +bot.sendFeedback({text:'no now fuck off with that script',color:'dark_red'}) return } else if (script.includes('Array') || script.includes('\u0041rray') || script.includes('\u0065val') || script.includes('.repeat') || script.includes('concat')){ -source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'}) +bot.sendFeedback({text:'no now fuck off with that script',color:'dark_red'}) return } else if(script.includes('eval')){ source.sendFeedback({text:'no',color:'dark_red'}) return }else if(script.includes('.fill')){ -source.sendFeedback({text:'screw off',color:'dark_red'}) +bot.sendFeedback({text:'screw off',color:'dark_red'}) return } (async () => { @@ -87,14 +87,14 @@ return bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(result, { stylize }) }]).toMotd().replaceAll('§', '&')) }else{ - source.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]); + bot.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]); } } catch (reason) { nerd = reason; if(!bot.options.Core.enabled){ bot.chat(ChatMessage.fromNotch([cmd, { text: String(reason.stack), color: 'white' }]).toMotd().replaceAll('§', '&')) }else{ - source.sendFeedback([cmd, { text: String(reason.stack), color: 'white' }]); + bot.sendFeedback([cmd, { text: String(reason.stack), color: 'white' }]); console.log(`AAA at ${reason}\n${reason.stack}`); } } @@ -120,14 +120,14 @@ if(!bot.options.Core.enabled){ 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' }]) + bot.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }]) } break default: 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: 'Invalid option!', color: 'dark_red' }]) + bot.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }]) } } } diff --git a/src/index.js b/src/index.js index 09cf42f..791bbfa 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,17 @@ -const CommandError = require('./CommandModules/command_error.js') +const CommandError = require('./CommandModules/command_error.js'); const util = require("util"); -const createBot = require("./bot.js"); -// TODO: Load a default config -const fs = require("fs"); +const path = require('path'); +const fs = require('fs'); +if (!fs.existsSync('config.js')) { + console.log('Config not found creating config from default.js'); + fs.copyFileSync( + path.join(__dirname, 'default.js'), + path.join(__dirname, 'config.js'), +); +}; +const config = require(`../config.js`); +const createBot = require('./bot.js'); const fileExist = require("./util/file-exists"); -const path = require("path"); const readline = require("readline"); const rl = readline.createInterface({ @@ -12,21 +19,22 @@ const rl = readline.createInterface({ output: process.stdout, }); -function load() { + //const config = require('./config.js') - +function load() { require("dotenv").config(); const bots = []; - const core = config.Core + const core = config.Core; const commands = config.Commands; const Console = config.console; - const tellrawtag = config.tellrawTag - const helptheme = config.helpTheme - const discord = config.Discord - const matrix = config.matrix - for (const options of config.bots) { + const tellrawtag = config.tellrawTag; +// const helptheme = config.helpTheme; + const discord = config.Discord; + const matrix = config.matrix; + const validation = config.validation; +for (const options of config.bots) { const bot = createBot(options); bots.push(bot); bot.bots = bots; @@ -35,11 +43,10 @@ function load() { bot.Console = Console; bot.Discord = discord; bot.tellrawTag = tellrawtag; - bot.helpTheme = helptheme; - bot.matrix = matrix - +// bot.helpTheme = helptheme; + bot.matrix = matrix; + bot.validation = validation; bot.options.username; - bot.loadModule = (module) => module(bot, options); for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) { @@ -54,14 +61,16 @@ function load() { error, ); } - } + bot.console.useReadlineInterface(rl); try { - bot.on("error", console.error); + bot.on("error", error => { +bot?.console?.warn(error.toString()) +}); } catch (error) { console.log(error.stack); } @@ -70,22 +79,7 @@ function load() { } process.on("uncaughtException", (e) => { -console.log(e.stack) +//console.log(e.stack) }); -async function checkConfig() { - if (!(await fileExist(path.join(__dirname, "config.js")))) { - console.error("Config not found! Creating a new Config from "); - await fs.copyFileSync( - path.join(__dirname, "default.js"), - path.join(__dirname, "config.js"), - ); - } - - - config = require("./config.js"); - - load(); -} - -checkConfig(); +load() \ No newline at end of file diff --git a/src/logger.js b/src/logger.js new file mode 100644 index 0000000..41d4428 --- /dev/null +++ b/src/logger.js @@ -0,0 +1,32 @@ +function logger (bot,options) { +const { createGzip } = require('node:zlib'); +const gzip = createGzip(); +const fs = require('fs') +const path = require('path') +const currentDate = new Date(); +const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`; +const logFolder = path.join(__dirname, '../../logs'); // idfk +const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder tf +// i am having a stroke from this + if (!bot.Console.filelogging) return + try { + if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it + fs.mkdirSync(logFolder);//idfk + }//oh wait + } catch (e) {} // prevent it from throwing a ohio exception mabe mabe + +const logFilePath = path.join(logFolder, logFileName); +const logStream = fs.createWriteStream(logFilePath, { flags: 'a' }); +// const toWrite = `${message}`//wtf +if (!bot.Console.filelogging) return // instead of using bot why not just use options cause you already defined it + + // if (toFile) logStream.write(toWrite + '\n'); + + bot.console.filelogger = function (message) {//. + logStream.write(message + '\n'); // toFile is not defined + }; + //if (toConsole) console.log(toWrite); + + +}; +module.exports = logger diff --git a/src/logs/2024-03-27.txt b/src/logs/2024-03-27.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/logs/2024-03-28.txt b/src/logs/2024-03-28.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/logs/2024-03-29.txt b/src/logs/2024-03-29.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/midis/README.txt b/src/midis/README.txt deleted file mode 100644 index 25e7a29..0000000 --- a/src/midis/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -a -m -o -g -u -s diff --git a/src/midis/badpiggies.mid b/src/midis/badpiggies.mid deleted file mode 100644 index 37e39c06e8121006e0be4bf6a0cb92ec1ad1991b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 37347 zcmeI3-A`ND5x|dqNj95ZDz)7Q5(0LBg=EbFYs<35haJ}rSRhKmB4vTt++C$oqilDj zsFm6%S@}9zRh9a1uli8sziA))pY*S2`kVXZ4{QSoCVI-1+?z zrPNgwQA3g1=FanHeEYR}`_0f$b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xpzOs(;igvxgo7ESWMv#`Vbgzqf;H03k%Z}`r_ zPq&Qu3Ex@x3Ex?8H&J zE&1Q%3ZH<&R50gI;ZRVhNbI~XH#d+f7-LsnSGi6hvMQ$Mm9@ai8gIG4vawc~XAmkBhOH~$?(q#?%0+>E z3+4*=zO4n%nb$$V6GJ^{y{%Q47Q?^RVf?UZ( zPFQ?i>o%-{sNh^9zxfsmC@LXK0*!moOnRLTMcaS9c$@C)?yBaY9fNYUEnO2pfF@L~ zeL>z+*>nX0s%_xgNHelrP=ru}FuWgqCc7AATT5ThPPR~w|Mlrdv_*a=)Y=Lwp>{1l zs1{KBg2vN_3aK|JTdzo#P@niMeWIuX=B+jy7#F7ttFSt3uZzo5xyo)|#9q=3Kao3@ zKawAr;&ArdvbJQQbL#p0Mxz$c^m0G&O`vth40N>Pcc#@DxhB->%Nq80v$s%_JnRd| zHFqQho5bQZou1c>G+x7cUgMSR2=%Ee5W0JH4_L2m zwQE+cmp(kN*C|)~o?GRO>l@~$J+pF{pX#9;UjL}+LwTByawtDcAD-9il*9C4Sj(;4 zsJur_AL^reD~IyK^x=8EPB}~;hPB+vjmmq}^r1egw{j>yOdp=t>y*Rvez>(VUeyjt zSvw}}<262hH?sGF>hu28TIDD|u6$y5f@=NrrlkLfvg1AAn;){7?*EtHP z0A*Duqj0bp%86VTe_S&) Jeu`fY|Nmisj57cL diff --git a/src/midis/hell.mid b/src/midis/hell.mid deleted file mode 100644 index cfbca959d52e2db60f381614227929a648f598c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26867 zcmeI**-Bec6vpu#hgb)wrGn8o#98AMHF1n4jxCB5OP~dXT2v5hq1XY6f^K@%tNIFk zgSxguRk3@nyjNZKHQ~yW?)Kr+@2>cfhj~h|;mQ^3(1;W6A6L0zH2?c{V z#0UnFKquM}Lo3=4M+dsljUM!30Db7kForOSF-$^x{5~%pAXTa@_^fz{bm`I2fp~^P z@$sii*$ed=_?D7$&%_Jio5cgvQ-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{lEq*j`;hNk*7l!9cm3W zLZkqZ96%=rkn|(zN79eRONLk<;(8n}yY=r+JWVGU=>((wrJ9}CB>hPGF^u~0cvKUR zWKjELP{juizWW|Nc<{oXuU@~pdd>aoUQ(U2rPZAJ+xH`+2i4Z|3R6@6H5%GS8>#7tl_ARG&i~ zf8J8?6Vnmbd#7uZ<*_jr1cMh_sXVN#G@yXU?=>%dUJNi17JyGGs#1sgr_-aXJ4qh$ zEz32N#j1m-)ae(OP^V9B9-l|`R(#Fy z?%pNfqw!t>KKkx>zL?&)KgJi=VNvV=jIR=%0T@7wR3xPN@cT4>?iAM*Q36Z-vQy)K1i>_^dsH%c#qTuc+)*RScT z&;R~MoB!>;oL#Ap{R)?nU!La+lF%>bS2pH;g`?;%FYpEFN1K-O>>_Z-;kh3@yOR3} z3cO34Y02fC2M=`a26M-6q&@fI(v`Kp!cU=naDDAP_a86Zyy@=Oj^uxbALO_{jS}D9 zyg!Q)V(QwyTeujn>YDd;%!i*=FiqIQjs>!LI67yog)>f&GXFJk^h z%wN@RaCyPU9N=;Oe}4fb{vcHCrImaKdhpWe6K|}pkG;KyAISUJ)%V?hz5`WwP`g|o z`xLtHV45#bh6krFZ_Is)zXW@5iZA$Uoq>8#5;4<6{; HG?D)YjTi6R diff --git a/src/modules/bruhify.js b/src/modules/bruhify.js index 113beee..2d37aba 100644 --- a/src/modules/bruhify.js +++ b/src/modules/bruhify.js @@ -21,7 +21,7 @@ let tag = 'bruhify' bot.chat(ChatMessage.fromNotch(component).toMotd().replaceAll('§', '&')) startHue = (startHue + increment) % 360 }else{ - bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`) + bot.core.run(`minecraft:title @a title ${JSON.stringify(component)}`) startHue = (startHue + increment) % 360 } diff --git a/src/modules/chat.js b/src/modules/chat.js index 78c7557..3b44d0c 100644 --- a/src/modules/chat.js +++ b/src/modules/chat.js @@ -22,7 +22,7 @@ function inject (bot) { ChatMessage = loadPrismarineChat(registry) }) - bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser] + bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser, creayunChatParser] bot.on('packet.profileless_chat', packet => { const message = tryParse(packet.message) @@ -117,9 +117,8 @@ function inject (bot) { bitset[2] = (acc >> 16) & 0xFF bot._client.write('chat_message', { - message, - timestamp: BigInt(Date.now()), - + message: message.substring(0, 256), + timestamp: BigInt(Date.now()), salt: 0n, offset: 0, acknowledged: bitset @@ -131,7 +130,7 @@ function inject (bot) { bot.command = command => { bot._client.write('chat_command', { - command, + command: command.substring(0, 256), timestamp: BigInt(Date.now()), salt: 0n, argumentSignatures: [], @@ -145,4 +144,4 @@ function inject (bot) { bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here? } -module.exports = inject +module.exports = inject \ No newline at end of file diff --git a/src/modules/chat_command_handler.js b/src/modules/chat_command_handler.js index 0b98a78..45a25e8 100644 --- a/src/modules/chat_command_handler.js +++ b/src/modules/chat_command_handler.js @@ -19,16 +19,16 @@ function chat_command_handler(bot) { lifes sus */ const source = new CommandSource(data.sender,{ discord: false, console: false,matrix:false },); - source.sendFeedback = (message) => { + bot.sendFeedback = (message) => { const prefix = { - translate: "%s%s%s \u203a ", + translate: "%s%s%s ", bold: false, color: "dark_gray", with: [ { color: "dark_purple", text: "FNF", - bold: true, + bold: false, hoverEvent: { action: "show_text", value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`, @@ -38,9 +38,9 @@ function chat_command_handler(bot) { : undefined, }, { - color: "#00FFFF", + color: "#2FE0E0", text: "Boyfriend", - bold: true, + bold: false, clickEvent: bot.options.discord.invite ? { action: "open_url", value: bot.options.discord.invite } : undefined, @@ -50,9 +50,9 @@ function chat_command_handler(bot) { }, }, { - color: "dark_red", + color: "#D90003", text: "Bot", - bold: true, + bold: false, clickEvent: bot.options.discord.invite ? { action: "open_url", value: "https://code.chipmunk.land" } : undefined, @@ -64,10 +64,17 @@ function chat_command_handler(bot) { { color: "green", text: command.split(" ")[0] }, ], - }; + }; + if (bot.options.useChat) { + bot.tellraw([message]); + } else { + bot.tellraw(["", prefix, message]); + } - bot.tellraw(["", prefix, message]); - }; +}; +bot.sendError = (message) => { + bot.sendFeedback([{ text: '', color: `red` }, message], false) +} try{ ratelimit++ @@ -75,27 +82,18 @@ try{ ratelimit-- }, 1000) if (ratelimit > 3) { // ,. -if(!bot.options.Core.enabled){ - bot.chat('&4You are using commands to fast!') -}else { - source.sendFeedback({text:'You are using commands to fast!',color:'dark_red'}) + bot.sendFeedback({text:'You are using commands to fast!',color:'dark_red'}) // this isn't blocking running the command you know that right? -} } else { bot.commandManager.executeString(source, command); }//oh real //can i change the variable name so its name isnt confusing? -}catch(e){ + }catch(e){ console.log(e.stack) - - - - //then where to move this? - }; }); })// } -module.exports = chat_command_handler; +module.exports = chat_command_handler; \ No newline at end of file diff --git a/src/modules/command_core.js b/src/modules/command_core.js index 065ee16..ef567ef 100644 --- a/src/modules/command_core.js +++ b/src/modules/command_core.js @@ -3,8 +3,8 @@ async function command_core (bot, options) { bot.core = { // what you think im doing? look at line 17 area: { - start: bot.Core.area.start ?? { x: 0, y: 0, z: 0 }, - end: bot.Core.area.end ?? { x: 15, y: 0, z: 15 } + start: /*bot.Core.area.start, ??*/ { x: 0, y: 0, z: 0 }, + end: /*bot.Core.area.end, ??*/ { x: 15, y: 0, z: 15 } }, position: null, currentBlockRelative: { x: 0, y: 0, z: 0 }, @@ -62,16 +62,16 @@ async function command_core (bot, options) { run (command) { const location = bot.core.currentBlock() if (!location) return -if (!bot.options.Core.enabled) { -bot.command(command.substring(0,255)) -}else{ + if (bot.options.useChat) { + bot.command(command) + }else{ bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 }) bot.core.incrementCurrentBlock() // added .substring(0, 32767) so it won't kick the bot if the command is too long. - } - }, + } + }, } /* bot.on('parsed_message', data => { @@ -83,7 +83,7 @@ bot.command(command.substring(0,255)) } return }) */ - if (!bot.options.Core.enabled) return + if (bot.options.useChat) return bot.on('move', () => { bot.core.move(bot.position) //setTimeout(() => bot.core.run('say hi'), 100) diff --git a/src/modules/command_manager.js b/src/modules/command_manager.js index b8dc747..57a7de6 100644 --- a/src/modules/command_manager.js +++ b/src/modules/command_manager.js @@ -13,47 +13,32 @@ const {EmbedBuilder } = require('discord.js') const player = source?.player?.profile?.name; const uuid = source?.player?.uuid; try { -if(source.sources.console && !source.sources.discord){ +if(source.sources.console && !source?.sources?.discord){ if (!command || !command.execute) { -bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'}) +bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.Console.prefix}help" for help`,color:'dark_red'}) } -}else if(source.sources.discord && !source.sources.console) { +}else if (source?.sources?.discord && !source.sources.console) { if (!command || !command.execute) { - const Embed = new EmbedBuilder() - .setColor('#FF0000') + const Embed = new EmbedBuilder() + .setColor(`${bot.Commands.colors.discord.error}`) .setTitle('Unknown Command') - .setDescription(`Unknown Command ${commandName}. type "${bot.discord.commandPrefix}help" for help`) - bot.discord.channel.send({ embeds: [Embed] }) + .setDescription(`Unknown Command ${commandName}. type "${bot.Discord.commandPrefix}help" for help`) + bot.discord.Message.reply({ embeds: [Embed] }) } -}else if(!source.sources.discord && !source.sources.console) { - if (!bot.options.Core.enabled){ - if (!command || !command.execute) { - throw new CommandError(`Unknown command ${commandName}. Type "${bot.Commands.prefixes[0]}help" for help`) -} -}else{ +}else if(!source?.sources?.discord && !source.sources.console) { + if (!command || !command.execute) { // bot.options.command.prefixes[0] - throw new CommandError({ // sus - translate: `Unknown command %s. Type "${bot.Commands.prefixes[0]}help" for help or click on this for the command`, -/* -with: [commandName], - clickEvent: 'https://discord.gg' - - ? {/ -*/ - with: [commandName], -clickEvent:'https://discord.gg' - ? { - action: "suggest_command", - value: `${bot.Commands.prefixes[0]}help`, - } - : undefined, - }); //ohio + throw new CommandError(bot.getMessageAsPrismarine([{ // sus + translate: `command.unknown.command`},{text:'\n'},{text:`${commandName} `},{translate:"command.context.here"}])?.toMotd(require('../util/language/lolus.json'))); } } -} + const event = bot?.discord?.Message const roles = event?.member?.roles?.cache +if (command?.trustLevel === -1) { +throw new CommandError('this command has been disabled!') +} if (command?.trustLevel > 0) { @@ -63,104 +48,102 @@ const hash = `${args[0]}` if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) -} else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) { +} else if (command.trustLevel === 1 && source?.sources?.discord && !source.sources.console) { - const hasRole = roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner') + const hasRole = roles?.some(role => role.name === `${bot.validation.discord.roles.trusted}` || role.name === `${bot.validation.discord.roles.owner}`) if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' }) } bot?.hashing?.updateHash(); - bot.console.hash = function (error, source) { - console.log( - `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + - `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${ - bot.hash || bot.hashing.hash - }\x1b[0m]`, - ); - }; - bot.console.discordHash = function (error, source) { - console.log( - `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + - `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]`, - ); - }; - bot.console.ownerHash = function (error, source) { - console.log( - `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + - `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]`, - ); - }; - if (args[0] === bot.hash) { - bot.console.hash(); + if (args[0] === bot.hash) { + bot.console.info({ text: `Player ${player} UUID: ${uuid} Hash:${bot.hash}`, color: 'white' }) } else if (args[0] === bot.owner) { - bot.console.ownerHash(); - } + bot.console.info({ text: `Player ${player} UUID: ${uuid} Hash:${bot.owner}`, color: 'white' }) + } if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){ const owner = `${args[0]}` if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}]) -if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}]) +if(owner === bot.hash || owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}]) if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}]) -} else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) { +} else if (command?.trustLevel === 2 && source?.sources?.discord && !source?.sources?.console) { // const events = source.discordMessageEvent // const roless = events?.member?.roles?.cache - const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner') + const hasRole = roles?.some(role => role.name === `${bot.validation.discord.roles.owner}`) - if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' }) + if (!hasRole) throw new CommandError({ translate: 'You are not the Owner!' }) } if (command.trustLevel === 3 && !source?.sources?.console) throw new CommandError({translate: "This command can only be executed via console",color: "blue",}); } - +if(source?.sources?.discord && !source?.sources?.matrix && !source.sources.console){ +if (!command?.discordExecute && command) { +bot.discord.Message.reply('This command is not supported in discord!') +}else{ +return command?.discordExecute({bot, source,arguments: args}) +} +}else{ return command?.execute({ bot, source, arguments: args }); - } catch (error) { - const now = new Date().toLocaleString("en-US", { - timeZone: "America/CHICAGO", - }); - bot.console.warn(error.stack); - if (!bot.options.Core.enabled){ - if (error instanceof CommandError) - bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')) -else bot.chat(bot.getMessageAsPrismarine('an error has occured please check console')?.toMotd().replaceAll('§','&')) - } else if(!source.sources.discord && !source.sources.console) { - if (error instanceof CommandError) - source.sendError(error._message) - else source.sendError({ - translate: "An Error has occured because the bot shot itself 🔫", - color: "red", - hoverEvent: { action: "show_text", contents: String(error.stack) }, - }); - } - // - - - -else if (source.sources.discord && !source.sources.console) { - + } +} catch (error) { +/* if (source.sources.discord) { + //if (error instanceof CommandError) const Embed = new EmbedBuilder() - .setColor('#FF0000') - .setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it') - .setDescription(`\`\`\`${error}\`\`\``) - bot.discord.channel.send({ embeds: [Embed] }) - } - } - }, - + if (error instanceof CommandError) + Embed + .setColor(`${bot.Commands.colors.discord.error}`) + .setTitle(`${command?.name} Command`) + .setDescription(`\`\`\`${error._message}\`\`\``) + bot?.discord?.Message?.reply({ embeds: [Embed] }) + } else { + if (error instanceof CommandError) + bot.sendError(error._message) + else bot.sendError({ + translate: "An Error has occured because the bot shot itself 🔫", + color: `${bot.Commands.colors.error}`, + hoverEvent: { action: "show_text", contents: String(error.stack) }, + }); + console.warn(error.stack) + }*/ + if (!source.sources.discord && !source.sources.console) { + if (error instanceof CommandError) + bot.sendError(error._message) + else bot.sendError({ + translate: "An Error has occured because the bot shot itself 🔫", + color: `${bot.Commands.colors.error}`, + hoverEvent: { action: "show_text", contents: String(error.stack) }, + + }); + bot.console.warn(error.stack) + } else if (source.source.discord && !source.sources.console) { + const Embed = new EmbedBuilder() + .setColor(`${bot.Commands.colors.discord.error}`) + .setTitle(`${command.name} Command`) + .setDescription(`\`\`\`${error._message}\`\`\``) + bot.discord.Message.reply({ embeds: [Embed] }) + } + } +}, executeString(source, command) { const [commandName, ...args] = command.split(" "); -return this.execute(source, commandName, args) + return this.execute(source, commandName, args) }, - - + discordExecute(source, command) { + const [commandName, ...args] = command.split(" "); + + if (source?.sources?.discord && !source?.sources?.matrix && !source?.sources?.console) { + return this.discordExecute(source, commandName, args) + } + }, register(command) { this.commands[command.name] = command; @@ -168,6 +151,7 @@ return this.execute(source, commandName, args) command.aliases.map((a) => (this.commands[a] = command)); } }, + getCommand(name) { return this.commands[name]; }, diff --git a/src/modules/console.js b/src/modules/console.js index b24cd58..d4577c1 100644 --- a/src/modules/console.js +++ b/src/modules/console.js @@ -1,7 +1,11 @@ const CommandSource = require("../CommandModules/command_source"); const prismarine = require('prismarine-chat')('1.20.2') +const moment = require('moment-timezone'); +//const time = moment().tz('america/chicago').format('hh:mm:ss a'); +//const date = moment().tz('america/chicago').format('MM/DD/YY') function Console(bot, options, context, source) { - let ratelimit = 0 + + let ratelimit = 0 bot.console = { readline: null, username: bot.username, @@ -30,41 +34,26 @@ function Console(bot, options, context, source) { if (line === ",kill") process.exit(); if (line === ",reconnect") bot._client.end(); - //probably gotta somehow have it get its username - //tried that already didnt work just errored - //profile or smh :shrug: - // what does it have to be + if (line.startsWith("")) { - if(!bot.options.Core.enabled){ + if(bot.options.useChat){ return bot.commandManager.executeString( bot.console.source, "echo " + line.substring(0), - ) - }else { + ) + } else { return bot.commandManager.executeString( bot.console.source, "console " + line.substring(0), - ); - } + ); + } } //bot.commandManager.executeString(bot.console.source, line) - }); - - const now = new Date().toLocaleString("en-US", { - timeZone: "America/CHICAGO", - }); - const time = new Date().toLocaleTimeString("en-US", { - timeZone: "America/CHICAGO", - }); - const date = new Date().toLocaleDateString("en-US", { - timeZone: "America/CHICAGO", - }); - + }) // const source = context.source - const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `; function log(...args) { rl.output.write("\x1b[2K\r"); @@ -73,17 +62,17 @@ function Console(bot, options, context, source) { } bot.console.warn = function (error) { -log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi()); +log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi()); }; bot.console.error = function (error) { - log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi()); + log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi()); }; bot.console.info = function (message) { - log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi()); + log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi()); }; bot.console.log = function (message, ansi) { - log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message); + log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${ moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message); }; @@ -119,7 +108,7 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'d bot.console.source.sendFeedback = (message) => { const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(); - if (!bot.options.Console) return; +// if (!bot.options.Console) return; bot.console.info(ansi); }; @@ -130,43 +119,25 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'d .getMessageAsPrismarine(data.contents) ?.toString(); if (plainMessage.includes("frog")) { - bot.chat("Man I Love Frogs"); + bot.chat("frok :3"); } return; }); bot.on("message", (message) => { - function log(...args) { + /*function log(...args) { rl.output.write("\x1b[2K\r"); console.log(args.toString()); rl._refreshLine(); - } - const time = new Date().toLocaleTimeString("en-US", { - timeZone: "America/CHICAGO", - }); - const date = new Date().toLocaleDateString("en-US", { - timeZone: "America/CHICAGO", - }); - const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `; + }*/ + - bot.console.logs = function (message, ansi) { - log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message); - }; + + const lang = require(`../util/language/lolus.json`); const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang); const string = bot.getMessageAsPrismarine(message)?.toString(lang); - const now = new Date().toLocaleString("en-US", { - timeZone: "America/CHICAGO", - }); - const time2 = new Date().toLocaleTimeString("en-US", { - timeZone: "America/CHICAGO", - }); - const date2 = new Date().toLocaleDateString("en-US", { - timeZone: "America/CHICAGO", - }); - - // if (!bot.options.Console.input) return; if (!bot.options.Console.enabled) return; @@ -187,8 +158,8 @@ bot._client.end("Anti spam :3") bot.console.log(`${ansi}`); // logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`) - if (bot.console && bot.Console.filelogger) { - bot.console.filelogger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`) + if (bot.console && bot.Console.filelogging) { + bot.console.filelogger(`${prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toString()} ${string}`) }//nothing is logging to the file diff --git a/src/modules/discord.js b/src/modules/discord.js index d24b436..e660139 100644 --- a/src/modules/discord.js +++ b/src/modules/discord.js @@ -1,6 +1,6 @@ // TODO: Maybe move client creation elsewhere const { escapeMarkdown } = require('../util/escapeMarkdown') -const { Client, GatewayIntentBits } = require('discord.js') +const { Client, GatewayIntentBits,interaction } = require('discord.js') const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits const CommandSource = require('../CommandModules/command_source') @@ -32,10 +32,11 @@ const ChatMessage = require('prismarine-chat')(bot.options.version) //bot.discord.channel.send(`\`\`\`\nStarting ${process.env["buildstring"]}......\n\`\`\``) // bot.discord.channel.send(`\`\`\`\nFoundation: ${process.env["FoundationBuildString"]}\n\`\`\``) // bot.discord.channel.send(`\`\`\`\nSuccessfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}\n\`\`\``) -bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``') -bot.discord.channel.send('``Version:' + bot.options.version +'``') -bot.discord.channel.send('``Username:' + bot.options.username + '``') - bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`) + +//bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``') +//bot.discord.channel.send('``Version:' + bot.options.version +'``') +//bot.discord.channel.send('``Username:' + bot.options.username + '``') +// bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`) client.user.setPresence({ activities: [{ name: `${bot.Discord.presence.name}`, type: bot.Discord.presence.type }], status: `${bot.Discord.presence.status}` @@ -58,29 +59,13 @@ status: `${bot.Discord.presence.status}` discordQueue = [] }, 2000) //const ansi = bot.getMessageAsPrismarine(message).toAnsi(lang).replaceAll('``\`\`\u200b\ansi\n\`\`\u001b[9', '\u001b[3\n`\`\`') - /* bot.on('message', (message) => { - const cleanMessage = escapeMarkdown(message.toAnsi(), true) - const discordMsg = cleanMessage - .replaceAll('@', '@\u200b') - .replaceAll('http', 'http\u200b') - .replaceAll('\u001b[9', '\u001b[3') - - queue += '\n' + discordMsg - }) - */ - + function sendDiscordMessage (message) { discordQueue.push(message) +//bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(message)}`) } - /* - const cleanMessage = escapeMarkdown(message.toAnsi(), true) - const discordMsg = cleanMessage - .replaceAll('@', '@\u200b') - .replaceAll('http', 'http\u200b') - .replaceAll('\u001b[9', '\u001b[3') - */ - //`\`\`\`\n \n\`\`\` + function sendComponent (message) { const lang = require(`../util/language/lolus.json`) const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang).replaceAll('```\u001b[9```' + '```\u001b[3```')// I have a function to fix ansi :shrug: @@ -107,6 +92,7 @@ status: `${bot.Discord.presence.status}` const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})//real try { +if(!bot.options.discord.log) return sendDiscordMessage(fixansi(ansi.replaceAll('`', '`\u200b'))) //'```ansi\n' + fixansi(ansi.replaceAll('\u200b').substring(0, 1983)) + '\n```' } catch (e) { @@ -124,16 +110,16 @@ status: `${bot.Discord.presence.status}` sendComponent(message) }) - function messageCreate (message) { + function messageCreate (message, source) { bot.discord.Message = message - if (message.author.id === bot.discord.client.user.id) return +if (message.author.id === bot.discord.client.user.id) return if (message.channel.id !== bot.discord.channel.id) return // if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message) - source.sendFeedback = message => { + bot.sendFeedback = message => { sendComponent(message) //console.log(message.content) } @@ -141,10 +127,12 @@ bot.discord.Message = message bot.commandManager.executeString(source, message.content.substring(bot.discord.commandPrefix.length)) return } -if(!bot.options.Core.enabled){ +if(!bot.options.discord.log) return +if(bot.options.useChat){ bot.chat(`&8[&5FNF&bBoyfriend&4Bot &9Discord&8] ${message.member.displayName.replaceAll('\xa7', '&')}&f › ${message.content.replaceAll('\xa7', '&')}`) }else{ - bot.tellraw({ + +const tag = { translate: '[%s] %s \u203a %s', with: [ { @@ -177,63 +165,31 @@ if(!bot.options.Core.enabled){ hoverEvent: { action: 'show_text', contents: 'Click to join the discord' } }, { text: message?.member?.displayName }, - message.content - ] - }) - + // AttachmentsComponent + +] + } + + if (message.attachments.size > 0) { + message.attachments.forEach(Attachment => { + bot.tellraw([tag,{ text:'' ? '[Attachment]' : '[Attachment]', hoverEvent: { action: 'show_text', contents: 'Click here to view attachment' }, clickEvent: { action: 'open_url', value: `${Attachment.url}` } }]) + }) + } else { + bot.tellraw([tag,`${message.content}`]); + } } - } +} client.on('messageCreate', messageCreate) -// bot.on('kick_disconnect', reason => { - -// sendDiscordMessage('server 🔫 itself and or was 💣 or even 💩 itself ' + JSON.stringify(reason)) - -//sendDiscordMessage(reason) - - // }) - // bot.on('disconnect', reason => { - - // sendDiscordMessage(JSON.stringify(reason)) - -//sendDiscordMessage(reason) - - //}) - // bot.on('packet.login', (data) => { - // sendDiscordMessage(`Connecting to ${bot.options.host}:${bot.options.port}`) - // }) - // bot.on('end', reason => { - -// sendDiscordMessage(JSON.stringify(reason)) - -//sendDiscordMessage(reason) - - // }) - // bot.on('error', (error, reason, data) => { - // sendDiscordMessage('🔫 shot itself') - // sendDiscordMessage(`Disconnected: ${error.stack}`) - -//sendDiscordMessage(reason) - - // }) + + // + + process.on("uncaughtException", (e) => { // sendDiscordMessage("uncaught " + e.stack); -}); + }); - /*bot.on('end', (reason, event) => { -sendDiscordMessage('event:' + event) - sendDiscordMessage('Reason:' + util.inspect(reason)) - - })*/ - //client.on('end', reason => { bot.emit('end', reason) -//client.on('keep_alive', ({ keepAliveId }) => { - //bot.emit('keep_alive', { keepAliveId }) - /* bot.console.info( - `Disconnected from ${bot.server.host} (${event} event): ${util.inspect(reason)}` - ) - channel.send(`Disconnected: \`${util.inspect(reason)}\``) -*/ function fixansi(message) { const ansilist = { "\x1B\[93m": "\x1B[33m", // Yellow diff --git a/src/modules/hashing.js b/src/modules/hashing.js index c8e51ce..f7e2141 100644 --- a/src/modules/hashing.js +++ b/src/modules/hashing.js @@ -1,4 +1,3 @@ - // * Not real hashing const crypto = require('crypto') const ownerkey = process.env['FNFBoyfriendBot_Owner_key'] @@ -11,16 +10,16 @@ function hashgen (bot) { let hash let owner let interval = setInterval(() => { - hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + trustedkey).digest('hex').substring(0, 16) - owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16) + hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.trustedKey).digest('hex').substring(0, 16) + owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.ownerKey).digest('hex').substring(0, 16) bot.hash = hash bot.owner = owner }, 2000) function update() { - hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + trustedkey).digest('hex').substring(0, 16) - owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16) + hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.trusted).digest('hex').substring(0, 16) + owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.owner).digest('hex').substring(0, 16) bot.hash = hash bot.owner = owner @@ -71,7 +70,7 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"} bot?.discord?.client?.on('ready', () => { //bot.discord.client?.setMaxListeners(25) - bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get('1188677777336057987') + bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get(`${bot.validation.discord.channel}`) //bot.hashing.discordChannel?.send() bot?.hashing?.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```') })// + bot.hashing.hash diff --git a/src/modules/logger.js b/src/modules/logger.js index 658363f..0ccd191 100644 --- a/src/modules/logger.js +++ b/src/modules/logger.js @@ -1,29 +1,71 @@ -function consolefilelogger (bot, options, message) { - const fs = require('fs') - const path = require('path') - const currentDate = new Date(); -const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`; -const logFolder = path.join(__dirname, '../logs'); // idfk -const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder tf -// i am having a stroke from this - if (!bot.Console.filelogging) return - try { - if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it - fs.mkdirSync(logFolder);//idfk - }//oh wait - } catch (e) {} // prevent it from throwing a ohio exception mabe mabe - -const logFilePath = path.join(logFolder, logFileName); -const logStream = fs.createWriteStream(logFilePath, { flags: 'a' }); - const toWrite = `${message}`//wtf -if (!bot.Console.filelogging) return // instead of using bot why not just use options cause you already defined it - - // if (toFile) logStream.write(toWrite + '\n'); - - bot.console.filelogger = function (message) {//. - logStream.write(message + '\n'); // toFile is not defined - }; - //if (toConsole) console.log(toWrite); -};//tf +const fs = require("fs"); +const path = require("path"); +const { createGzip } = require("zlib"); + +function consolefilelogger(bot, options, message) { + const currentDate = new Date(); + const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1) + .toString() + .padStart(2, "0")}-${currentDate.getDate().toString().padStart(2, "0")}`; + const logFolder = path.join(__dirname, "../../logs"); + const logFileName = "latest.log"; + const logFilePath = path.join(logFolder, logFileName); + const logStream = fs.createWriteStream(logFilePath, { flags: "a" }); + + if (!bot.Console.filelogging) return; + + try { + if (!fs.existsSync(logFolder)) { + fs.mkdirSync(logFolder); + } + } catch (e) { + console.warn(`Unable to create log folder: ${e}`); + } + + function compressFile(input, output) { + const plainOutput = output.slice(0, -3); + + fs.renameSync(input, plainOutput); + const gzip = createGzip(); + fs.createReadStream(plainOutput) + .pipe(gzip) + .pipe(fs.createWriteStream(output + ".tmp")) + .once("finish", () => { + fs.unlinkSync(plainOutput); + fs.renameSync(output + ".tmp", output); + }); + } + + if (fs.existsSync(logFilePath)) { + const plainName = fs + .statSync(logFilePath) + .ctime.toISOString() + .split("T")[0]; + let name = plainName; + let counter = 1; + let newFileName = path.join(logFolder, `${name}.log.gz`); + while (fs.existsSync(newFileName)) { + name = `${plainName}-${counter}`; + newFileName = path.join(logFolder, `${name}.log.gz`); + counter++; + } + // if (plainName !== timestamp) { + compressFile(logFilePath, newFileName); + // } + } + + console.log( + `File logging: ${bot.Console.filelogging ? "enabled" : "disabled"}` + ); + if (!bot.Console.filelogging) return; // instead of using bot why not just use options cause you already defined it + + // if (toFile) logStream.write(toWrite + '\n'); + + bot.console.filelogger = function (message) { + logStream.write(message + "\n"); // toFile is not defined + }; + //if (toConsole) console.log(toWrite); +} + +module.exports = consolefilelogger; -module.exports = consolefilelogger diff --git a/src/modules/matrix.js b/src/modules/matrix.js index 8157b01..e9d7cd3 100644 --- a/src/modules/matrix.js +++ b/src/modules/matrix.js @@ -70,8 +70,8 @@ if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.messa } else if (message.startsWith('!')) { const source = new CommandSource({ console:false,discord:false,matrix:true }) bot.commandManager.execute(message.substring('!'), source) - source.sendFeedback = message => { - sendMessage(message) +bot.sendFeedback = message => { + sendCompoent(message) //console.log(message.content) //bot.discord.Message = this } @@ -110,7 +110,7 @@ if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.messa clickEvent: bot.matrix.inviteUrl ? { action: 'open_url', value: bot.matrix.inviteUrl } : undefined, hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' } }, - { text: String(event.sender.rawDisplayName || event.sender.name || event.sender.userId) }, + { text: event.sender.rawDisplayName || event.sender.name || event.sender.userId }, message ] }) @@ -155,4 +155,4 @@ sendMessage(html) } } -module.exports = inject +module.exports = inject \ No newline at end of file diff --git a/src/modules/memusage.js b/src/modules/memusage.js index d39a372..7942a99 100644 --- a/src/modules/memusage.js +++ b/src/modules/memusage.js @@ -32,9 +32,9 @@ function memusage(bot, options) { color: "gray", bold: false, with: [{ text: `Memory used ${Math.floor( - process.memoryUsage().heapUsed / 1000 / 1000, + process.memoryUsage().heapUsed / 1048576, )} MiB / ${Math.floor( - process.memoryUsage().heapTotal / 1000 / 1000, + process.memoryUsage().heapTotal / 1048576, )} MiB`, color: "green" }], }; //process.cpuUsage @@ -47,7 +47,8 @@ function memusage(bot, options) { // `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`, // ); // bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`); -bot.tellraw(component) +//bot.tellraw(component) +bot.core.run(`minecraft:title @a actionbar ${component}`) }, 100); //process.memoryUsage().heapUsed /1024 / 1024 } module.exports = memusage; diff --git a/src/modules/music.js b/src/modules/music.js index dc24421..6740e49 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -1,9 +1,11 @@ const path = require('path') -const { Midi } = require('@tonejs/midi') -const { convertMidi } = require('../util/midi_converter') -const convertNBS = require('../util/nbs_converter') -const parseTXTSong = require('../util/txt_song_parser') const fs = require('fs') +const { Midi } = require('@tonejs/midi') +const { convertMidi } = require('../util/music/midi_converter') +const convertNBS = require('../util/music/nbs_converter') +const parseTXTSong = require('../util/music/txt_song_parser') +const midiproxy = require('../util/music/midi-proxy') +midiproxy() const soundNames = { harp: 'minecraft:block.note_block.harp', basedrum: 'minecraft:block.note_block.basedrum', @@ -23,11 +25,12 @@ const soundNames = { pling: 'minecraft:block.note_block.pling' } -function inject (bot) { +async function inject (bot) { bot.music = function () {} bot.music.song = null bot.music.loop = 0 bot.music.queue = [] + bot.music.volume = 0.1 let time = 0 let startTime = 0 let noteIndex = 0 @@ -40,58 +43,58 @@ function inject (bot) { } resetTime() } -/* - -try { - if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it - fs.mkdirSync(logFolder);//idfk - }//oh wait - } catch (e) { -*/ -try { -if(!fs.existsSync('./midis')){ -fs.mkdirSync('./midis') -} -}catch(e){ -console.log(e) -} +const midisFolder = path.join(__dirname, '../../midis'); // idfk +//why is it not trying to find the folder tf +// i am having a stroke from this + try { + if (!fs.existsSync(midisFolder)) { + fs.mkdirSync(midisFolder); + } +}catch(e) {} const bossbarName = 'music' // maybe make this in the config? const selector = '@a[tag=!nomusic]' - +// setTimeout const interval = setInterval(async () => { if (!bot.music.queue.length) return bot.music.song = bot.music.queue[0] time = Date.now() - startTime - /* - // bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent())) - // is spamming commands in core as a self care a good idea? - // btw this is totallynotskidded™️ from my song bot except the bossbarName (above) + // bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent())) + await bot.chatDelay(1) bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea? + await bot.chatDelay(1) bot.core.run(`minecraft:bossbar set ${bossbarName} players ${selector}`) - bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(toComponent())}`) - bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol + await bot.chatDelay(1) + bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(bot.getMessageAsPrismarine(bossbarComponent()).toMotd())}`) + await bot.chatDelay(1) + bot.core.run(`minecraft:bossbar set ${bossbarName} color aqua`) // should i use purple lol + await bot.chatDelay(1) bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) + await bot.chatDelay(1) bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`) + await bot.chatDelay(1) bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`) - */ - bot.core.run(`title @a actionbar ${JSON.stringify(toComponent())}`) -bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) + + await bot.chatDelay(1) + bot.core.run(`title @a actionbar ${JSON.stringify(bot.getMessageAsPrismarine(actionbarComponent()).toMotd())}`) + // await bot.chatDelay(500) + while (bot.music.song?.notes[noteIndex]?.time <= time) { const note = bot.music.song.notes[noteIndex] - const floatingPitch = 2 ** ((note.pitch - 12) / 12.0) -// bot.core.run(`playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`) - bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`) + const floatingPitch = 2 ** ((note.pitch - 12) / 12.0) + // bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`) +bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${bot.music.volume} ${floatingPitch}`) + noteIndex++ if (noteIndex >= bot.music.song.notes.length) { - bot.tellraw([ + bot.sendFeedback([ { text: 'Finished playing ' }, { text: bot.music.song.name, - color: 'gold' + color: '#00FFFF' } ]) @@ -118,12 +121,17 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) } } } - }, 100) + },150) bot.on('end', () => { - clearInterval(interval) +// clearInterval(interval) + bot.music.stop() + // interval = undefined + }) + bot.on('packet.login', (packet) => { + //interval + // bot.music.stop() }) - bot.music.load = async function (buffer, fallbackName = '[unknown]') { let song switch (path.extname(fallbackName)) { @@ -162,7 +170,7 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) time = 0 startTime = Date.now() noteIndex = 0 - bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk + bot.core.run(`minecraft:bossbar remove ${bossbarName}`) } function formatTime (time) { @@ -171,14 +179,34 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, '0')}` } - function toComponent () { + function actionbarComponent () { const component = [ - // { text: '[', color: 'dark_gray' }, - // { text: 'ChomeNS Bot', color: 'yellow' }, - // { text: '] ', color: 'dark_gray' }, - // { text: 'Now Playing', color: 'gold' }, - // { text: ' | ', color: 'dark_gray' }, - { text: bot.music.song.name, color: 'green' }, + { text: ' | ', color: 'dark_gray' }, + { text: bot.music.song.name, color: 'blue' }, + { text: ' | ', color: 'dark_gray' }, + { text: formatTime(time), color: 'gray' }, + { text: ' / ', color: 'dark_gray' }, + { text: formatTime(bot.music.song.length), color: 'gray' }, + { text: ' | ', color: 'dark_gray' }, + { text: noteIndex, color: 'gray' }, + { text: ' / ', color: 'dark_gray' }, + { text: bot.music.song.notes.length, color: 'gray' } + ] + + if (bot.music.loop === 1) { + component.push({ text: ' | ', color: 'dark_gray' }) + component.push({ text: 'Looping Current', color: 'green' }) + } + if (bot.music.loop === 2) { + component.push({ text: ' | ', color: 'dark_gray' }) + component.push({ text: 'Looping All', color: 'green' }) + } + + return component + } + function bossbarComponent () { + const component = [ + { text: bot.music.song.name, color: 'blue' }, { text: ' | ', color: 'dark_gray' }, { text: formatTime(time), color: 'gray' }, { text: ' / ', color: 'dark_gray' }, diff --git a/src/modules/player_list.js b/src/modules/player_list.js index 2992f71..b7159ae 100644 --- a/src/modules/player_list.js +++ b/src/modules/player_list.js @@ -1,4 +1,4 @@ -function inject (bot) { +function playerlist (bot) { bot.players = [] //chayapak you mentally ok? bot.on('packet.player_info', packet => { @@ -25,37 +25,13 @@ function inject (bot) { } }) - function removePlayer (player, packet) { - const fullPlayer = bot.players.getPlayer(player) - //const players = tabCompletePlayerList.list - if (fullPlayer && players.some((name) => name === fullPlayer.name)) { - bot.emit('player_vanished', player) - } else { - bot.on('packet.player_remove', ({ players }) => { - for (const player of players) { - bot.players = bot.players.filter(entry => entry.uuid !== player) - - } - - bot.players = bot.players.filter(entry => entry.uuid !== player) - }) - - bot.players.removePlayer(player) - if (!target) return - target.removePlayer = entry.removePlayer - } - } -// if (process.env["FoundationBuildString"] !== 'Ultimate Foundation v2.0.6 Build:270') -//{ - // process.exit(1) -//} function addPlayer (entry) { bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid) bot.players.push({ uuid: entry.uuid, profile: { name: entry.player.name, properties: entry.player.properties }, -removePlayer:undefined, + chatSession: undefined, gamemode: undefined, listed: undefined, @@ -103,11 +79,4 @@ removePlayer:undefined, bot.on('end', () => (bot.players = [])) } -module.exports = inject -/*function addPlayer (player, packet) { - if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet) - else bot.emit('player_added', player, packet) - - bot.players.addPlayer(player) - } - */ +module.exports = playerlist diff --git a/src/modules/reconnect.js b/src/modules/reconnect.js index 6a3777a..03581de 100644 --- a/src/modules/reconnect.js +++ b/src/modules/reconnect.js @@ -2,18 +2,33 @@ const mc = require('minecraft-protocol') function reconnect (bot, options) { bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd - + bot.usernameGen = options.usernameGen ?? false + function username() { + const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\\!@#$%^*(){}[]|\;:,<.>/?&'; + let username = ''; + for (let i = 0; i < 9; i++) { + const randomIndex = Math.floor(Math.random() * characters.length); + username += characters[randomIndex]; + } + return username; + } bot.on('end', (reason) => { if (bot.reconnectDelay < 0) return setTimeout(() => { - - const client = options.client ?? mc.createClient(options) - + if (bot.options.usernameGen) { +// client = options.client ?? mc.createClient({username:username()}, options) +// let e = bot.options.username = username() + bot._client.end() + bot.options.username = username() + client = options.client ?? mc.createClient(options, bot.options.username = username()) + }else { + client = options.client ?? mc.createClient(options) + } bot._client = client bot.console.info(`Reconnecting to ${bot.options.host}:${bot.options.port}`) bot.emit('init_client', client) }, bot.reconnectDelay) }) } -module.exports = reconnect +module.exports = reconnect; diff --git a/src/modules/registry.js b/src/modules/registry.js index fb32d51..efd67f2 100644 --- a/src/modules/registry.js +++ b/src/modules/registry.js @@ -4,6 +4,7 @@ function registry (bot) { bot.on('packet.login', packet => { bot.registry = createRegistry(bot._client.version) // bot.registry.loadDimensionCodec(packet.dimensionCodec) +//bot.registry.language = 'lolcats_us' bot.emit('registry_ready', bot.registry) }) } diff --git a/src/modules/reload.js b/src/modules/reload.js index 5e2c4a9..48abdc4 100644 --- a/src/modules/reload.js +++ b/src/modules/reload.js @@ -1,6 +1,7 @@ const path = require('path'); const fs = require('fs'); - +const CommandError = require('../CommandModules/command_error') +const { EmbedBuilder } = require('discord.js') function reload (bot,options,context) { bot.reload = function () { for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) { @@ -13,20 +14,11 @@ const command = require(path.join(__dirname, "../commands", filename)); bot.commandManager.commandlist.pop(command) bot.commandManager.commandlist.push(command) } catch (error) { -bot.console.error(["Failed to load File", filename, ":", error]) - bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]); - } -} -for (const filename of fs.readdirSync(path.join(__dirname, "../modules"))) { - try { - const module = require(path.join(__dirname, "../modules", filename)); -delete require.cache[require.resolve(path.join(__dirname, "../modules", filename))] - // bot.loadModule(module) - } catch (error) { -bot.console.error("Failed to load File", filename, ":", error.toString()) - bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]); - } +bot.console.error(["Failed to load File ", filename, ":", error.stack]) + bot.tellraw({text:`${error.stack}`,color:'dark_red'}); + +} } } diff --git a/src/modules/selfcare.js b/src/modules/selfcare.js index 57dc8c9..e9a4103 100644 --- a/src/modules/selfcare.js +++ b/src/modules/selfcare.js @@ -1,4 +1,3 @@ - const util = require('util') const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' } @@ -6,9 +5,9 @@ const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' } //You now have the tag: &8[&bPrefix &4d~&8] function selfcare (bot) { let entityId - let gameMode + let gameMode let permissionLevel = 2 -let unmuted = false + let unmuted = false let commandSpyEnabled = false let vanished = false let prefix = false @@ -17,58 +16,56 @@ let unmuted = false let nickname = false let god = false let tptoggle = false -let jail = false + let jail = false /* if (data.toString().startsWith('You have been muted')) muted = true if (data.toString() === 'You have been unmuted.') muted = false */ //bot.on('message', (data) => { bot.on('message', (message, data) => { // Successfully removed your skin - const stringmessage = bot.getMessageAsPrismarine(message)?.toString() + stringmessage = bot.getMessageAsPrismarine(message)?.toString() + if (bot.options.isCreayun) { + if (stringmessage === `Your prefix has been set to: [Prefix: ~]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.' || stringmessage === 'Unknown command. Type /help for help' || stringmessage === '[SuffEx] Your prefix has been set to: [Prefix: ~]') { + prefix = true + return + } else if (stringmessage.startsWith("Your prefix has been set to: ") || stringmessage === '[SuffEx] Your prefix has been set to: ' || stringmessage === '[SuffEx] Your prefix has been reset' || stringmessage === "Your prefix has been reset.") prefix = false + } if (bot.options.isKaboom) { //Your prefix has been reset. if (stringmessage.startsWith('You have been muted')) unmuted = true - else if (stringmessage === "You have been unmuted.") unmuted = false + else if (stringmessage.startsWith('You have been unmuted')) unmuted = false else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false - else if (stringmessage === `You now have the tag: &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]`) { + else if (stringmessage === `You now have the tag: &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.') { prefix = true return } else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false - else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) { + else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) { skin = true return } -//Successfully set your skin to Parker2991's - //Successfully removed your skin -else if (stringmessage === 'You have been released!') jail = true -else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true -else if(stringmessage === `You have been jailed!`){ -jail = false -return -} - else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false + else if (stringmessage === 'You have been released!') jail = true + else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true + else if(stringmessage === `You have been jailed!`){ + jail = false + return + } + else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false - else if (stringmessage === `Successfully set your username to "${bot.username}"`) { + else if (stringmessage === `Successfully set your username to "${bot.username}"`) { username = true return }//"Successfully set your username to "${bot.username}""" else if (stringmessage.startsWith("Successfully set your username to ")) username = false else if (stringmessage === `You already have the username "${bot.username}"`) username = true -//That name is already in use. - //Error: Nicknames must be alphanumeric. - //You no longer have a nickname. - //Your nickname is now sus. else if (stringmessage === `You no longer have a nickname.`) { nickname = true return - }//"Successfully set your username to "${bot.username}""" + } else if (stringmessage.startsWith("Your nickname is now ")) nickname = false // else if (stringmessage === `Error: Nicknames must be alphanumeric.`) nickname = false else if (stringmessage === `You no longer have a nickname.`) nickname = false //else if (stringmessage === `That name is already in use.`) nickname = false -//God mode enabled. - //God mode disabled. else if (stringmessage === `God mode enabled.`) { god = true return @@ -85,7 +82,7 @@ vanished = false return } else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true - +} /* else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return @@ -156,4 +153,4 @@ await bot.discord.channel.send(`Starting ${buildstring}`) await sendChat(buildstring) await sendChat('Prefix ~') }) -}*/ +}*/ \ No newline at end of file diff --git a/src/modules/tpsbar.js b/src/modules/tpsbar.js index 45274e6..cf6d64b 100644 --- a/src/modules/tpsbar.js +++ b/src/modules/tpsbar.js @@ -29,7 +29,7 @@ async function tpsbar(bot, config) { }; bot.core.run(`minecraft:bossbar add ${bossbarName} ""`); bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`); - bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`); + bot.core.run(`minecraft:bossbar set ${bossbarName} color blue`); bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`); bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`); bot.core.run( @@ -59,7 +59,7 @@ async function tpsbar(bot, config) { else return value; } - bot.on("login", (data) => { + bot.on("packet.login", (data) => { nextIndex = 0 timeGameJoined = timeLastTimeUpdate = Date.now() }); @@ -79,4 +79,4 @@ async function tpsbar(bot, config) { nextIndex = null }) } -module.exports = tpsbar; +module.exports = tpsbar; \ No newline at end of file diff --git a/src/util/bots/hbot.json b/src/util/bots/hbot.json new file mode 100644 index 0000000..244e0bd --- /dev/null +++ b/src/util/bots/hbot.json @@ -0,0 +1,10 @@ + +{ + "name": { "text": "HBot", "color": "aqua", "bold": "false" }, + "authors": ["hhhzzzsss"], + "exclaimer": "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO", + "foundation": "java/mcprotocollib", + "prefixes": ["#"], + "maintained":"false" +} + diff --git a/src/util/bots/sc09.json b/src/util/bots/sc09.json new file mode 100644 index 0000000..3b39698 --- /dev/null +++ b/src/util/bots/sc09.json @@ -0,0 +1,10 @@ + +{ + "name": { "text": "SC09", "color": "gray", "bold": "false" }, + "authors": ["spyingcreeper09"], + "exclaimer": "i approve :3", + "foundation": "NodeJS/node-minecraft-protocol", + "prefixes": ["@"], + "maintained":"true" + } + diff --git a/src/util/getFilenameFromUrl.js b/src/util/getFilenameFromUrl.js index e69de29..c19e516 100644 --- a/src/util/getFilenameFromUrl.js +++ b/src/util/getFilenameFromUrl.js @@ -0,0 +1,8 @@ +const path = require('path') + +function getFilenameFromUrl (urlStr) { + const url = new URL(urlStr) + return path.basename(url.pathname) +} + +module.exports = getFilenameFromUrl \ No newline at end of file diff --git a/src/util/minecraftVersionToNumber.js b/src/util/minecraftVersionToNumber.js index 50184be..68034c7 100644 --- a/src/util/minecraftVersionToNumber.js +++ b/src/util/minecraftVersionToNumber.js @@ -1,8 +1,4 @@ -/** - * converts minecraft version to number (for example '1.19.2' will be 1.19) - * @param {String} version - * @return {Number} decimal number of the version you specified - */ + function minecraftVersionToNumber (version) { const versionArray = version.split('.') if (versionArray.length === 2) return Number(version) diff --git a/src/util/music/midi-proxy.js b/src/util/music/midi-proxy.js new file mode 100644 index 0000000..a9f432c --- /dev/null +++ b/src/util/music/midi-proxy.js @@ -0,0 +1,28 @@ +function midiproxy () { +const http = require('http') +const { URLSearchParams, parse } = require('url') +const request = require('request') + +const server = http.createServer((req, res) => { + const url = parse(req.url) + const params = new URLSearchParams(url.search) + const uri = params.get('uri') + + if (!uri) { + res.end('SyntaxError: No URI') + return + } + + try { + request({ uri }) + .on('error', (err) => res.end(err.toString())) + .pipe(res) + } catch (error) { + res.end(error.toString()) + } +}) + +server.listen(8080) +} + +module.exports = midiproxy diff --git a/src/util/midi_converter/convert_note.js b/src/util/music/midi_converter/convert_note.js similarity index 100% rename from src/util/midi_converter/convert_note.js rename to src/util/music/midi_converter/convert_note.js diff --git a/src/util/midi_converter/instrument_map.js b/src/util/music/midi_converter/instrument_map.js similarity index 100% rename from src/util/midi_converter/instrument_map.js rename to src/util/music/midi_converter/instrument_map.js diff --git a/src/util/midi_converter/instruments.json b/src/util/music/midi_converter/instruments.json similarity index 100% rename from src/util/midi_converter/instruments.json rename to src/util/music/midi_converter/instruments.json diff --git a/src/util/midi_converter/main.js b/src/util/music/midi_converter/main.js similarity index 100% rename from src/util/midi_converter/main.js rename to src/util/music/midi_converter/main.js diff --git a/src/util/midi_converter/package.json b/src/util/music/midi_converter/package.json similarity index 100% rename from src/util/midi_converter/package.json rename to src/util/music/midi_converter/package.json diff --git a/src/util/midi_converter/percussion_map.js b/src/util/music/midi_converter/percussion_map.js similarity index 100% rename from src/util/midi_converter/percussion_map.js rename to src/util/music/midi_converter/percussion_map.js diff --git a/src/util/nbs_converter.js b/src/util/music/nbs_converter.js similarity index 100% rename from src/util/nbs_converter.js rename to src/util/music/nbs_converter.js diff --git a/src/util/nbs_file.js b/src/util/music/nbs_file.js similarity index 100% rename from src/util/nbs_file.js rename to src/util/music/nbs_file.js diff --git a/src/util/txt_song_parser.js b/src/util/music/txt_song_parser.js similarity index 100% rename from src/util/txt_song_parser.js rename to src/util/music/txt_song_parser.js