Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var tmi = require('tmi.js');
- var channelname = "MrJunior717"
- var options = {
- options: {
- debug: true
- },
- connection: {
- "cluster": "aws",
- "reconnect": true
- },
- identity:{
- username: "BOTNAME",
- password: "OATHTOKEN"
- },
- channels:[channelname]
- }
- var client = tmi.client(options);
- client.connect();
- client.on("connected",function(address,port){
- console.log("connected: " + address + ":" + port);
- client.action(channelname,"I am Live");
- })
- client.on("chat", function(channel, user, message,self){
- var words = message.split(" ");
- var command = words[0];
- var response ="";
- if (command === '!spook'){
- if (words.length < 3 && words.length > 1){
- if (Math.random() > 0.5) response = user.username + " has spooked " + words[1]
- if (Math.random() <= 0.5) response = user.username + " has failed to spook " + words[1]
- }
- client.action(channelname, response);
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement