From a4bd4cb2e053b94d38e95fe82a794c38a660f0de Mon Sep 17 00:00:00 2001 From: PetyXbronCZ Date: Fri, 12 Nov 2021 19:46:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=91=20[1.2.1]=20-=20Important=20bug=20?= =?UTF-8?q?fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed statusCH function - Fixed a typo in README.md --- README.md | 2 +- events/ready.js | 34 +++++++++++----------------------- package.json | 2 +- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 73acb5b..62f6de9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This code could not be created without **Minecraft server util package** * Lockdown mode (no messages, no new members) * Custom reply for command ip, test and version * Installation with repl.it -* Better test command (shows mroe information) +* Better test command (shows more information) * More text languages (or custom) * Create threads from every message in voting channel * Bot status (activity) for players online number diff --git a/events/ready.js b/events/ready.js index df7b402..1483944 100644 --- a/events/ready.js +++ b/events/ready.js @@ -5,7 +5,7 @@ db = require('quick.db'), ms = require('ms'), gr = chalk.keyword('green').bold, bl = chalk.keyword('blue'), -warn = chalk.keyword('yellow').bold +warn = chalk.keyword('yellow').bold; module.exports = async (bot) => { const {server, config, info, settings} = bot @@ -56,11 +56,6 @@ module.exports = async (bot) => { if(server.type === 'java') { util.status(ip1, { port: port1 }) .then((response) => { - const favic = response.favicon - let icon = favic.split(`,`); - let imageStream = new Buffer.from(icon[1], 'base64'); - var attachment = new Discord.MessageAttachment(imageStream, 'logo.png'); - const versionOriginal = response.version if(settings.split) { const versionArray = versionOriginal.split(" ") @@ -69,8 +64,7 @@ module.exports = async (bot) => { const version = versionAdvanced ? versionAdvanced : versionOriginal const serverEmbed = new Discord.MessageEmbed() - .attachFiles(attachment) - .setAuthor(config.server.name ? config.server.name : message.guild.name, 'attachment://logo.png') + .setAuthor(config.server.name ? config.server.name : message.guild.name, icon) .setDescription(`:white_check_mark: **ONLINE**`) .addFields( { name: "PLAYERS", value: `${response.onlinePlayers}/${response.maxPlayers}` + (response.samplePlayers ? "\n\`\`\`" + response.samplePlayers.map(p => ` ${p.name} `).join('\n') + "\`\`\`":"") , inline: false }, @@ -79,7 +73,7 @@ module.exports = async (bot) => { .setColor(config.embeds.color) .setFooter('Updated') .setTimestamp() - msg.edit(serverEmbed); + msg.edit({ embeds: [serverEmbed] }) }) .catch((error) => { const errorEmbed = new Discord.MessageEmbed() @@ -88,7 +82,7 @@ module.exports = async (bot) => { .setColor(config.embeds.error) .setFooter('Updated') .setTimestamp() - msg.edit(errorEmbed); + msg.edit({ embeds: [errorEmbed] }); throw error; }) @@ -112,7 +106,7 @@ module.exports = async (bot) => { .setColor(config.embeds.color) .setFooter('Updated') .setTimestamp() - msg.edit(serverEmbed); + msg.edit({ embeds: [serverEmbed] }); }) .catch((error) => { const errorEmbed = new Discord.MessageEmbed() @@ -121,7 +115,7 @@ module.exports = async (bot) => { .setColor(config.embeds.error) .setFooter('Updated') .setTimestamp() - msg.edit(errorEmbed); + msg.edit({ embeds: [errorEmbed] }); throw error; }) @@ -133,11 +127,6 @@ module.exports = async (bot) => { setInterval(() => util.status(ip1, { port: port1 }) .then((response) => { - const favic = response.favicon - let icon = favic.split(`,`); - let imageStream = new Buffer.from(icon[1], 'base64'); - var attachment = new Discord.MessageAttachment(imageStream, 'logo.png'); - const versionOriginal = response.version if(settings.split) { const versionArray = versionOriginal.split(" ") @@ -146,8 +135,7 @@ module.exports = async (bot) => { const version = versionAdvanced ? versionAdvanced : versionOriginal const serverEmbed = new Discord.MessageEmbed() - .attachFiles(attachment) - .setAuthor(config.server.name ? config.server.name : message.guild.name, 'attachment://logo.png') + .setAuthor(config.server.name ? config.server.name : message.guild.name, icon) .setDescription(`:white_check_mark: **ONLINE**`) .addFields( { name: "PLAYERS", value: `${response.onlinePlayers}/${response.maxPlayers}` + (response.samplePlayers ? "\n\`\`\`" + response.samplePlayers.map(p => ` ${p.name} `).join('\n') + "\`\`\`":"") , inline: false }, @@ -156,7 +144,7 @@ module.exports = async (bot) => { .setColor(config.embeds.color) .setFooter('Updated') .setTimestamp() - msg.edit(serverEmbed); + msg.edit({ embeds: [serverEmbed] }); }) .catch((error) => { const errorEmbed = new Discord.MessageEmbed() @@ -165,7 +153,7 @@ module.exports = async (bot) => { .setColor(config.embeds.error) .setFooter('Updated') .setTimestamp() - msg.edit(errorEmbed); + msg.edit({ embeds: [errorEmbed] }); throw error; }), ms(info.time)); @@ -190,7 +178,7 @@ module.exports = async (bot) => { .setColor(config.embeds.color) .setFooter('Updated') .setTimestamp() - msg.edit(serverEmbed); + msg.edit({ embeds: [serverEmbed] }); }) .catch((error) => { const errorEmbed = new Discord.MessageEmbed() @@ -199,7 +187,7 @@ module.exports = async (bot) => { .setColor(config.embeds.error) .setFooter('Updated') .setTimestamp() - msg.edit(errorEmbed); + msg.edit({ embeds: [errorEmbed] }); throw error; }), ms(info.time)); diff --git a/package.json b/package.json index 1b0a6e5..948795a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-bot", - "version": "1.2.0", + "version": "1.2.1", "description": "Discord minecraft bot, with which you can check your minecraft server status (online players, version, online status etc.)", "main": "index.js", "scripts": {