<commit_before>/*
 * Copyright (c) 2014, <NAME>, https://bitbucket.org/sgt-kabukiman/
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

var
	BasePlugin  = require('./Base.js'),
	TextMessage = require('./../TextMessage.js'),
	util        = require('util');

function CorePlugin() {
	BasePlugin.call(this);

	this.userMngr = null;
	this.botName  = null;
}

util.inherits(CorePlugin, BasePlugin);

CorePlugin.prototype.setup = function(kabukibot, eventDispatcher) {
	BasePlugin.prototype.setup.call(this, kabukibot, eventDispatcher);

	eventDispatcher.onText(null, this.onTextMessage.bind(this));
	eventDispatcher.onMode(null, this.onModeMessage.bind(this));
	eventDispatcher.onTwitch(null, this.onTwitchMessage.bind(this));

	this.userMngr = kabukibot.getUserManager();
	this.botName  = kabukibot.getBotName();
};

CorePlugin.prototype.onTextMessage = function(message) {
	var
		user     = message.getUser(),
		channel  = message.getChannel(),
		username = user.getName(),
		mngr     = this.userMngr;

	user.setSubscriber(mngr.takeSubscriber(channel, username));
	user.setTurbo(mngr.takeTurboUser(username));
	user.setTwitchStaff(mngr.takeTwitchStaff(username));
	user.setTwitchAdmin(mngr.takeTwitchAdmin(username));
	user.setEmoteSets(mngr.takeEmoteSets(username));
	user.setOperator(mngr.isOperator(username));
	user.setBot(username === this.botName);
};

CorePlugin.prototype.onTwitchMessage = function(message) {
	var
		channel  = message.getChannel(),<commit_msg>twitch admin/staff specialuser lines are only sent once per channel join<commit_after>/*
 * Copyright (c) 2014, <NAME>, https://bitbucket.org/sgt-kabukiman/
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

var
	BasePlugin  = require('./Base.js'),
	TextMessage = require('./../TextMessage.js'),
	util        = require('util');

function CorePlugin() {
	BasePlugin.call(this);

	this.userMngr = null;
	this.botName  = null;
}

util.inherits(CorePlugin, BasePlugin);

CorePlugin.prototype.setup = function(kabukibot, eventDispatcher) {
	BasePlugin.prototype.setup.call(this, kabukibot, eventDispatcher);

	eventDispatcher.onText(null, this.onTextMessage.bind(this));
	eventDispatcher.onMode(null, this.onModeMessage.bind(this));
	eventDispatcher.onTwitch(null, this.onTwitchMessage.bind(this));

	this.userMngr = kabukibot.getUserManager();
	this.botName  = kabukibot.getBotName();
};

CorePlugin.prototype.onTextMessage = function(message) {
	var
		user     = message.getUser(),
		channel  = message.getChannel(),
		username = user.getName(),
		mngr     = this.userMngr;

	user.setSubscriber(mngr.takeSubscriber(channel, username));
	user.setTurbo(mngr.takeTurboUser(username));
	user.setTwitchStaff(mngr.isTwitchStaff(username));
	user.setTwitchAdmin(mngr.isTwitchAdmin(username));
	user.setEmoteSets(mngr.takeEmoteSets(username));
	user.setOperator(mngr.isOperator(username));
	user.setBot(username === this.botName);
};

CorePlugin.prototype.onTwitchMessage = function(message) {
	var
		channel  = message.getChannel(),
{'fraction_non_alphanumeric': 0.13817187974491346, 'fraction_numerical': 0.0024293956878226543, 'mean_word_length': 5.262357414448669, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6770172', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1084, 'n_words': 187}