-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
65 lines (48 loc) · 1.97 KB
/
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
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
require('dotenv').config();
const Discord = require('discord.js');
const fs = require('fs');
const botFlag = 't$ ';
const bot = new Discord.Client();
bot.commandList = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commandList.set(command.name, command);
}
bot.on('ready', () => {
console.log(`Logged on!`);
});
bot.login(process.env.DISCORD_TOKEN);
bot.on('message', function(message){
if (message.content.substring(0, 3) === botFlag) {
let args = message.content.substring(botFlag.length).trim().split(/ +/);
let cmd = args.shift().toLowerCase();
if(message.content === 't$'){
return message.channel.send("You need to specify a command!");
}
const cmdExec = bot.commandList.get(cmd)
|| bot.commandList.find(com => com.aliases && com.aliases.includes(cmd));
if(!cmdExec){
message.channel.send("Cannot find command, use t$ help");
}else{
try{
cmdExec.execute(message, args);
}catch(err){
console.error("Caught " + err);
message.channel.send(`Error running: ${cmd}.`);
}
}
}
if(message.content === 'hey siri show me shares of jimmy')
{
message.channel.send("**Jimmy Pepper Co (JIMY)**\n" + "Current Price: $0.01 -199999999 (-80000000008.00%)")
}
if(message.content === 'hey jimmy')
{
message.channel.send(":smirk: :smirk:")
}
if(message.content === 'hey')
{
message.channel.send("A man👨has fallen😵into the river🏊 in Lego city🌃! Start the new rescue helicopter🚁! Hey!😫Build 🔨the helicopter 🚁and off to the rescue! 🚑Prepare the lifeline💔, lower⬇️ the stretcher, and make the rescue🚑. 🎷🎺The new Emergency Collection from Lego City! 🎷🎺");
}
});