-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
97 lines (65 loc) · 2.21 KB
/
app.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
// Require discord.js package
const Discord = require("discord.js");
// Create a new client using the new keyword
const client = new Discord.Client();
// Display a message once the bot has started
client.on("ready", () =>{
console.log(`Logged in as ${client.user.tag}!`);
});
// // Check messages for a specific command
client.on("message", msg =>{
const msgToLower = msg.content.toLowerCase();
const gameArray = ["rock","paper","scissors"];
const multiply = 3;
const inputArray = ["!rock","!paper","!scissors"];
if(msg.content === inputArray[0]){
msg.reply("You've chosen rock");
const random = Math.floor(Math.random() * 3);
const pcselect = gameArray[random];
//console.log(pcselect);
msg.reply("Pc chose: " + pcselect );
if( pcselect === "rock"){
msg.reply("Draw ");
}
else if(pcselect === "paper"){
msg.reply(" I won ");
}
else if(pcselect === "scissors"){
msg.reply(" You Won ");
}
}
else if(msg.content === inputArray[1]){
msg.reply("You've chosen Paper");
const random = Math.floor(Math.random() * 3);
const pcselect = gameArray[random];
//console.log(pcselect);
msg.reply("Pc chose: " + pcselect );
if( pcselect === "rock"){
msg.reply("You lose ");
}
else if(pcselect === "paper"){
msg.reply(" draw ");
}
else if(pcselect === "scissors"){
msg.reply(" You Won ");
}
}
else if(msg.content === inputArray[2]){
msg.reply("You've chosen scissors");
const random = Math.floor(Math.random() * 3);
const pcselect = gameArray[random];
//console.log(pcselect);
msg.reply("Pc chose: " + pcselect );
if( pcselect === "rock"){
msg.reply("You won ");
}
else if(pcselect === "paper"){
msg.reply(" You lose ");
}
else if(pcselect === "scissors"){
msg.reply(" Draw ");
}
}
});
// Log in the bot with the token
client.login("Token")