forked from SloppierKitty7/Sloppiers-heroku-discord-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
107 lines (76 loc) · 2.7 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
var express = require('express')
var app = express()
var Discord = require("discord.js");
var ver ="0.86"
var mybot = new Discord.Client();
var getJSON = require('get-JSON');
mybot.on("ready", function () {
console.log("Ready to begin! Serving in " + mybot.channels.length + " channels");
});
mybot.on("message", function(message) {
if (message.content === "!live") {
getJSON("https://api.twitch.tv/kraken/streams/lalicel", function(err, res) {
if (res.stream == null) {
mybot.reply(message, "she is currently not live");
} else {
mybot.reply(message, "she is currently live");
mybot.sendMessage(message, "https://www.twitch.tv/lalicel");
}
});
}
});
//long comands
mybot.on("message", function(message){
if( message.content === "!my_avatar" ){
var usersAvatar = message.sender.avatarURL;
if(usersAvatar){
// user has an avatar
mybot.reply(message, "your avatar can be found at " + usersAvatar);
}else{
// user doesn't have an avatar
mybot.reply(message, "you don't have an avatar!");
}
}
} );
//bot stuff
mybot.on("message", function(message) {
if(message.content === "!help") {
mybot.reply(message, "**My current Commands** ```!about_bot, !live, !my_avatar, !twitch, !youtube, hype, cry```" );
}
});
mybot.on("message", function(message) {
if(message.content === "!about_bot") {
mybot.reply(message, "I was made by SloppierKitty7. I was written in nodejs and i'm runing on heroku and soon will be on github. I'm current on version is: " + ver + " @SloppierKitty7 should really update me");
mybot.sendFile(message, "http://i.imgur.com/izUfF1f.png");
}
});
//links
mybot.on("message", function(message) {
if(message.content === "!twitch") {
mybot.reply(message, "https://www.twitch.tv/lalicel");
}
});
mybot.on("message", function(message) {
if(message.content === "!youtube") {
mybot.reply(message, "https://www.youtube.com/channel/UCVsd_WSEaW5oJTRZTI-2yBQ");
}
});
//emots
mybot.on("message", function(message) {
if(message.content === "hype") {
mybot.sendFile(message, "http://i.imgur.com/zDPIzq4.png");
}
});
mybot.on("message", function(message) {
if(message.content === "cry") {
mybot.sendFile(message, "http://i.imgur.com/izUfF1f.png");
}
});
app.set('port', (process.env.PORT || 5000))
app.use(express.static(__dirname + '/public'))
app.get('/', function(request, response) {
response.send('Hello World!')
})
app.listen(app.get('port'), function() {
console.log("Node app is running at localhost:" + app.get('port'))
})