This repository was archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
47 lines (39 loc) · 1.5 KB
/
app.js
File metadata and controls
47 lines (39 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const Discord = require("discord.js")
const {Client, RichEmbed } = require('discord.js')
const app = new Client()
const ping = require('minecraft-server-util')
const PREFIX = '-'
//==========================SERVER-PROPERTIES===========================//
const SIP = '' //Server IP
const SPO = 25565 //Server Port | Default 25565
const TOKEN = '' //Discord Bot Token
//======================================================================//
app.on('ready', () => {
console.log('OK')
})
app.on('message', message => {
//SERVER INFO
if(message.content.startsWith(PREFIX + 'mc')) {
ping(SIP, SPO)
.then((reponse) => {
const EmbedOnline = new Discord.MessageEmbed()
.setColor('#5EE32C')
.setTitle('Server Info')
.setDescription('Host: ' + SIP)
.addFields(
{ name: 'Server Status', value: 'Online'},
{ name: 'Online Players', value: reponse.onlinePlayers},
{ name: 'Max Players', value: reponse.maxPlayers}
)
message.channel.send(EmbedOnline)
})
.catch((error) => {
const EmbedOffline = new Discord.MessageEmbed()
.setColor('#E84A4A')
.setTitle('Server Info')
.addField('Server Satus','Offline')
message.channel.send(EmbedOffline)
});
}
})
app.login(TOKEN)