Skip to content

Commit

Permalink
✌️ [1.2.2] - New AdvancedVersion system
Browse files Browse the repository at this point in the history
- Edited server version editing (removes "Paper", "Spigot", "Tuinity" from: "Paper 1.17" and it will remain just "1.17")
  • Loading branch information
PetyXbronCZ committed Nov 12, 2021
1 parent a4bd4cb commit dd94ef3
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 25 deletions.
9 changes: 7 additions & 2 deletions commands/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ module.exports.run = async (bot, message) => {

const versionOriginal = response.version
if(settings.split) {
const versionArray = versionOriginal.split(" ")
var versionAdvanced = versionArray[versionArray.length - 1]
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

Expand Down
22 changes: 16 additions & 6 deletions commands/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@ module.exports.run = async (bot, message, args) => {
const response = await util.status(server.ip, { port: server.port })
const versionOriginal = response.version
if(settings.split) {
const versionArray = versionOriginal.split(" ")
var versionAdvanced = versionArray[versionArray.length - 1]
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
var version = versionAdvanced ? versionAdvanced : versionOriginal
const version = versionAdvanced ? versionAdvanced : versionOriginal
} else {
const response = await util.statusBedrock(server.ip, { port: server.port })
const versionOriginal = response.version
if(settings.split) {
const versionArray = versionOriginal.split(" ")
var versionAdvanced = versionArray[versionArray.length - 1]
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
var version = versionAdvanced ? versionAdvanced : versionOriginal
const version = versionAdvanced ? versionAdvanced : versionOriginal
}

const versionEmbed = new Discord.MessageEmbed()
Expand Down
52 changes: 36 additions & 16 deletions events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ module.exports = async (bot) => {
.then((response) => {
const versionOriginal = response.version
if(settings.split) {
const versionArray = versionOriginal.split(" ")
var versionAdvanced = versionArray[versionArray.length - 1]
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

Expand Down Expand Up @@ -89,12 +94,17 @@ module.exports = async (bot) => {
} else {
util.statusBedrock(ip1, { port: port1 })
.then((response) => {
const versionOriginal = response.version;
if(settings.split) {
const versionArray = versionOriginal.split(" ");
var versionAdvanced = versionArray[versionArray.length - 1];
};
const version = versionAdvanced ? versionAdvanced : versionOriginal;
const versionOriginal = response.version
if(settings.split) {
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

const serverEmbed = new Discord.MessageEmbed()
.setAuthor(config.server.name ? config.server.name : message.guild.name, icon)
Expand Down Expand Up @@ -129,8 +139,13 @@ module.exports = async (bot) => {
.then((response) => {
const versionOriginal = response.version
if(settings.split) {
const versionArray = versionOriginal.split(" ")
var versionAdvanced = versionArray[versionArray.length - 1]
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

Expand Down Expand Up @@ -161,12 +176,17 @@ module.exports = async (bot) => {
setInterval(() =>
util.statusBedrock(ip1, { port: port1 })
.then((response) => {
const versionOriginal = response.version;
if(settings.split) {
const versionArray = versionOriginal.split(" ");
var versionAdvanced = versionArray[versionArray.length - 1];
};
const version = versionAdvanced ? versionAdvanced : versionOriginal;
const versionOriginal = response.version
if(settings.split) {
if(versionOriginal.includes("Spigot")) {
var versionAdvanced = versionOriginal.replace("Spigot", "")
} else if (versionOriginal.includes("Paper")) {
var versionAdvanced = versionOriginal.replace("Paper", "")
} else if (versionOriginal.includes("Tuinity")) {
var versionAdvanced = versionOriginal.replace("Tuinity", "")
}
}
const version = versionAdvanced ? versionAdvanced : versionOriginal

const serverEmbed = new Discord.MessageEmbed()
.setAuthor(config.server.name ? config.server.name : message.guild.name, icon)
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.1",
"version": "1.2.2",
"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 dd94ef3

Please sign in to comment.