Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var tmi = require("tmi.js");
- var options = {
- options: {
- debug: true
- },
- connection: {
- reconnect: true
- },
- identity: {
- username: "Schmoopiie",
- password: "oauth:a29b68aede41e25179a66c5978b21437"
- },
- channels: ["#dexuuh", "#summit1g"]
- };
- var client = new tmi.client(options);
- // Connect the client to the server..
- client.connect();
- client.on("message", function (channel, userstate, message, self) {
- // Don't listen to my own messages..
- if (self) return;
- // Handle different message types..
- switch(userstate["message-type"]) {
- case "action":
- // This is an action message..
- break;
- case "chat":
- if(message === "!command") {
- client.say(channel, "This is the response for !command");
- }
- break;
- case "whisper":
- // This is a whisper..
- break;
- default:
- // Something else ?
- break;
- }
- });
- client.on("subscription", function (channel, username, method) {
- client.say(channel, "Thank you " + username + " for subscribing");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement