Skip to content

Commit

Permalink
📑 [1.2.1] - Important bug fixes
Browse files Browse the repository at this point in the history
- Fixed statusCH function
- Fixed a typo in README.md
  • Loading branch information
PetyXbronCZ committed Nov 12, 2021
1 parent 0937cfb commit a4bd4cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <s>Installation with repl.it</s>
* 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
Expand Down
34 changes: 11 additions & 23 deletions events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(" ")
Expand All @@ -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 },
Expand All @@ -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()
Expand All @@ -88,7 +82,7 @@ module.exports = async (bot) => {
.setColor(config.embeds.error)
.setFooter('Updated')
.setTimestamp()
msg.edit(errorEmbed);
msg.edit({ embeds: [errorEmbed] });

throw error;
})
Expand All @@ -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()
Expand All @@ -121,7 +115,7 @@ module.exports = async (bot) => {
.setColor(config.embeds.error)
.setFooter('Updated')
.setTimestamp()
msg.edit(errorEmbed);
msg.edit({ embeds: [errorEmbed] });

throw error;
})
Expand All @@ -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(" ")
Expand All @@ -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 },
Expand All @@ -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()
Expand All @@ -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));
Expand All @@ -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()
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit a4bd4cb

Please sign in to comment.