Bots Home
|
Create an App
Naughty Words
Author:
codeanon_master
Description
Source Code
Launch Bot
Current Users
Created by:
Codeanon_Master
cb.settings_choices = [ {name: 'type', label: 'Applies to', type: 'choice', choice1: 'Greys', choice2: 'Everyone', defaultValue: 'Greys'}, {name: 'rep1', label: 'Replacement 1', type: 'str', defaultValue: 'bitch,whore,slut:lovely lady', required: false} ]; for (var i = 2; i < 21; i++) cb.settings_choices.push({name: 'rep' + i, label: 'Replacement ' + i, type: 'str', required: false}); var words = {}; for (var i = 1; i < 21; i++) { var line = cb.settings['rep' + i]; if (line) { line = line.toLowerCase(); var arr = line.split(':'); if (arr.length === 2) { var triggers = arr[0].split(',').map((obj) => obj.trim()); var result = arr[1].trim(); triggers.forEach((item) => words[item] = result); } } } function shouldBeCensored(msg) { return cb.settings.type === 'Everyone' || (cb.settings.type === 'Greys' && !hasImmunity(msg)); } function hasImmunity(msg) { return (msg['user'] === cb.room_slug || msg['is_mod'] || msg['has_tokens'] || msg['tipped_recently'] || msg['tipped_alot_recently'] || msg['tipped_tons_recently']); } cb.onMessage(function (msg) { if (shouldBeCensored(msg)) { for (var word in words) { msg.m = msg.m.replace(new RegExp('\\b' + word + 's?\\b', 'ig'), words[word]); } } return msg; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.