Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parseEmotes: function(html, room) {
- if (html.indexOf('<div class=\'chat\'><small>') !== 0) return false;
- var emoteList = ["#freewolf", "feelsbd", "feelsbn", "feelspn", "feelsdd", "feelsgd", "feelsgn", "feelsmd", "feelsnv", "feelsok", "feelspika", "feelspink", "feelsrs", "feelssc", "fukya", "funnylol", "hmmface", "Kappa", "noface", "Obama", "oshet", "PJsalt", "trumpW", "Sanic", "wtfman", "xaa", "yayface", "yesface", "meGusta", "trollface", "Doge"];
- var initialLength = html.length;
- var usersearch = html.indexOf('</small><button name=\'parseCommand\' value=\'/user ') + 49
- var user = html.slice(usersearch).split('\' style=\'background:none;border:0;padding:0 5px 0 0;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:9pt;cursor:pointer\'><b><font color=')[0];
- if (toId(user) === toId(config.nick)) return false;
- var emoteCount = 0;
- var emoteStats = {};
- for (var j = 0; j < emoteList.length; j++) {
- var replacer = '" title="' + emoteList[j] + '" />';
- var newText = '';
- emoteStats[emoteList[j]] = 0;
- for (var i = 0; i < ~~(initialLength / replacer.length) + 1; i++) {
- if (html.indexOf(replacer) === -1) {
- break;
- }
- emoteStats[emoteList[j]]++;
- html = html.replace(replacer, '');
- emoteCount++;
- }
- }
- //parse flooding
- if (emoteStats) {
- if (!emoteFlooding[toId(user)]) {
- emoteFlooding[toId(user)] = 0;
- }
- emoteFlooding[toId(user)]++
- setTimeout(function() {
- emoteFlooding[toId(user)]--
- }.bind(this), FLOOD_MESSAGE_TIME);
- if (emoteFlooding[toId(user)] >= FLOOD_MESSAGE_NUM) {
- emoteCount = emoteFlooding[toId(user)];
- }
- }
- //moderation
- this.emoteModerate(emoteCount, user, room)
- },
- emoteModerate: function(count, user, room) {
- if (this.rankFrom(user, '+')) return false;
- if (!emoticonAbuse[toId(user)]) {
- emoticonAbuse[toId(user)] = 0
- }
- if (count < 3) return false;
- if (count > 2) {
- emoticonAbuse[toId(user)] = emoticonAbuse[toId(user)] + count;
- }
- var noModeration = fs.readFileSync('data/emotemoderation.txt').toString().split('\n');
- if (noModeration.indexOf('d|' + room) > -1) {
- return false;
- }
- if (count > 15) {
- if (this.hasRank(this.ranks[room], '@#&~')) {
- return this.talk(room, '/roomban ' + user + ', Emoticon Spam (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- else if (this.hasRank(this.ranks[room], '%')) {
- return this.talk(room, '/hourmute ' + user + ', Emoticon Spam (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- }
- //
- if (emoticonAbuse[toId(user)] > 150) {
- if (this.hasRank(this.ranks[room], '@#&~')) {
- return this.talk(room, '/roomban ' + user + ', Emoticon Spam (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- else if (this.hasRank(this.ranks[room], '%')) {
- return this.talk(room, '/hourmute ' + user + ', Emoticon Spam (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- }
- else if (emoticonAbuse[toId(user)] > 50 && emoticonAbuse[toId(user)] < 151) {
- if (this.hasRank(this.ranks[room], '%@#&~')) {
- return this.talk(room, '/hourmute ' + user + ', Please do not spam emoticons. (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- }
- else if (emoticonAbuse[toId(user)] > 6 && emoticonAbuse[toId(user)] < 51) {
- if (this.hasRank(this.ranks[room], '%@#&~')) {
- return this.talk(room, '/mute ' + user + ', Please do not abuse emoticons. (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- }
- else if (emoticonAbuse[toId(user)] > 2 && emoticonAbuse[toId(user)] < 7) {
- if (this.hasRank(this.ranks[room], '%@#&~')) {
- return this.talk(room, '/warn ' + user + ', Please use emoticons in moderation. (' + count + ' [' + emoticonAbuse[toId(user)] + '])');
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment