Skip to content

Commit

Permalink
🔨 [1.3.8] - Bug fixes
Browse files Browse the repository at this point in the history
- Fixed wrong motd
- Fixed player list
  • Loading branch information
PetyXbronCZ committed Dec 7, 2021
1 parent 564242f commit f1c0ead
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion commands/list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { commands} = require("../config");
const util = require('minecraft-server-util');
const Discord = require('discord.js');
const c = require('chalk')

module.exports.config = {
name: "list", //Name of command - RENAME THE FILE TOO!!!
Expand All @@ -24,11 +25,13 @@ module.exports.run = async (bot, message) => {
if(server.type === 'java') {
util.status(ip1, port1)
.then((result) => {
const trueList = result.players.sample ? "\n\`\`\`" + result.players.sample.map(p => ` ${p.name} `).join('\r\n') + "\`\`\`":""

const serverEmbed = new Discord.MessageEmbed()
.setAuthor(config.server.name ? config.server.name : message.guild.name, icon)
.setDescription(`:white_check_mark: **ONLINE**`)
.addFields(
{ name: "Players", value: `**${result.players.online}**/**${result.players.max}**` + (result.players.sample ? "\n\`\`\`" + result.players.sample.map(p => ` ${p.name} `).join('\n') + "\`\`\`":"") , inline: false },
{ name: "Players", value: `**${result.players.online}**/**${result.players.max}**` + trueList, inline: false },
)
.setColor(config.embeds.color)
message.channel.send({ embeds: [serverEmbed] });
Expand Down
8 changes: 6 additions & 2 deletions events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ module.exports = async (bot) => {
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

const trueList = result.players.sample ? "\n\`\`\`" + result.players.sample.map(p => ` ${p.name} `).join('\r\n') + "\`\`\`":""

const serverEmbed = new Discord.MessageEmbed()
.setAuthor(config.server.name ? config.server.name : message.guild.name, icon)
.setDescription(`:white_check_mark: **ONLINE**`)
.addFields(
{ name: "PLAYERS", value: `${result.players.online}/${result.players.max}` + (result.samplePlayers ? "\n\`\`\`" + result.samplePlayers.map(p => ` ${p.name} `).join('\n') + "\`\`\`":"") , inline: false },
{ name: "PLAYERS", value: `${result.players.online}/${result.players.max}` + trueList , inline: false },
{ name: "INFO", value: `${server.type.toUpperCase()} ${version}\n\`${server.ip}\`:\`${server.port}\`` , inline: true }
)
.setColor(config.embeds.color)
Expand Down Expand Up @@ -198,12 +200,14 @@ module.exports = async (bot) => {
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

const trueList = result.players.sample ? "\n\`\`\`" + result.players.sample.map(p => ` ${p.name} `).join('\r\n') + "\`\`\`":""

const serverEmbed = new Discord.MessageEmbed()
.setAuthor(config.server.name ? config.server.name : message.guild.name, icon)
.setDescription(`:white_check_mark: **ONLINE**`)
.addFields(
{ name: "PLAYERS", value: `${result.players.online}/${result.players.max}` + (result.samplePlayers ? "\n\`\`\`" + result.samplePlayers.map(p => ` ${p.name} `).join('\n') + "\`\`\`":"") , inline: false },
{ name: "PLAYERS", value: `${result.players.online}/${result.players.max}` + trueList , inline: false },
{ name: "INFO", value: `${server.type.toUpperCase()} ${version}\n\`${server.ip}\`:\`${server.port}\`` , inline: true }
)
.setColor(config.embeds.color)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minecraft-bot",
"version": "1.3.7",
"version": "1.3.8",
"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 Expand Up @@ -31,6 +31,7 @@
"chalk": "^4.1.2",
"discord.js": "^13.3.1",
"fs": "^0.0.1-security",
"minecraft-motd-util": "^1.1.6",
"minecraft-server-util": "^5.1.2",
"ms": "^2.1.3",
"quick.db": "^7.1.3"
Expand Down

0 comments on commit f1c0ead

Please sign in to comment.