Bots Home
|
Create an App
Words Filter
Author:
xmwk
Description
Source Code
Launch Bot
Current Users
Created by:
Xmwk
cb.settings_choices = [ {name:'block_msg', type:'str', defaultValue:"", label: "Message to block (comma separated plus use lower case for better results)"} ]; muted_users = []; function removeItem(array, item){ for(var i in array){ if(array[i]==item){ array.splice(i,1); break; } } } cb.onMessage(function (msg) { if (cbjs.arrayContains(muted_users, msg['user'])) { msg['X-Spam'] = true; cb.sendNotice('Your message was removed as you were muted for using a forbidden word', msg['user']); return msg; } words = msg['m'].split(' '); if(msg['user'] == cb.room_slug){ msg['X-Spam'] = true; if (msg['m'][0] == '/' && words[0].toLowerCase() == '/wfunmute') { for (let i = 1; i < words.length; ++i) { cbjs.arrayRemove(muted_users, words[i]); } } else if(msg['m'][0] == '/' && words[0].toLowerCase() == '/wfmuted') { msg['X-Spam'] = true; reply = "The following users are muted:\n"; for (let i = 0; i < muted_users.length; ++i) { reply += (i + 1) + '- ' + muted_users[i] + "\n"; } cb.sendNotice(reply, cb.room_slug); } return msg; } filter = cb.settings.block_msg.split(','); for(w in words) { word = words[w]; word.replace('0', 'o'); word.replace('3', 'e'); word.replace('1', 'i'); word = word.toLowerCase(); if(cbjs.arrayContains(filter, word)) { msg['X-Spam'] = true; cb.sendNotice('Your message has been removed and you were muted for the usage of a forbidden word set by the performer: ' + word, msg['user']); muted_users.push(msg['user']); cb.sendNotice(msg['user'] + " has been muted for using a forbidden word set by the performer"); break; } } return msg; }); cb.onEnter(function(user) { words = cb.settings.block_msg.split(','); reply = 'Welcome ' + user['user'] + ' the following words have been forbidden by the performer:\n'; for(word in words) { reply += words[word] + '\n'; } reply += 'Using any of these words will result in you being muted'; cb.chatNotice(reply, user['user']) ; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.