first cummit

This commit is contained in:
TaxMachine 2022-08-16 18:16:19 -04:00
commit f337844bf9
4 changed files with 1061 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/*

40
index.js Normal file
View File

@ -0,0 +1,40 @@
const
discord = require('discord.js'),
bot = new discord.Client(),
mc = require('minecraft-server-util'),
needle = require('needle'),
web = new discord.WebhookClient("1009180421390598365", "uqcEgaZRiSG9L5e3M9idcpr5ObdZDsL1L6QzflQvZbnMew5rA6LJ1HnPghv1WY-PHx0D"),
prefix = "&"
bot.login("MTAwOTE3OTUzNDY5Mzc3MzQxNA.GA7c-4.Ct3_njR4txMsx6K2Fp-cUCvOPwlLe3ao_NWZnM")
bot.on('ready', async () => {
console.clear()
console.log(`Logged on ${bot.user.username}`)
})
bot.on('message', async(message) => {
var args = message.content.substring(prefix.length).split(" ");
if (!message.content.startsWith("&")) return;
switch (args[0]) {
case "status":
var h = await mc.status("play.2b2flat.fr", 25565).catch(e => {
message.channel.send("Serveur offline")
})
var embed = new discord.MessageEmbed()
.setTitle("**Status 2b2flat**")
.addField("**IP**", "`play.2b2flat.fr`", true)
.addField("**Version**", `${h.version}`, true)
.addField("**Motd**", `\`\`\`\n${h.motd}\n\`\`\``)
.setTimestamp()
message.channel.send(embed)
break;
}
})
setInterval(async() => {
var h = await mc.status("play.2b2flat.fr", 25565).catch(e => {
web.send(":red_circle: Serveur Down")
})
web.send(":green_circle: Serveur Ouvert")
}, 120000)

1002
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "2b2flat-bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon index"
},
"author": "TaxMachine",
"license": "ISC",
"dependencies": {
"discord.js": "^12.5.3",
"minecraft-server-util": "^5.3.0",
"needle": "^3.1.0",
"nodemon": "^2.0.19"
}
}