Showing
2 changed files
with
54 additions
and
0 deletions
README.md
0 → 100644
1 | +// Tell a Chuck Norris Joke | ||
2 | +function chuckJoke(){ | ||
3 | + axios.get('http://api.icndb.com/jokes/random/') | ||
4 | + .then(res =>{ | ||
5 | + const joke = res.data.value.joke; | ||
6 | + | ||
7 | + const face = { | ||
8 | + icon_emoji: ':laughing:' | ||
9 | + }; | ||
10 | + | ||
11 | + bot.postMessageToChannel('everyone', `Chuck Norris: ${joke}`,face); | ||
12 | + bot.postMessageToChannel('full-stack-web', `Yo mama: ${joke}`,face); | ||
13 | + bot.postMessageToChannel('bot_test', `Yo mama: ${joke}`,face); | ||
14 | + }); | ||
15 | +} | ||
16 | + | ||
17 | +// Tell a yomama Joke | ||
18 | +function yoMamaJoke(){ | ||
19 | + axios.get('http://api.yomomma.info/') | ||
20 | + .then(res =>{ | ||
21 | + const joke = res.data.joke; | ||
22 | + | ||
23 | + const face = { | ||
24 | + icon_emoji: ':laughing:' | ||
25 | + }; | ||
26 | + | ||
27 | + bot.postMessageToChannel('everyone', `Yo mama: ${joke}`,face); | ||
28 | + bot.postMessageToChannel('full-stack-web', `Yo mama: ${joke}`,face); | ||
29 | + bot.postMessageToChannel('bot_test', `Yo mama: ${joke}`,face); | ||
30 | + | ||
31 | + }); | ||
32 | +} | ||
33 | +//Tell random joke | ||
34 | +function randomJoke(){ | ||
35 | + const rand = Math.floor(Math.random() * 2) +1; | ||
36 | + if(rand ===1){ | ||
37 | + chuckJoke(); | ||
38 | + } | ||
39 | + else if(rand === 2){ | ||
40 | + yoMamaJoke(); | ||
41 | + } | ||
42 | +} | ||
43 | +function runHelp(){ | ||
44 | + const face = { | ||
45 | + icon_emoji: ':question:' | ||
46 | + }; | ||
47 | + | ||
48 | + bot.postMessageToChannel('everyone', "Type @joker and write a joke that you would like\n ex- @joker random",face); | ||
49 | + bot.postMessageToChannel('full-stack-web', "Type @joker and write a joke that you would like\n ex- @joker random",face); | ||
50 | +} | ||
51 | + | ||
52 | +module.exports = route; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment