-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
135 lines (92 loc) · 3.6 KB
/
index.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
const Discord = require('discord.js');
const {Client , MessageEmbed} = require('discord.js');
const oof = new Client ();
const bot = new Discord.Client();
const ms = require('ms');
const fs = require('fs');
const moongose = require('mongoose')
const ping = require('minecraft-server-util');
const { error } = require('console');
const { waitForDebugger } = require('inspector');
const { connect } = require('http2');
var usertickets = new Map();
moongose.connect("mongodb+srv://cutcopy:[email protected]/cutcopy?retryWrites=true&w=majority",{
useUnifiedTopology: true,
useNewUrlParser: true,
});
const PREFIX = '-';
oof.on('ready',() =>{
console.log('bot is ready and online!')
})
bot.on('ready',() =>{
console.log('oof is ready and online!')
})
bot.on('messagereactionroleadd',(messageReaction,user) => {
console.log(user.username + 'reacted');
})
bot.on('guildMemberAdd',function(member){
member.send('Welcome to the server!')
let memberrole = member.guild.roles.cache.find(role => role.name === 'Member');
member.roles.add(memberrole);
});
bot.on('message',message=>{
switch (args[0]){
case '!ping':
var ping = Date.now() - message.createdTimestamp + " ms";
const emb = new Discord.MessageEmbed()
.addField("Ping/Latency",ping)
.setColor(0xF1C40F)
message.channel.send(emb);
break;
oof.on('message',message=>{
switch(args[0]){
case '!say' :
if((message.author.id == 688237610636017714) || (message.author.id == 420616930819309589)){
message.delete()
let hmm = '**'+ args.slice(1).join(" ")+'**';
const gi = new MessageEmbed()
.setDescription(hmm)
.setColor(0xFF0000)
return message.channel.send(gi);
}
break;
case '!status':
ping('play.skullnetwork.net',25565 ,(error,response) => {
if(error) throw error
if(!args[1]){
const ip = 'play.skullnetwork.net'
const nab = new MessageEmbed()
.setTitle('Server Status')
.setColor(0xF1C40F)
.addField('Server IP ',ip,true)
.addField('version',response.version,true)
.addField('online players',response.onlinePlayers,true)
.addField('Max players',response.maxPlayers,true)
.setThumbnail('https://i.ibb.co/cC4HN4P/server-icon.png')
message.channel.send(nab)
}
else if( args[1]){
message.channel.send('please type only !status');
}
else if( args[2]){
message.channel.send('please type only !status');
}
else if( args[3]){
message.channel.send('please type only !status');
}
else{
const offline ='offline'
const ip = 'play.skullnetwork.net'
const hmm = new MessageEmbed()
.setTitle('Server Status')
.addField('Server IP ',ip,true)
.addField('server is',offline,true)
message.channel.send(hmm)
message.member.send('Dont worry, Server will be online soon')
}
})
break;
}
})
bot.login(process.env.token);
oof.login(process.env.token);