Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [31mcrash[39m: ReferenceError: $ is not defined
- at client.<anonymous> (C:UsersExuviaxDesktopnode.jsbot.js:157:9)
- at client.emit (events.js:117:20)
- at C:UsersExuviaxDesktopnode.jsnode_modulestwitch-irclibraryclient.js:657:30
- at Object.createChannelUserData (C:UsersExuviaxDesktopnode.jsnode_modulestwitch-irclibrarydata.js:56:2)
- at client._handleMessage (C:UsersExuviaxDesktopnode.jsnode_modulestwitch-irclibraryclient.js:651:22)
- at Stream.emit (events.js:95:17)
- at drain (C:UsersExuviaxDesktopnode.jsnode_modulestwitch-ircnode_modulesirc-message-streamnode_modulesthroughindex.js:36:16)
- at Stream.stream.queue.stream.push (C:UsersExuviaxDesktopnode.jsnode_modulestwitch-ircnode_modulesirc-message-streamnode_modulesthroughindex.js:45:5)
- at LineStream.<anonymous> (C:UsersExuviaxDesktopnode.jsnode_modulestwitch-ircnode_modulesirc-message-streamindex.js:22:16)
- at LineStream.emit (events.js:95:17)
- var irc = require('twitch-irc');
- var colors = require('colors');
- var jQuery = require('jQuery')
- var jsdom = require("jsdom");
- var window = jsdom.jsdom().parentWindow;
- jsdom.jQueryify(window, "http://code.jquery.com/jquery-2.1.3.min.js", function () {
- var $ = window.$;
- $("body").prepend("<h1>The title</h1>");
- console.log($("h1").html());
- });
- // Calling a new client..
- var client = new irc.client({
- options: {
- debug: true,
- debugIgnore: ['ping', 'chat', 'action'],
- logging: true,
- tc: 3
- },
- identity: {
- username: 'BotName',
- password: 'oauth:Code'
- },
- channels: ['#my', '#first', '#connect', '#channels']
- });
- // Connect the client to server..
- client.connect();
- client.addListener('chat', function(channel, user, message) {
- if (message.indexOf('!followers') === 0) {
- var channels = channel
- channels = channels.replace('#', '');
- $.getJSON('https://api.twitch.tv/kraken/channels/' + channels + '.json?callback=?', function(data) {
- var followers = data.followers
- client.say(channel, "Current Followers: " + followers);
- console.log("Followers for " + channel + " " + followers);
- });
- }
- });
Add Comment
Please, Sign In to add comment