amog
This commit is contained in:
parent
05acc96b2e
commit
b67230d13c
@ -10,7 +10,7 @@ const express = require("express"),
|
||||
db = new sqlite3.Database("./servers.db");
|
||||
|
||||
const createWebhook = url => new Discord.Webhook(url).setUsername("TaxenHeimer").setAvatar("https://cdn.discordapp.com/attachments/999167321631363126/999495738943868928/nn.png")
|
||||
const countrify = e => require("./contrycode.json")[e]
|
||||
const countrify = e => require("./countrycode.json")[e]
|
||||
const replaceMOTD = e => e.replace(/'/g, "\\'").replace(/-/g, '\\-')
|
||||
const makeEmbed = (mc, neit) => {
|
||||
var Embed = new Discord.MessageBuilder()
|
||||
@ -18,7 +18,7 @@ const makeEmbed = (mc, neit) => {
|
||||
.setColor("#00ff00")
|
||||
.addField("**Host**", `\`${mc.Server}\``, true)
|
||||
.addField("**Country**", `\`${countrify(mc.ip.country)}\``)
|
||||
.addField("**Version**", `\`${mc.version.name} (${mc.version.protocol})\``, true)
|
||||
.addField("**Version**", `\`${mc.version.name}\``, true)
|
||||
.addField("**Players**", `\`${mc.players.online}/${mc.players.max}\``, true)
|
||||
.addField("**Ping**", `\`${mc.roundTripLatency}ms\``, true)
|
||||
.addField("**Motd**", "```\n" + mc.motd.clean + "\n```")
|
||||
@ -27,7 +27,6 @@ const makeEmbed = (mc, neit) => {
|
||||
.setTimestamp()
|
||||
|
||||
if (neit) Embed.setText("<@390491795655622657>")
|
||||
console.log(Embed)
|
||||
return Embed
|
||||
}
|
||||
var webhooks = [
|
||||
@ -58,6 +57,7 @@ app.post("/server", async (req, res) => {
|
||||
var Minecraft = await mc.status(Server, 25565, {
|
||||
enableSRV: true
|
||||
})
|
||||
fs.appendFileSync(`${__dirname}/ip.txt`, `${Server}\n`)
|
||||
Minecraft.ip = geoIP.lookup(Server)
|
||||
Minecraft.Server = `${Server}:25565`
|
||||
var cleanMOTD = replaceMOTD(Minecraft.motd.clean)
|
||||
@ -79,7 +79,7 @@ app.post("/server", async (req, res) => {
|
||||
break
|
||||
}
|
||||
switch(true) {
|
||||
case Minecraft.version.name.includes("1.17"):
|
||||
case Minecraft.version.name === "1.17":
|
||||
webhooks[2].send(makeEmbed(Minecraft, "neit"))
|
||||
break;
|
||||
default:
|
||||
@ -91,5 +91,5 @@ app.listen(9000, () => {
|
||||
console.clear()
|
||||
console.log("server ready")
|
||||
})
|
||||
//process.on("unhandledRejection", callback => console.log(callback))
|
||||
//process.on("uncaughtException", callback => console.log(callback))
|
||||
process.on("unhandledRejection", callback => console.log(callback))
|
||||
process.on("uncaughtException", callback => console.log(callback))
|
@ -4,7 +4,7 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "nodemon index",
|
||||
"test": "nodemon --ignore servers.db index",
|
||||
"compile": "bytenode --compile index.js",
|
||||
"runc": "bytenode index.js"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user