-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
36 lines (36 loc) · 971 Bytes
/
bot.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
const Discord = require('discord.js');
var bot=new Discord.Client();
var HH=new Date().getHours();
var MM=new Date().getMinutes();
var i=0;
var flag=0;
const usr=require(__dirname+'/cred.json');
const key=require(__dirname+'/keywords.json');
bot.on("ready",async()=>{
console.log("\n\n\t ~ DiscordListener Online ");
bot.user.setActivity(" with Myself");
});
bot.on('message',msg=>{
if(msg.content=='~on'){
if(msg.author.id==usr.uid){
msg.author.send("\n ~ Discord Listener Online ");
flag=1;
}
}
if(msg.content=='~off'){
if(msg.author.id==usr.uid){
msg.author.send("\n ~ Discord Listener Stopped ");
flag=0;
}
}
if(flag==1){
for(i=0;i<key.keys.length;i++){
if(msg.content.includes(key.keys[i])&&msg.channel.type!='dm'){
bot.users.get(usr.uid).send("[ "+msg.author.username+" ] : "+ msg.content);
console.log("\n");
console.log(HH+":"+MM+" [ "+msg.author.username+" ] - " + msg.content );
}
}
}
});
bot.login(usr.token);