diff --git a/package-lock.json b/package-lock.json index 024f4de..34506c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "SkiBot", - "version": "0.6", + "version": "1.0", "lockfileVersion": 3, "requires": true, "packages": { @@ -11,7 +11,8 @@ "minecraft-protocol": "^1.51.0", "prismarine-chat": "^1.10.1", "prismarine-nbt": "^2.7.0", - "prismarine-registry": "^1.10.0" + "prismarine-registry": "^1.10.0", + "undici": "^7.2.0" } }, "node_modules/@azure/msal-common": { @@ -135,6 +136,15 @@ "integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==", "license": "MIT" }, + "node_modules/@discordjs/rest/node_modules/undici": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", + "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, "node_modules/@discordjs/util": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.1.tgz", @@ -462,6 +472,15 @@ "url": "https://github.com/discordjs/discord.js?sponsor" } }, + "node_modules/discord.js/node_modules/undici": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", + "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -1036,12 +1055,12 @@ "license": "0BSD" }, "node_modules/undici": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", - "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.2.0.tgz", + "integrity": "sha512-klt+0S55GBViA9nsq48/NSCo4YX5mjydjypxD7UmHh/brMu8h/Mhd/F7qAeoH2NOO8SDTk6kjnTFc4WpzmfYpQ==", "license": "MIT", "engines": { - "node": ">=18.17" + "node": ">=20.18.1" } }, "node_modules/undici-types": { diff --git a/package.json b/package.json index 5a5ee08..2eb6d3a 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "minecraft-protocol": "^1.51.0", "prismarine-chat": "^1.10.1", "prismarine-nbt": "^2.7.0", - "prismarine-registry": "^1.10.0" + "prismarine-registry": "^1.10.0", + "undici": "^7.2.0" } } diff --git a/src/commands/info.js b/src/commands/info.js new file mode 100644 index 0000000..c11692f --- /dev/null +++ b/src/commands/info.js @@ -0,0 +1,56 @@ +const { request } = require('undici'); +const { execSync } = require('child_process'); +module.exports = { + data: { + name: "info", + enabled: true, + aliases: [ + "information", + ], + description: "bot information", + usages: [ + "version" + ] + }, + async execute (context) { + const bot = context.bot; + const args = context.arguments; + const config = context.config; + let component = []; + + switch (args[0]?.toLowerCase()) { + case "version": + let fnfbfbotversionurl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/releases'); + let fnfbfbotcommiturl = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/commits'); + + let urlVersionData = await fnfbfbotversionurl.body.json(); + let urlCommitData = await fnfbfbotcommiturl.body.json(); + let urlVersionOutput = urlVersionData[0]; + let urlCommitOutput = urlCommitData[0]; + + component.push({ + translate: "%s%s-%s\n%s: %s\n%s: %s\n\n%s%s%s-%s\n%s: %s", + color: "dark_gray", + with: [ + { text: "Ski", color: "aqua" }, + { text: "Bot", color: "blue" }, + { text: `${require('../../package-lock.json').version}`, color: "blue" }, + { text: "Build", color: "dark_blue" }, + { text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: "blue" }, + { text: "Commit", color: "dark_blue" }, + { text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: "blue" }, + { text: "FNF", color: "dark_blue" }, + { text: "Boyfriend", color: "dark_aqua" }, + { text: "Bot", color: "blue" }, + { text: `${urlVersionOutput.name}`, color: "blue" }, + { text: "Commit", color: "dark_blue" }, + { text: `${urlCommitOutput.sha.substring(0, 10)}`, color: "blue" } + ] + }); + break; + default: + bot.console.command('SkiBot is a client chat bot created by Parker2991 using Custom FNFBoyfriendBot source\nSkiBot\'s source can be found at https://code.chipmunk.land/Parker2991/SkiBot.git\nFNFBoyfriendBot\'s source can be found at https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot.git\n\nthe idea of the bot is to try and make it close to a minecraft java client as much as i can') + } + bot.console.command(component); + } +} diff --git a/src/commands/rc.js b/src/commands/rc.js new file mode 100644 index 0000000..c48d30a --- /dev/null +++ b/src/commands/rc.js @@ -0,0 +1,24 @@ +module.exports = { + data: { + name: "rc", + enabled: true, + aliases: [ + "refill", + "refillcore" + ], + description: "refills the core", + usages: [ + ] + }, + execute (context) { + const bot = context.bot; + const args = context.arguments; + const config = context.config; + if (config.core.itemRefill === true) { + bot.core.itemRefill(); + } else { + bot.core.chatRefill(); + } + bot.console.command('refilling core,...'); + } +}