Bots Home
|
Create an App
SBC Chat Room Colorizer/Messager
Author:
salserobachaterocasinero
Description
Source Code
Launch Bot
Current Users
Created by:
Salserobachaterocasinero
/* [BOT] Title: "SBC Chat Room Colorizer/Messager" Author: SalseroBachateroCasinero Version: 1.0.0 (3/5/2016) This bot allows you to dictate what text and/or background colors apply to the various groups of users: broadcaster, moderators, fan club members, users with tokens, users who have tipped recently, big tippers, and super tippers, as well as a separate entry field for "unique" users that can be in any group, but will still be colored differently, regardless of their group. You can choose from several default colorizer styles or customize one specifically to your liking, allowing each group's text and/or background to be independently changed or left as the chat room default (by setting the corresponding field(s) to be empty). There is also a separate colorizer for the current "top tipper" that is optional and can be opted out of by the user if desired. Gray users are not addressed with this bot because they just aren't that important to bother with in my opinion. Included is a "special message" notification system between privileged users/groups as well as the chat room. Also included is a special "private message" system inside the chat room to interact with users who have tipped a specified number of tokens to get on the list and who then tip a certain number of tokens to stay on the list in communication via tip notes. Type '/sbc-crcm toggle' to toggle the chat room colorizer feature on and off. Type '/sbc-crcm toggle toptipper' to toggle the chat room colorizer feature for the "top tipper" on and off. Type '/sbc-crcm style' to see the current colorizer style in use. Type '/sbc-crcm style [X]' to change to a different colorizer style (where [X] is one of either 'white', 'light', 'normal', 'dark', or 'custom' -- which is based on your pre-existing startup values). Type '/sbc-crcm unique' to list the users who are on the 'unique users' colorizer list for the current session. Type '/sbc-crcm unique +[U]' or '/sbc-crcm unique -[U]' to respectively grant or revoke 'unique user' colorizer status for the current session (where [U] is the user's chat name). Type '/sbc-crcm toptipper [U]' to manually set the top tipper to be colorized (where [U] is the user's chat name). Type '/sbc-crcm messaging' to toggle the "special message" feature of this bot on or off. Type '/sbc-mltm moderators' to toggle command access for all moderators for the current session. <Broadcaster Only> Type '/sbc-mltm access' to list the users who currently have command access for the current session. <Broadcaster Only> Type '/sbc-mltm access +[U]' or '/sbc-mltm access -[U]' to respectively grant or revoke command access to a specific user for the current session (where [U] is the user's chat name). <Broadcaster Only> Type '/sbc-crcm stats' to view the running time for the current session. <Broadcaster Only> Type '/sbc-crcm help' if you forget the above commands. Type '![M]' (where [M] is the message) to send a "special message" (by notification) to the broadcaster only. Type '@[M]' (where [M] is the message) to send a "special message" (by notification) to the moderators only. Type '#[M]' (where [M] is the message) to send a "special message" (by notification) to the "always-allowed users" only. Type '$[M]' (where [M] is the message) to send a "special message" (by notification) to the fan club members only. Type '%[M]' (where [M] is the message) to send a "special message" (by notification) to the chat room. Type '~?' to see the 'private message' user lists for the current session. Type '~[U]~[M]' (where [U] is the user and [M] is the message) to send a 'private message' (by notification) to a specific user (with instructions to reply in a tip note if sent from the broadcaster). Type '~all:[M]' (where [M] is the message) to send a 'private message' (by notification) to all users who have tipped to get on the active 'private message' list at least once (with instructions to reply in a tip note if sent from the broadcaster). Type '~now:[M]' (where [M] is the message) to send a 'private message' (by notification) to all users who are currently on the active 'private message' list (with instructions to reply in a tip note if sent from the broadcaster). Type '=[M]' (where [M] is the message) to highlight a "special message" in the chat room (for when you need to say something that needs to stand out). */ var Code = { Name : 'SBC Chat Room Colorizer/Messager', // The name of the bot Version : '1.0.0 (3/5/2016)', // The current version of the bot Author : 'SalseroBachateroCasinero', // The author of this version of the bot // Don't change the author unless you've modified something! Command : 'sbc-crcm', // The "/" command of the bot }; /* ************************************************** */ var Debug = { Mode : false, Count : 1, Verbose : false }; /* ************************************************** */ var ShowDebugMessage = function (out) { if (Debug.Mode) { out = out.trim(); output = '<{{0}}> Debug ~ {{1}}: '; output = output.toReplace(String(Debug.Count).toPad(2), Code.Name); if (out.charAt(0) == '*') { cb.sendNotice(output + String(out.substring(1).trim()), Code.Author.toLowerCase(), '#FFFFFF', '#FF0000', 'bolder'); Debug.Count++; } else if (Debug.Verbose) { cb.sendNotice(output + String(out), Code.Author.toLowerCase(), '#FFFFFF', '#7F0000', 'bolder'); Debug.Count++; }; }; return Debug.Mode; }; String.prototype.toReplace = function () { var newString = String(this); for (idx=0;idx<arguments.length;idx++) { newString = newString.replace('{{' + idx + '}}', arguments[idx]); }; return String(newString); }; String.prototype.toLowerCaseTrim = function () { return String(this).toLowerCase().trim(); }; String.prototype.toPad = function (digits) { var newString = String(this); while (newString.length < digits) { newString = '0' + newString; }; return newString; }; Array.prototype.toCheckIfExists = function (what) { for (i=0;i<this.length;i++) { if (this[i] == what) { return true; }; }; }; Array.prototype.toAddAndSort = function (what) { this.push(what); this.sort(); }; Array.prototype.toRemoveAndSort = function (what) { for (i=this.length-1;i>=0;i--) { if (this[i] == what) { this.splice(i, 1); }; }; this.sort(); }; var Identification = '{{0}} v{{1}} by {{2}}'.toReplace(Code.Name, Code.Version, Code.Author); var FormatCommand = function (info,doublespace) { var newString = "Type '/{{0}} {{1}}" + '\n'; if (doublespace) { newString += '\n'; }; return String(newString.toReplace(Code.Command, info)); }; var Command = { Toggle : 'toggle', TopTipper : 'toptipper', Style : { Check : 'style', White : 'white', Light : 'light', Normal : 'normal', Dark : 'dark', Custom : 'custom' }, Unique : { Usage : 'unique', Grant : '+', Revoke : '-' }, TopTipper : 'toptipper', Messager : 'messager', Access : { Moderator : 'moderators', Usage : 'access', Grant : '+', Revoke : '-' }, Stats : 'stats', Help : 'help' }; var CommandList = '\n'; CommandList += FormatCommand("{{0}}' to toggle this bot on or off.".toReplace(Command.Toggle), true); CommandList += FormatCommand("{{0}} {{1}}' to toggle the 'top tipper' colorizing feature on or off.".toReplace(Command.Toggle, Command.TopTipper), true); CommandList += FormatCommand("{{0}}' to see the current colorizer style in use.".toReplace(Command.Style.Check), false); CommandList += FormatCommand("{{0}} [X]' to change to a different colorizer style (where [X] is one of either '{{1}}', '{{2}}', '{{3}}', '{{4}}', or '{{5}}' -- which is based on your pre-existing startup values).".toReplace(Command.Style.Check, Command.Style.White, Command.Style.Light, Command.Style.Normal, Command.Style.Dark, Command.Style.Custom), true); CommandList += FormatCommand("{{0}}' to list the users who are on the 'unique users' colorizer list for the current session.".toReplace(Command.Unique.Usage), false); CommandList += FormatCommand("{{0}} {{1}}[U]' or '/{{2}} {{3}} {{4}}[U]' to respectively grant or revoke 'unique user' colorizer status for the current session (where [U] is the user's chat name).".toReplace(Command.Unique.Usage, Command.Unique.Grant, Code.Command, Command.Unique.Usage, Command.Unique.Revoke), true); CommandList += FormatCommand("{{0}} [U]' to manually set the top tipper to be colorized (where [U] is the user's chat name).".toReplace(Command.TopTipper), true); CommandList += FormatCommand("{{0}}' to toggle the 'special message' feature of this bot on or off.".toReplace(Command.Messager), true); CommandList += FormatCommand("{{0}}' to toggle command access for all moderators for the current session. <Broadcaster Only>".toReplace(Command.Access.Moderator), true); CommandList += FormatCommand("{{0}}' to list the users who currently have command access for the current session. <Broadcaster Only>".toReplace(Command.Access.Usage), false); CommandList += FormatCommand("{{0}} {{1}}[U]' or '/{{2}} {{3}} {{4}}[U]' to respectively grant or revoke command access to a specific user for the current session (where [U] is the user's chat name). <Broadcaster Only>".toReplace(Command.Access.Usage, Command.Access.Grant, Code.Command, Command.Access.Usage, Command.Access.Revoke), true); CommandList += FormatCommand("{{0}}' to view the running time for the current session. <Broadcaster Only>".toReplace(Command.Stats), true); CommandList += FormatCommand("{{0}}' if you forget the above commands.".toReplace(Command.Help), false); var FormatPrivacy = function (info,doublespace) { var newString = "Type '{{0}}" + '\n'; if (doublespace) { newString += '\n'; }; return String(newString.toReplace(info)); }; var Privacy = { toActualBroadcaster : '!', toModerators : '@', toAlwaysAllowedUsers : '#', toFanClubMembers : '$', toEveryone : '%', PrivateMessage : { Usage : '~', toUser : '~', toEverListed : 'all:', toNowListed : 'now:', ShowUserLists : '?' }, asChatMessage : '=' }; var PrivacyList = '\n'; PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to send a 'special message' (by notification) to the broadcaster only.".toReplace(Privacy.toActualBroadcaster), false); PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to send a 'special message' (by notification) to the moderators only.".toReplace(Privacy.toModerators), false); PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to send a 'special message' (by notification) to the 'always-allowed users' only.".toReplace(Privacy.toAlwaysAllowedUsers), false); PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to send a 'special message' (by notification) to the fan club members only.".toReplace(Privacy.toFanClubMembers), false); PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to send a 'special message' (by notification) to the chat room.".toReplace(Privacy.toEveryone), true); PrivacyList += FormatPrivacy("{{0}}{{1}}' to see the 'private message' user lists for the current session.".toReplace(Privacy.PrivateMessage.Usage, Privacy.PrivateMessage.ShowUserLists), true); PrivacyList += FormatPrivacy("{{0}}[U]{{1}}[M]' (where [U] is the user and [M] is the message) to send a 'private message' (by notification) to a specific user (with instructions to reply in a tip note if sent from the broadcaster).".toReplace(Privacy.PrivateMessage.Usage, Privacy.PrivateMessage.toUser), true); PrivacyList += FormatPrivacy("{{0}}{{1}}[M]' (where [M] is the message) to send a 'private message' (by notification) to all users who have tipped to get on the active 'private message' list at least once (with instructions to reply in a tip note if sent from the broadcaster).".toReplace(Privacy.PrivateMessage.Usage, Privacy.PrivateMessage.toEverListed), false); PrivacyList += FormatPrivacy("{{0}}{{1}}[M]' (where [M] is the message) to send a 'private message' (by notification) to all users who are currently on the active 'private message' list (with instructions to reply in a tip note if sent from the broadcaster).".toReplace(Privacy.PrivateMessage.Usage, Privacy.PrivateMessage.toNowListed), true); PrivacyList += FormatPrivacy("{{0}}[M]' (where [M] is the message) to highlight a 'special' message in the chat room (for when you need to say something much more important).".toReplace(Privacy.asChatMessage), false); var HelpNotification = '\n' + '*** {{0}} ***' + '\n'; HelpNotification += '{{1}}' + '\n' + '{{2}}'; HelpNotification = HelpNotification.toReplace(Identification, CommandList, PrivacyList); cb.settings_choices = [ { name: 'support', type: 'choice', label: "Enable support mode?", choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'moderation', type: 'choice', label: "Allow moderators to access this feature?", choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'alwaysallowedusers', type: 'str', required: false, label: 'List of users that will have feature access at all times, regardless of moderator status or the previous question (separate with ; for more than 1 or leave blank for none)', defaultValue: '' }, { name: 'noticebackground', type: 'str', label: 'Notification background color in hex #RrGgBb format (default is white / #FFFFFF)', defaultValue: '#FFFFFF' }, { name: 'noticetext', type: 'str', label: 'Notification text color in hex #RrGgBb format (default is red / #FF0000)', defaultValue: '#FF0000' }, { name: 'noticeweight', type: 'choice', label: 'Notification weight', choice1: 'Normal', choice2: 'Bold', choice3: 'Bolder', defaultValue: 'Bolder' }, { name: 'colorizer', type: 'choice', label: "Enable the colorizer feature by default?", choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'colorizerstyle', type: 'choice', label: "Choose your default colorizer style", choice1: 'White', choice2: 'Light', choice3: 'Normal', choice4: 'Dark', choice5: 'Custom', defaultValue: 'White' }, { name: 'colorizerselfbackground', type: 'str', required: false, label: "Broadcaster's chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizerselftext', type: 'str', required: false, label: "Broadcaster's chat text color in hex #RrGgBb format (default is orange / #DC5500)", defaultValue: '#DC5500' }, { name: 'colorizermodbackground', type: 'str', required: false, label: "Moderators' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizermodtext', type: 'str', required: false, label: "Moderators' chat text color in hex #RrGgBb format (default is red / #DC0000)", defaultValue: '#DC0000' }, { name: 'colorizerfanbackground', type: 'str', required: false, label: "Fan club members' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizerfantext', type: 'str', required: false, label: "Fan club members' chat text color in hex #RrGgBb format (default is green / #009900)", defaultValue: '#009900' }, { name: 'colorizertokensbackground', type: 'str', required: false, label: "Token owners' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizertokenstext', type: 'str', required: false, label: "Token owners' chat text color in hex #RrGgBb format (default is light blue / #6699AA)", defaultValue: '#6699AA' }, { name: 'colorizerrecentbackground', type: 'str', required: false, label: "Recent tippers' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizerrecenttext', type: 'str', required: false, label: "Recent tippers' chat text color in hex #RrGgBb format (default is dark blue / #000099)", defaultValue: '#000099' }, { name: 'colorizerbigbackground', type: 'str', required: false, label: "Big tippers' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizerbigtext', type: 'str', required: false, label: "Big tippers' chat text color in hex #RrGgBb format (default is light purple / #BE6AFF)", defaultValue: '#BE6AFF' }, { name: 'colorizersuperbackground', type: 'str', required: false, label: "Super tippers' chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizersupertext', type: 'str', required: false, label: "Super tippers' chat text color in hex #RrGgBb format (default is dark purple / #804BAA)", defaultValue: '#804BAA' }, { name: 'uniqueusers', type: 'str', required: false, label: 'List of users that will be uniquely colorized, regardless of the group they are in (separate with ; for more than 1 or leave blank for none)', defaultValue: '' }, { name: 'colorizeruniquebackground', type: 'str', required: false, label: "'Unique' users' (listed above) chat background color in hex #RrGgBb format (default is white / #FFFFFF)", defaultValue: '#FFFFFF' }, { name: 'colorizeruniquetext', type: 'str', required: false, label: "'Unique' users' (listed above) chat text color in hex #RrGgBb format (default is mustard / #555500)", defaultValue: '#555500' }, { name: 'colorizetoptipper', type: 'choice', label: "Colorize the current 'top tipper' separately?", choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'colorizertoptipperbackground', type: 'str', required: false, label: "Current 'top tipper' (this session) chat background color in hex #RrGgBb format (default is yellow / #FFDF00)", defaultValue: '#FFDF00' }, { name: 'colorizertoptippertext', type: 'str', required: false, label: "Current 'top tipper' (this session) chat text color in hex #RrGgBb format (default is black / #000000)", defaultValue: '#000000' }, { name: 'messaging', type: 'choice', label: "Enable the 'special message' feature by default?", choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'pmstartmode', type: 'choice', label: "Must the user tip the exact amount in the next question to get on the active 'private message' list for the first time (a 'no' would mean it to be a minimum)?", choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'pmstart', type: 'int', label: "How many tokens (exact or minimum, depending on the previous question) to get on the active 'private message' list for the first time?", minValue: 1, defaultValue: 50 }, { name: 'pmcontinue', type: 'int', label: "How many tokens (minimum) to stay on (or get back on) the active 'private message' list?", minValue: 1, defaultValue: 10 } ]; var Settings = { SupportMode : cb.settings['support'] == 'Yes', // Moderators "Allowed" To Use This? // ModeratorsAllowed : cb.settings['moderation'] == 'Yes', // Moderators "Allowed" To Use This? // // Users "Always Allowed" To Use This // AlwaysAllowedUsers : cb.settings['alwaysallowedusers'] == null ? [] : cb.settings['alwaysallowedusers'].length == 0 ? [] : cb.settings['alwaysallowedusers'].split(';'), // Users "Always Allowed" To Use This // NotificationStyle : { Background : cb.settings['noticebackground'], Text : cb.settings['noticetext'], Weight : cb.settings['noticeweight'] }, ColorizerStatus : cb.settings['colorizer'] == 'Yes', ColorizerStyle : { White : cb.settings['colorizerstyle'] == 'White', Light : cb.settings['colorizerstyle'] == 'Light', Normal : cb.settings['colorizerstyle'] == 'Normal', Dark : cb.settings['colorizerstyle'] == 'Dark', Custom : cb.settings['colorizerstyle'] == 'Custom' }, ColorizeTopTipper : cb.settings['colorizetoptipper'] == 'Yes', // Users "Uniquely Colorized" // ColorizerUniqueUsers : cb.settings['uniqueusers'] == null ? [] : cb.settings['uniqueusers'].length == 0 ? [] : cb.settings['uniqueusers'].split(';'), // Users "Uniquely Colorized" // ColorizerColors : { TokenOwnerBackground : cb.settings['colorizertokensbackground'], TokenOwnerText : cb.settings['colorizertokenstext'], TipperBackground : cb.settings['colorizerrecentbackground'], TipperText : cb.settings['colorizerrecenttext'], BigTipperBackground : cb.settings['colorizerbigbackground'], BigTipperText : cb.settings['colorizerbigtext'], SuperTipperBackground : cb.settings['colorizersuperbackground'], SuperTipperText : cb.settings['colorizersupertext'], FanClubMemberBackground : cb.settings['colorizerfanbackground'], FanClubMemberText : cb.settings['colorizerfantext'], ModeratorsBackground : cb.settings['colorizermodbackground'], ModeratorsText : cb.settings['colorizermodtext'], ActiveBroadcasterBackground : cb.settings['colorizerselfbackground'], ActiveBroadcasterText : cb.settings['colorizerselftext'], UniqueUsersBackground : cb.settings['colorizeruniquebackground'], UniqueUsersText : cb.settings['colorizeruniquetext'], TopTipperBackground : cb.settings['colorizertoptipperbackground'], TopTipperText : cb.settings['colorizertoptippertext'] }, MessagerStatus : cb.settings['messaging'] == 'Yes', ExactAmountNeeded : cb.settings['pmstartmode'] == "Yes", AmountToGetOnPMList : parseInt(cb.settings['pmstart']), AmountToStayOnPMList : parseInt( cb.settings['pmcontinue']) / cb.settings['pmcontinue'] }; Settings.AlwaysAllowedUsers.sort(); var ShowUserAccessList = function () { output = '\n' + "All users with command access for the current session:"; var usernames = ''; for (i=0;i<Settings.AlwaysAllowedUsers.length;i++) { usernames += '\n' + ' * {{0}}'; usernames = usernames.toReplace(Settings.AlwaysAllowedUsers[i]); }; output += usernames == '' ? ' [NONE]' : usernames; output += '\n'; SendTo.Default(output, CurrentUser); }; var SetUserAccess = function (doadd, user) { if (doadd) { if (!(Settings.AlwaysAllowedUsers.toCheckIfExists(user))) { // Add (By Explicit Command), But Only If User Doesn't Already Exist In List Settings.AlwaysAllowedUsers.toAddAndSort(user); }; } else { if (Settings.AlwaysAllowedUsers.toCheckIfExists(user)) { // Remove (By Explicit Command), But Only If User Already Exists In List Settings.AlwaysAllowedUsers.toRemoveAndSort(user); }; }; }; var Moderators = []; var SetModeratorStatus = function (msg) { if (UserIs.Moderator(msg)) { if (!(Moderators.toCheckIfExists(CurrentUser))) { // Add If Moderator, But Only If User Doesn't Already Exist In List Moderators.toAddAndSort(CurrentUser); }; } else { if (Moderators.toCheckIfExists(CurrentUser)) { // Remove If No Longer Moderator, But Only If User Already Exists In List Moderators.toRemoveAndSort(CurrentUser); }; }; }; var Broadcaster = { Actual : cb['room_slug'], Active : (Settings.SupportMode ? Code.Author.toLowerCase() : cb['room_slug']) }; var CurrentUser = ''; Settings.ColorizerUniqueUsers.sort(); var ShowUniqueUsersList = function () { output = '\n' + "All users with command access for the current session:"; var usernames = ''; for (i=0;i<Settings.ColorizerUniqueUsers.length;i++) { usernames += '\n' + ' * {{0}}'; usernames = usernames.toReplace(Settings.ColorizerUniqueUsers[i]); }; output += usernames == '' ? ' [NONE]' : usernames; output += '\n'; SendTo.Default(output, CurrentUser); }; var SetUniqueUser = function (doadd, user) { if (doadd) { if (!(Settings.ColorizerUniqueUsers.toCheckIfExists(user))) { // Add (By Explicit Command), But Only If User Doesn't Already Exist In List Settings.ColorizerUniqueUsers.toAddAndSort(user); }; } else { if (Settings.ColorizerUniqueUsers.toCheckIfExists(user)) { // Remove (By Explicit Command), But Only If User Already Exists In List Settings.ColorizerUniqueUsers.toRemoveAndSort(user); }; }; }; var UserIs = []; // User Specified Is The Current User // UserIs.ThisUser = function (CompareUser) { return CurrentUser == CompareUser; }; // User Specified Is The Current User // // User Is The Author // UserIs.Author = function () { return UserIs.ThisUser(Code.Author.toLowerCase()); }; // User Is The Author // // User Is The Actual Broadcaster // UserIs.ActualBroadcaster = function () { return UserIs.ThisUser(Broadcaster.Actual); }; // User Is The Actual Broadcaster // // User Is The Active Broadcaster (Spoofed To Author When Support Mode Is Active) // UserIs.ActiveBroadcaster = function () { return UserIs.ThisUser(Broadcaster.Active); }; // User Is The Active Broadcaster (Spoofed To Author When Support Mode Is Active) // // User Exists In The "Always-Allowed Users" List // UserIs.AlwaysAllowed = function () { if (Settings.SupportMode && UserIs.ActualBroadcaster()) { return true; }; return Settings.AlwaysAllowedUsers.toCheckIfExists(CurrentUser); }; // User Exists In The "Always-Allowed Users" List // // User Is An "Allowed" Moderator // UserIs.AllowedModerator = function (msg) { return (UserIs.Moderator(msg) && Settings.ModeratorsAllowed); }; // User Is An "Allowed" Moderator // // User Is A Moderator // UserIs.Moderator = function (msg) { return msg['is_mod']; }; // User Is A Moderator // // User Is A Fan Club Member // UserIs.FanClubMember = function (msg) { return msg['in_fanclub']; }; // User Is A Fan Club Member // // User Is A Super Tipper // UserIs.SuperTipper = function (msg) { return msg['tipped_tons_recently']; }; // User Is A Super Tipper // // User Is A Big Tipper // UserIs.BigTipper = function (msg) { return msg['tipped_alot_recently']; }; // User Is A Big Tipper // // User Is A Tipper // UserIs.Tipper = function (msg) { return msg['tipped_recently']; }; // User Is A Tipper // // User Is A Token Owner // UserIs.TokenOwner = function (msg) { return msg['has_tokens']; }; // User Is A Token Owner // // User Is Gray // UserIs.Gray = function (user) { return ((!(UserIs.TokenOwner(user))) && (!(UserIs.FanClubMember(user))) && (!(UserIs.Moderator(user))) && (!(UserIs.AlwaysAllowed())) && (!(UserIs.Code.Author.toLowerCase())) && (!(UserIs.ActualBroadcaster()))); }; // User Is Gray // // User Exists In The "Unique Users" To Colorizer List // UserIs.ColorizerUnique = function () { if (Settings.SupportMode && UserIs.ActualBroadcaster()) { return true; }; return Settings.ColorizerUniqueUsers.toCheckIfExists(CurrentUser); }; // User Exists In The "Unique Users" To Colorizer List // var SendTo = []; // Send Notice To User/Group As Indicated // SendTo.Default = function (msg,user,group) { if (group == null || group == '') { cb.sendNotice(msg, user, Settings.NotificationStyle.Background, Settings.NotificationStyle.Text, Settings.NotificationStyle.Weight); } else { cb.sendNotice(msg, user, Settings.NotificationStyle.Background, Settings.NotificationStyle.Text, Settings.NotificationStyle.Weight, group); }; }; // Send Notice To User/Group As Indicated // // Send Notice To "Important" Users // SendTo.ImportantUsers = function (msg) { // Send Notice To Actual Broadcaster // SendTo.Default(msg, Broadcaster.Actual); var TestForAuthor = Broadcaster.Actual == Code.Author.toLowerCase(); // Send Notice To Actual Broadcaster // // Send Notice To "Moderators" (Array-Based) ~ As Long As They Aren't On The "Always-Allowed Users" List // for (i=0;i<Moderators.length;i++) { if (!(Settings.AlwaysAllowedUsers.toCheckIfExists(Moderators[i]))) { SendTo.Default(msg, Moderators[i]); }; if (!(TestForAuthor)) { TestForAuthor = Moderators[i] == Code.Author.toLowerCase(); }; } // Send Notice To "Moderators" (Array-Based) ~ As Long As They Aren't On The "Always-Allowed Users" List // // Send Notice To "Always-Allowed Users" // for (i=0;i<Settings.AlwaysAllowedUsers.length;i++) { SendTo.Default(msg, Settings.AlwaysAllowedUsers[i].toLowerCaseTrim()); if (!(TestForAuthor)) { TestForAuthor = Settings.AlwaysAllowedUsers[i] == Code.Author.toLowerCase(); }; }; // Send Notice To "Always-Allowed Users" // // Send Notice To Author // if (Settings.SupportMode && (!(TestForAuthor))) { SendTo.Default(msg, Code.Author.toLowerCase()); }; // Send Notice To Author // }; // Send Notice To "Important" Users // // Send Notice To "Always-Allowed Users" // SendTo.AlwaysAllowedUsers = function (msg,bg,fg,wt) { for (i=0;i<Settings.AlwaysAllowedUsers.length;i++) { cb.sendNotice(msg, Settings.AlwaysAllowedUsers[i].toLowerCaseTrim(), bg, fg, wt); }; }; // Send Notice To "Always-Allowed Users" // // Send Notice To "Moderators" (Array-Based) // SendTo.Moderators = function (msg,bg,fg,wt) { for (i=0;i<Moderators.length;i++) { cb.sendNotice(msg, Moderators[i], bg, fg, wt); }; }; // Send Notice To "Moderators" (Array-Based) // // Send Special Case // SendTo.Special = function (msg,user,group) { cb.sendNotice(msg, user, '#FFFFFF', '#FF0000', 'bolder', group); }; // Send Special Case // // Send Notice To Users On PM User List // SendTo.PMUserList = function (what,which,bg,fg,wt) { /* ************************************************** */ ShowDebugMessage("* SendTo.PMUserList(what,which,bg,fg,wt)"); /* ************************************************** */ if (which == Privacy.PrivateMessage.toEverListed) { for (i=0;i<PMUserStart.length;i++) { cb.sendNotice(what, PMUserStart[i], bg, fg, wt); }; } else if (which == Privacy.PrivateMessage.toNowListed) { for (i=0;i<PMUserContinue.length;i++) { cb.sendNotice(what, PMUserContinue[i], bg, fg, wt); }; }; /* ************************************************** */ ShowDebugMessage("* SendTo.PMUserList(what,which,bg,fg,wt) Complete"); /* ************************************************** */ }; // Send Notice To Users On PM User List // // Do PM User List // var DoPMUserList = []; // Build PM User List // var PMUserStart = []; var PMUserContinue = []; DoPMUserList.Build = function () { /* ************************************************** */ ShowDebugMessage("* DoPMUserList.Build()"); /* ************************************************** */ var StartCheck = Settings.ExactAmountNeeded ? LastTipAmount == Settings.AmountToGetOnPMList : LastTipAmount >= Settings.AmountToGetOnPMList; /* ************************************************** */ ShowDebugMessage("StartCheck=" + StartCheck); /* ************************************************** */ var IsOnStartList = PMUserStart.toCheckIfExists(LastTipper); // Check To See If User Is Already On The List /* ************************************************** */ ShowDebugMessage("IsOnStartList=" + IsOnStartList); /* ************************************************** */ if (StartCheck) { // User Tipped The Exact/Minimum Amount To Get On The List For The First Time if (!(IsOnStartList)) { PMUserStart.toAddAndSort(LastTipper); IsOnStartList = PMUserStart.toCheckIfExists(LastTipper); /* ************************************************** */ ShowDebugMessage("Added User To PMUserStart List: " + LastTipper); ShowDebugMessage("IsOnStartList=" + IsOnStartList); /* ************************************************** */ }; }; /* ************************************************** */ ShowDebugMessage("PMUserStart=" + PMUserStart); /* ************************************************** */ var ContinueCheck = LastTipAmount >= Settings.AmountToStayOnPMList; /* ************************************************** */ ShowDebugMessage("ContinueCheck=" + ContinueCheck); /* ************************************************** */ if (IsOnStartList) { var IsOnContinueList = PMUserContinue.toCheckIfExists(LastTipper); // Check To See If User Is Already On The List /* ************************************************** */ ShowDebugMessage("IsOnContinueList=" + IsOnContinueList); /* ************************************************** */ if (ContinueCheck) { // User Tipped The Minimum Amount To Stay On The List if (!(IsOnContinueList)) { PMUserContinue.toAddAndSort(LastTipper); IsOnContinueList = PMUserContinue.toCheckIfExists(LastTipper); /* ************************************************** */ ShowDebugMessage("Added User To PMUserContinue List: " + LastTipper); ShowDebugMessage("IsOnContinueList=" + IsOnContinueList); /* ************************************************** */ }; } else { // Remove User For Not Tipping Enough To Stay On The List PMUserContinue.toRemoveAndSort(LastTipper); IsOnContinueList = PMUserContinue.toCheckIfExists(LastTipper); /* ************************************************** */ ShowDebugMessage("Removed User From PMUserContinue List: " + LastTipper); ShowDebugMessage("IsOnContinueList=" + IsOnContinueList); /* ************************************************** */ }; /* ************************************************** */ ShowDebugMessage("PMUserContinue=" + PMUserContinue); /* ************************************************** */ }; /* ************************************************** */ ShowDebugMessage("* DoPMUserList.Build() Complete"); /* ************************************************** */ }; // Build PM User List // // Show PM User List // DoPMUserList.Show = function () { /* ************************************************** */ ShowDebugMessage("* DoPMUserList.Show()"); /* ************************************************** */ output = '\n' + "All users *ever* on the 'private message' list (tipped exact/minimum amount once to start):"; var usernames = ''; for (i=0;i<PMUserStart.length;i++) { usernames += '\n' + ' * {{0}}'; usernames = usernames.toReplace(PMUserStart[i]); }; output += usernames == '' ? ' [EMPTY]' : usernames; output += '\n\n' + "All users *currently* on the 'private message' list (last tip above minimum amount):"; usernames = ''; for (i=0;i<PMUserContinue.length;i++) { usernames += '\n' + ' * {{0}}'; usernames = usernames.toReplace(PMUserContinue[i]); }; output += usernames == '' ? ' [EMPTY]' : usernames; output += '\n'; SendTo.Default(output, CurrentUser); /* ************************************************** */ ShowDebugMessage("* DoPMUserList.Show() Complete"); /* ************************************************** */ }; // Show PM User List // // Do PM User List // // Feature Functions // var Feature = []; // Colorizer Feature // Feature.Colorizer = function (msg) { /* ************************************************** */ ShowDebugMessage("* Feature.Colorizer(msg)"); ShowDebugMessage("Settings.ColorizerStyle=" + Settings.ColorizerStyle); /* ************************************************** */ if (Settings.ColorizerStyle.White) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle.White=" + Settings.ColorizerStyle.White); /* ************************************************** */ if (UserIs.TokenOwner(msg) || UserIs.FanClubMember(msg) || UserIs.Moderator(msg) || UserIs.ActiveBroadcaster() || UserIs.ColorizerUnique()) { msg['background'] = '#FFFFFF'; }; } else if (Settings.ColorizerStyle.Light) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle.Light=" + Settings.ColorizerStyle.Light); /* ************************************************** */ if (UserIs.TokenOwner(msg)) { msg['background'] = '#F9FDFF'; }; if (UserIs.Tipper(msg)) { msg['background'] = '#EFEFFF'; }; if (UserIs.BigTipper(msg)) { msg['background'] = '#FBF6FF'; }; if (UserIs.SuperTipper(msg)) { msg['background'] = '#FBF6FF'; }; if (UserIs.FanClubMember(msg)) { msg['background'] = '#EFFFEF'; }; if (UserIs.Moderator(msg)) { msg['background'] = '#FFEFEF'; }; if (UserIs.ActiveBroadcaster()) { msg['background'] = '#FFF5EF'; }; if (UserIs.ColorizerUnique()) { msg['background'] = '#FFFFEF'; }; } else if (Settings.ColorizerStyle.Normal) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle.Normal=" + Settings.ColorizerStyle.Normal); /* ************************************************** */ if (UserIs.TokenOwner(msg)) { msg['background'] = '#F2FCFF'; }; if (UserIs.Tipper(msg)) { msg['background'] = '#DFDFFF'; }; if (UserIs.BigTipper(msg)) { msg['background'] = '#F7ECFF'; }; if (UserIs.SuperTipper(msg)) { msg['background'] = '#F7EDFF'; }; if (UserIs.FanClubMember(msg)) { msg['background'] = '#DFFFDF'; }; if (UserIs.Moderator(msg)) { msg['background'] = '#FFDFDF'; }; if (UserIs.ActiveBroadcaster()) { msg['background'] = '#FFEBDF'; }; if (UserIs.ColorizerUnique()) { msg['background'] = '#FFFFDF'; }; } else if (Settings.ColorizerStyle.Dark) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle.Dark=" + Settings.ColorizerStyle.Dark); /* ************************************************** */ if (UserIs.TokenOwner(msg)) { msg['background'] = '#ECFAFF'; }; if (UserIs.Tipper(msg)) { msg['background'] = '#CFCFFF'; }; if (UserIs.BigTipper(msg)) { msg['background'] = '#F3E3FF'; }; if (UserIs.SuperTipper(msg)) { msg['background'] = '#F3E4FF'; }; if (UserIs.FanClubMember(msg)) { msg['background'] = '#CFFFCF'; }; if (UserIs.Moderator(msg)) { msg['background'] = '#FFCFCF'; }; if (UserIs.ActiveBroadcaster()) { msg['background'] = '#FFE2CF'; }; if (UserIs.ColorizerUnique()) { msg['background'] = '#FFFFCF'; }; }; if (Settings.ColorizerStyle.White || Settings.ColorizerStyle.Light || Settings.ColorizerStyle.Normal || Settings.ColorizerStyle.Dark) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle (Not Custom)"); /* ************************************************** */ if (UserIs.TokenOwner(msg)) { msg['c'] = '#6699AA'; }; if (UserIs.Tipper(msg)) { msg['c'] = '#000099'; }; if (UserIs.BigTipper(msg)) { msg['c'] = '#BE6AFF'; }; if (UserIs.SuperTipper(msg)) { msg['c'] = '#804BAA'; }; if (UserIs.FanClubMember(msg)) { msg['c'] = '#009900'; }; if (UserIs.Moderator(msg)) { msg['c'] = '#DC0000'; }; if (UserIs.ActiveBroadcaster()) { msg['c'] = '#DC5500'; }; if (UserIs.ColorizerUnique()) { msg['c'] = '#555500'; }; } else if (Settings.ColorizerStyle.Custom) { /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStyle.Custom=" + Settings.ColorizerStyle.Custom); /* ************************************************** */ if (UserIs.TokenOwner(msg)) { msg['background'] = Settings.ColorizerColors.TokenOwnerBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.TokenOwnerBackground; msg['c'] = Settings.ColorizerColors.TokenOwnerText.trim() == '' ? msg['c'] : Settings.ColorizerColors.TokenOwnerText; }; if (UserIs.Tipper(msg)) { msg['background'] = Settings.ColorizerColors.TipperBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.TipperBackground; msg['c'] = Settings.ColorizerColors.TipperText.trim() == '' ? msg['c'] : Settings.ColorizerColors.TipperText; }; if (UserIs.BigTipper(msg)) { msg['background'] = Settings.ColorizerColors.BigTipperBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.BigTipperBackground; msg['c'] = Settings.ColorizerColors.BigTipperText.trim() == '' ? msg['c'] : Settings.ColorizerColors.BigTipperText; }; if (UserIs.SuperTipper(msg)) { msg['background'] = Settings.ColorizerColors.SuperTipperBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.SuperTipperBackground; msg['c'] = Settings.ColorizerColors.SuperTipperText.trim() == '' ? msg['c'] : Settings.ColorizerColors.SuperTipperText; }; if (UserIs.FanClubMember(msg)) { msg['background'] = Settings.ColorizerColors.FanClubMemberBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.FanClubMemberBackground; msg['c'] = Settings.ColorizerColors.FanClubMemberText.trim() == '' ? msg['c'] : Settings.ColorizerColors.FanClubMemberText; }; if (UserIs.Moderator(msg)) { msg['background'] = Settings.ColorizerColors.ModeratorsBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.ModeratorsBackground; msg['c'] = Settings.ColorizerColors.ModeratorsText.trim() == '' ? msg['c'] : Settings.ColorizerColors.ModeratorsText; }; if (UserIs.ActiveBroadcaster()) { msg['background'] = Settings.ColorizerColors.ActiveBroadcasterBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.ActiveBroadcasterBackground; msg['c'] = Settings.ColorizerColors.ActiveBroadcasterText.trim() == '' ? msg['c'] : Settings.ColorizerColors.ActiveBroadcasterText; }; if (UserIs.ColorizerUnique()) { msg['background'] = Settings.ColorizerColors.UniqueUsersBackground.trim() == '' ? msg['background'] : Settings.ColorizerColors.UniqueUsersBackground; msg['c'] = Settings.ColorizerColors.UniqueUsersText.trim() == '' ? msg['c'] : Settings.ColorizerColors.UniqueUsersText; }; }; if (Settings.ColorizeTopTipper) { /* ************************************************** */ ShowDebugMessage("Colorize Top Tipper"); /* ************************************************** */ if (UserIs.ThisUser(TopTipper)) { /* ************************************************** */ ShowDebugMessage("Top Tipper Has Not Opted Out"); /* ************************************************** */ msg['background'] = Settings.ColorizerColors.TopTipperBackground; msg['c'] = Settings.ColorizerColors.TopTipperText; }; }; /* ************************************************** */ ShowDebugMessage("* Feature.Colorizer(msg) Complete"); /* ************************************************** */ }; // Colorizer Feature // // Manually Set Top Tipper // Feature.ManuallySetTipper = function (tipper, tippedamount) { if (tippedamount > TopTipAmount) { TopTipAmount = tippedamount; if (TopTipperOpt != tipper) { TopTipperOpt = tipper; TopTipperOptOut[tipper] = TopTipperOptOut[tipper] ? true : false; TopTipper = TopTipperOptOut[tipper] ? null : TopTipperOpt; output = '\n'; output += '{{0}}: Congratulations!' + '\n\n'; output += "You are now the 'top tipper' for this session and will have a unique color in the chat room until you are overtaken by a new user. If you would prefer to opt-out of this feature, type '/optout' in the chat room. If you change your mind, you can opt back in by typing '/optin'." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, TopTipper) }; }; }; // Manually Set Top Tipper // // Messager Feature // Feature.Messager = function (CommandParamaters,msg) { switch (CommandParamaters[0].charAt(0)) { case Privacy.toActualBroadcaster: output = Feature.MessagerParser(msg, '#000000', '#FFFFFF', false, Privacy.PrivateMessage.Usage).trim(); notify = '\n' + '*** Notification sent to the broadcaster ***' + '\n'; notify += '\n' + '{{0}}' + '\n'; notify = notify.toReplace(output); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, CurrentUser, '#000000', '#FFFFFF', 'bolder'); }; notify = '\n' + '*** Notification sent to {{0}} ***' + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'yourself' : 'you from {{0}}'.toReplace(CurrentUser) ), output); cb.sendNotice(notify, Broadcaster.Actual, '#000000', '#FFFFFF', 'bolder'); break; case Privacy.toModerators: output = Feature.MessagerParser(msg, '#BF0000', '#FFFFFF', false, Privacy.PrivateMessage.Usage).trim(); notify = '\n' + '*** Notification sent to moderators ***' + '\n'; notify += '\n' + '{{0}}' + '\n'; notify = notify.toReplace(output); if (!(UserIs.Moderator(msg))) { cb.sendNotice(notify, CurrentUser, '#BF0000', '#FFFFFF', 'bolder'); }; notify = '\n' + '*** Notification sent to moderators from {{0}} ***' + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), output); cb.sendNotice(notify, null, '#BF0000', '#FFFFFF', 'bolder', 'red'); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, Broadcaster.Actual, '#BF0000', '#FFFFFF', 'bolder'); }; break; case Privacy.toAlwaysAllowedUsers: output = Feature.MessagerParser(msg, '#7F007F', '#FFFFFF', false, Privacy.PrivateMessage.Usage).trim(); notify = '\n' + "*** Notification sent to 'always-allowed users' ***" + '\n'; notify += '\n' + '{{0}}' + '\n'; notify = notify.toReplace(output); if (!(UserIs.AlwaysAllowed())) { cb.sendNotice(notify, CurrentUser, '#7F007F', '#FFFFFF', 'bolder'); }; notify = '\n' + "*** Notification sent to 'always-allowed users' from {{0}} ***" + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), output); SendTo.AlwaysAllowedUsers(notify, '#7F007F', '#FFFFFF', 'bolder'); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, Broadcaster.Actual, '#7F007F', '#FFFFFF', 'bolder'); }; break; case Privacy.toFanClubMembers: output = Feature.MessagerParser(msg, '#007F00', '#FFFFFF', false, Privacy.PrivateMessage.Usage).trim(); notify = '\n' + '*** Notification sent to fan club members ***' + '\n'; notify += '\n' + '{{0}}' + '\n'; notify = notify.toReplace(output); if (!(UserIs.FanClubMember(msg))) { cb.sendNotice(notify, CurrentUser, '#007F00', '#FFFFFF', 'bolder'); }; notify = '\n' + '*** Notification sent to fan club members from {{0}} ***' + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), output); cb.sendNotice(notify, null, '#007F00', '#FFFFFF', 'bolder', 'green'); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, Broadcaster.Actual, '#007F00', '#FFFFFF', 'bolder'); }; break; case Privacy.toEveryone: output = Feature.MessagerParser(msg, '#007F7F', '#FFFFFF', false, Privacy.PrivateMessage.Usage).trim(); notify = '\n' + '*** Notification sent to everyone from {{0}} ***' + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), output); cb.sendNotice(notify, null, '#007F7F', '#FFFFFF', 'bolder'); break; case Privacy.PrivateMessage.Usage: var ParamaterCheck = msg['m'].substring(1).trim(); var TipNoteB = ' (with instructions to reply in a tip note of at least {{0}} token{{1}})'; TipNoteB = TipNoteB.toReplace(Settings.AmountToStayOnPMList, (Settings.AmountToStayOnPMList == 1 ? '' : 's' )); var TipNoteU = ' (we may continue to interact privately when you reply in a tip note of at least {{0}} token{{1}})'; TipNoteU = TipNoteU.toReplace(Settings.AmountToStayOnPMList, (Settings.AmountToStayOnPMList == 1 ? '' : 's' )); if (ParamaterCheck == Privacy.PrivateMessage.ShowUserLists) { // PM User List Check Utility.HideMessageFromChatRoom(msg); DoPMUserList.Show(); } else if (ParamaterCheck.substring(0,Privacy.PrivateMessage.toEverListed.length).toLowerCase() == Privacy.PrivateMessage.toEverListed) { // Ever On PM User List output = Feature.MessagerParser(msg, '#0000BF', '#FFFFFF', true, Privacy.PrivateMessage.Usage + Privacy.PrivateMessage.toEverListed).trim(); notify = '\n' + "*** Private message sent to all users ever on the 'private message' list{{0}} ***" + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? ' by you{{0}}'.toReplace(TipNoteB) : '' ), output); cb.sendNotice(notify, CurrentUser, '#0000BF', '#FFFFFF', 'bolder'); notify = '\n' + "*** Private message sent to all users ever on the 'private message' list from {{0}}{{1}} ***" + '\n'; notify += '\n' + '{{2}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), (UserIs.ActualBroadcaster() ? TipNoteU : '' ), output); SendTo.PMUserList(notify, Privacy.PrivateMessage.toEverListed, '#0000BF', '#FFFFFF', 'bolder'); notify = '\n' + "*** Private message sent to all users ever on the 'private message' list from {{0}} ***" + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace(CurrentUser, output); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, Broadcaster.Actual, '#0000BF', '#FFFFFF', 'bolder'); }; } else if (ParamaterCheck.substring(0,Privacy.PrivateMessage.toNowListed.length).toLowerCase() == Privacy.PrivateMessage.toNowListed) { // Now On PM User List output = Feature.MessagerParser(msg, '#0000BF', '#FFFFFF', true, Privacy.PrivateMessage.Usage + Privacy.PrivateMessage.toNowListed).trim(); notify = '\n' + "*** Private message sent to all users currently on the 'private message' list {{0}} ***" + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? ' by you{{0}}'.toReplace(TipNoteB) : '' ), output); cb.sendNotice(notify, CurrentUser, '#0000BF', '#FFFFFF', 'bolder'); notify = '\n' + "*** Private message sent to all users currently on the 'private message' list from {{0}}{{1}} ***" + '\n'; notify += '\n' + '{{2}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), (UserIs.ActualBroadcaster() ? TipNoteU : '' ), output); SendTo.PMUserList(notify, Privacy.PrivateMessage.toNowListed, '#0000BF', '#FFFFFF', 'bolder'); notify = '\n' + "*** Private message sent to all users currently on the 'private message' list from {{0}} ***" + '\n'; notify += '\n' + '{{1}}' + '\n'; notify = notify.toReplace(CurrentUser, output); if (!(UserIs.ActualBroadcaster())) { cb.sendNotice(notify, Broadcaster.Actual, '#0000BF', '#FFFFFF', 'bolder'); }; } else { var PMUserCheck = ParamaterCheck.search(Privacy.PrivateMessage.toUser); if (PMUserCheck > 0) { // PM User Name Isn't Missing output = Feature.MessagerParser(msg, '#0000BF', '#FFFFFF', true, Privacy.PrivateMessage.Usage).trim(); PMUser = output.substring(0,PMUserCheck).toLowerCaseTrim(); notify = '\n' + '*** Private message sent to {{0}}{{1}} ***' + '\n'; notify += '\n' + '{{2}}' + '\n'; notify = notify.toReplace((UserIs.ThisUser(PMUser) ? 'yourself' : PMUser ), ((UserIs.ActualBroadcaster() && (!(UserIs.ThisUser(PMUser)))) ? TipNoteB : '' ), output.substring(PMUserCheck+1)) cb.sendNotice(notify, CurrentUser, '#0000BF', '#FFFFFF', 'bolder'); if (!(UserIs.ThisUser(PMUser))) { notify = '\n' + '*** Private message sent to you from {{0}}{{1}} ***' + '\n'; notify += '\n' + '{{2}}' + '\n'; notify = notify.toReplace((UserIs.ActualBroadcaster() ? 'the broadcaster' : CurrentUser ), (UserIs.ActualBroadcaster() ? TipNoteU : '' ), output.substring(PMUserCheck+1)) cb.sendNotice(notify, PMUser, '#0000BF', '#FFFFFF', 'bolder'); notify = '\n' + "*** Private message sent to {{0}} from {{1}} ***" + '\n'; notify += '\n' + '{{2}}' + '\n'; notify = notify.toReplace(PMUser, CurrentUser, output.substring(PMUserCheck+1)); if (!(UserIs.ActualBroadcaster()) && (!(PMUser == Broadcaster.Actual))) { cb.sendNotice(notify, Broadcaster.Actual, '#0000BF', '#FFFFFF', 'bolder'); }; }; } else { // PM User Name Is Missing Utility.HideMessageFromChatRoom(msg); output = '\n' + '*** You must specify the user to whom your private message will be sent ***' + '\n'; output += '\n' + 'Private message not sent: {{0}}' + '\n'; output = output.toReplace(ParamaterCheck.substring(PMUserCheck+1)); SendTo.Special(output, CurrentUser); }; }; break; case Privacy.asChatMessage: msg['m'] = msg.m.substring(1).trim(); msg['background'] = "#FFFF00"; msg['c'] = "#000000"; CommandColor = true; break; }; // (End Switch) }; var CommandColor = false; Feature.MessagerParser = function (msg,bg,fg,pm,cmd) { /* ************************************************** */ ShowDebugMessage("* Feature.MessagerParser(msg,bg,fg,pm,cmd)"); /* ************************************************** */ output = msg['m'].substring(cmd.length); Utility.HideMessageFromChatRoom(msg); msg['m'] = pm ? 'Private message sent as a notification.' : 'Special message sent as a notification.'; // Purposely Inverted Colors // msg['background'] = fg; msg['c'] = bg; // Purposely Inverted Colors // CommandColor = true; /* ************************************************** */ ShowDebugMessage("* Feature.MessagerParser(msg,bg,fg,pm,cmd) Complete"); /* ************************************************** */ return output; }; // Messager Feature // // Feature Functions // // Utility Functions // var Utility = []; var StartTime = new Date(); Utility.GetUpTime = function () { var CurrentTime = new Date(); var d = (CurrentTime - StartTime) / 1000; if (d < 60) { return Math.floor(d) + " Seconds" }; d /= 60; var m = Math.floor(d % 60); var h = Math.floor(d / 60); var str = ''; if (h) str += h + ' Hours, '; str += m + ' Minutes' return str; }; // Show Session Stats // Utility.ShowStats = function () { output = 'Current Session Running Time: {{0}}' + '\n'; output = output.toReplace(Utility.GetUpTime()); return output; }; // Show Session Stats // // Hide Message From Chat Room // Utility.HideMessageFromChatRoom = function (msg) { msg['X-Spam'] = true; }; // Hide Message From Chat Room // // Command Handler // Utility.CheckForCommand = function (msg) { CommandColor = false; if (!(Settings.MessagerStatus)) { var holder = msg['m'].charAt(0); if (!(holder == '/')) { var held = true; for (i=0;i<msg['m'].length;i++) { if (i == 0) { var newmsg = '~'; } else { newmsg += msg['m'].charAt(i); }; }; msg['m'] = newmsg; }; }; /* ************************************************** */ ShowDebugMessage('Settings.MessagerStatus=' + Settings.MessagerStatus); ShowDebugMessage('holder=' + holder); ShowDebugMessage('held=' + held); /* if (Debug.Mode) { for (var i=0;i<msg['m'].length;i++) { ShowDebugMessage("msg['m'].substring(" + i + "," + (i+1) + ")=[" + msg['m'].substring(i,i+1) + "] / msg['m'].charAt(" + i + ")=[" + msg['m'].charAt(i) + "]"); }; }; */ /* ************************************************** */ var CommandParamaters = msg['m'].toLowerCaseTrim().split(" "); var CommandCheck = CommandParamaters[0].substring(1); var InvalidCommand = true; /* ************************************************** */ if (Debug.Mode) { for (x=0;x<CommandParamaters.length;x++) { ShowDebugMessage(x + "=[" + CommandParamaters[x] + "]"); }; }; ShowDebugMessage("CommandParamaters[0].charAt(0)=[" + CommandParamaters[0].charAt(0) + "]"); ShowDebugMessage("CommandCheck / CommandParamaters[0].substring(1)=[" + CommandCheck + "]"); /* ************************************************** */ // Top Tipper Colorizer Opt-In/Out // switch (CommandParamaters[0].trim()) { case '/optout': /* ************************************************** */ ShowDebugMessage("(Old) TopTipperOptOut[CurrentUser]" + TopTipperOptOut[CurrentUser]); ShowDebugMessage("UserIs.ThisUser(TopTipperOpt)" + UserIs.ThisUser(TopTipperOpt)); /* ************************************************** */ if (UserIs.ThisUser(TopTipperOpt)) { Utility.HideMessageFromChatRoom(msg); if (!(TopTipperOptOut[CurrentUser])) { TopTipperOptOut[CurrentUser] = true; /* ************************************************** */ ShowDebugMessage("(New) TopTipperOptOut[CurrentUser]" + TopTipperOptOut[CurrentUser]); /* ************************************************** */ TopTipper = null; output = '\n' + '{{0}}: Colorizer Feature Opt-Out For Top Tipper!' + '\n'; output += '\n' + "Type '/optin' to undo this choice at any time while you are still the 'top tipper'." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, TopTipperOpt) }; InvalidCommand = false; }; break; case '/optin': /* ************************************************** */ ShowDebugMessage("TopTipperOptOut[CurrentUser]" + TopTipperOptOut[CurrentUser]); ShowDebugMessage("UserIs.ThisUser(TopTipperOpt)" + UserIs.ThisUser(TopTipperOpt)); /* ************************************************** */ if (UserIs.ThisUser(TopTipperOpt)) { Utility.HideMessageFromChatRoom(msg); if (TopTipperOptOut[CurrentUser]) { TopTipperOptOut[CurrentUser] = false; /* ************************************************** */ ShowDebugMessage("(New) TopTipperOptOut[CurrentUser]" + TopTipperOptOut[CurrentUser]); /* ************************************************** */ TopTipper = TopTipperOpt; output = '\n' + '{{0}}: Colorizer Feature Opt-In For Top Tipper!' + '\n'; output += '\n' + "Type '/optout' to undo this choice at any time while you are still the 'top tipper'." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, TopTipperOpt) }; InvalidCommand = false; }; break; }; // (End Switch) // Top Tipper Colorizer Opt-In/Out // // All Users // switch (CommandParamaters[0].charAt(0)) { // Commands // case ('/'): Utility.HideMessageFromChatRoom(msg); /* if (CommandCheck == Code.Command) { switch (CommandParamaters[1]) { case null: case undefined: InvalidCommand = true; break; default: InvalidCommand = false; break; }; // (End Switch) }; */ break; // Commands // }; // (End Switch) // All Users // // Broadcaster, Moderators (If "Allowed"), And "Always-Allowed Users" Only // if (UserIs.ActualBroadcaster() || UserIs.ActiveBroadcaster() || UserIs.AllowedModerator(msg) || UserIs.AlwaysAllowed()) { switch (CommandParamaters[0].charAt(0)) { // Commands // case ('/'): // Show "Universal" Help // if (CommandCheck == 'help') { SendTo.Default(HelpNotification, CurrentUser); InvalidCommand = false; break; }; // Show "Universal" Help // if (CommandCheck == Code.Command) { switch (CommandParamaters[1]) { // Toggle On/Off // case Command.Toggle: switch (CommandParamaters[2]) { case undefined: Settings.ColorizerStatus = !Settings.ColorizerStatus; output = '\n' + '{{0}}: the bot has been {{1}}abled by {{2}}.' + '\n'; output = output.toReplace(Code.Name, (Settings.ColorizerStatus ? 'en' : 'dis' ), CurrentUser); SendTo.ImportantUsers(output); break; case 'toptipper': Settings.ColorizeTopTipper = !Settings.ColorizeTopTipper; output = '\n' + "{{0}}: the 'top tipper' colorizing feature of the bot has been {{1}}abled by {{2}}." + '\n'; output = output.toReplace(Code.Name, (Settings.ColorizeTopTipper ? 'en' : 'dis' ), CurrentUser); SendTo.ImportantUsers(output); output = '\n' + "{{0}}: the 'top tipper' colorizing feature of the bot has been {{1}}abled." + '\n'; output += '\n' + (Settings.ColorizeTopTipper ? "You are currently the 'top tipper' for this session and will have a unique color in the chat room until you are overtaken by a new user. If you would prefer to opt-out of this feature, type '/optout' in the chat room. If you change your mind, you can opt back in by typing '/optin'." + '\n' : 'Your chosen opt-out/in status will be preserved should the feature be re-enabled at any time during this session.' + '\n'); output = output.toReplace(Code.Name, (Settings.ColorizeTopTipper ? 'en' : 'dis' )); SendTo.Default(output, TopTipperOpt); break; default: output = '\n' + "{{0}}: '{{1}}' is not a valid toggle option." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2]); SendTo.Special(output, CurrentUser); break; }; // (End Switch) InvalidCommand = false; break; // Toggle On/Off // // Show Feature Immediately // case Command.Style.Check: switch (CommandParamaters[2]) { case undefined: output = '\n' + "{{0}}: style currently set to '{{1}}'." + '\n'; output = output.toReplace(Code.Name, (Settings.ColorizerStyle.White ? Command.Style.White : Settings.ColorizerStyle.Light ? Command.Style.Light : Settings.ColorizerStyle.Normal ? Command.Style.Normal : Settings.ColorizerStyle.Dark ? Command.Style.Dark : Settings.ColorizerStyle.Custom ? Command.Style.Custom : null )); SendTo.Default(output, CurrentUser); break; case Command.Style.White: case Command.Style.Light: case Command.Style.Normal: case Command.Style.Dark: case Command.Style.Custom: Settings.ColorizerStyle.White = CommandParamaters[2] == Command.Style.White; Settings.ColorizerStyle.Light = CommandParamaters[2] == Command.Style.Light; Settings.ColorizerStyle.Normal = CommandParamaters[2] == Command.Style.Normal; Settings.ColorizerStyle.Dark = CommandParamaters[2] == Command.Style.Dark; Settings.ColorizerStyle.Custom = CommandParamaters[2] == Command.Style.Custom; output = '\n' + "{{0}}: style changed to '{{1}}' by {{2}}." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2], CurrentUser); SendTo.ImportantUsers(output); break; default: output = '\n' + "{{0}}: '{{1}}' is not a valid style option. Please choose from '{{2}}', '{{3}}', '{{4}}', '{{5}}', or '{{6}}'." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2], Command.Style.White, Command.Style.Light, Command.Style.Normal, Command.Style.Dark, Command.Style.Custom); SendTo.Special(output, CurrentUser); break; }; // (End Switch) InvalidCommand = false; break; // Show Feature Immediately // // Manually Set Top Tipper // case Command.TopTipper: switch (CommandParamaters[2]) { case undefined: output = '\n' + "{{0}}: you didn't supply the user's name or amount of tokens tipped." + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); InvalidCommand = true; break; default: switch (isNaN(CommandParamaters[3]) || parseInt(CommandParamaters[3])) { case true: if (!(CommandParamaters[3] == null || CommandParamaters[3] == '')) { output = '\n' + "{{0}}: '{{1}}' is not a number, but one is required for this command." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[3]); } else { output = '\n' + "{{0}}: you didn't supply the amount of tokens tipped." + '\n'; output = output.toReplace(Code.Name); } SendTo.Special(output, CurrentUser); InvalidCommand = true; break; default: Feature.ManuallySetTipper(CommandParamaters[2], parseInt(CommandParamaters[3])); output = '\n' + "{{0}}: {{1}} was set as the colorized top tipper for {{2}} tokens by {{3}}." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2], CommandParamaters[3], CurrentUser); SendTo.ImportantUsers(output); InvalidCommand = false; break; } break; } break; // Manually Set Top Tipper // // Toggle "Special Message" Feature On/Off // case Command.Messager: Settings.MessagerStatus = !Settings.MessagerStatus; output = '\n' + "{{0}}: the 'special messaging' feature of the bot has been {{1}}abled by {{2}}." + '\n'; output = output.toReplace(Code.Name, (Settings.MessagerStatus ? 'en' : 'dis' ), CurrentUser); SendTo.ImportantUsers(output); InvalidCommand = false; break; // Toggle "Special Message" Feature On/Off // // Process Unique Users List // case Command.Unique.Usage: // Show Unique Users List // if (CommandParamaters[2] == null) { ShowUniqueUsersList(); InvalidCommand = false; break; }; // Show Unique Users List // switch (CommandParamaters[2].charAt(0)) { // Grant User Unique Colorizer Status // case Command.Unique.Grant: if (CommandParamaters[2].length > 1) { SetUniqueUser(true, CommandParamaters[2].substring(1).toLowerCaseTrim()); output = '\n' + "{{0}}: {{1}} has been granted 'unique user' colorizer status for the current session by {{2}}." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2].substring(1).toLowerCaseTrim(), CurrentUser); SendTo.ImportantUsers(output); output = '\n' + "{{0}}: 'unique user' colorizer status has been granted to you for the current session." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, CommandParamaters[2].substring(1).toLowerCaseTrim()); } else { output = '\n' + '{{0}}: no user name was specified.' + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); }; break; // Grant User Unique Colorizer Status // // Revoke User Unique Colorizer Status // case Command.Unique.Revoke: if (CommandParamaters[2].length > 1) { SetUniqueUser(false, CommandParamaters[2].substring(1).toLowerCaseTrim()); output = '\n' + "{{0}}: {{1}} has had 'unique user' colorizer status revoked for the current session by {{2}}." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2].substring(1).toLowerCaseTrim(), CurrentUser); SendTo.ImportantUsers(output, CurrentUser); output = '\n' + "{{0}}: your 'unique user' colorizer status has been revoked for the current session." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, CommandParamaters[2].substring(1).toLowerCaseTrim()); } else { output = '\n' + '{{0}}: no user name was specified.' + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); }; break; // Revoke User Unique Colorizer Status // default: output = '\n' + "{{0}}: '{{1}}' is not a valid option. Please choose from '{{2}}[U]' or '{{3}}[U]' (where [U] is the user's chat name), or leave blank to show the current list of users with 'unique user' colorizer status." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2], Command.Unique.Grant, Command.Unique.Revoke); SendTo.Special(output, CurrentUser); break; }; // (End Switch) InvalidCommand = false; break; // Process Unique Users List // // Toggle Moderator Access // case Command.Access.Moderator: if ((UserIs.ActualBroadcaster()) || ((Settings.SupportMode) && (UserIs.Author()))) { Settings.ModeratorsAllowed = !Settings.ModeratorsAllowed; if (Settings.ModeratorsAllowed) { output = '\n' + "{{0}}: command access for all moderators has been granted by {{1}} for this session." + '\n'; } else { output = '\n' + "{{0}}: command access for all moderators has been revoked by {{1}} for this session." + '\n'; }; output = output.toReplace(Code.Name, CurrentUser); SendTo.ImportantUsers(output); InvalidCommand = false; }; break; // Toggle Moderator Access // // Process Access List // case Command.Access.Usage: if ((UserIs.ActualBroadcaster()) || ((Settings.SupportMode) && (UserIs.Author()))) { // Show User Access List // if (CommandParamaters[2] == null) { ShowUserAccessList(); InvalidCommand = false; break; }; // Show User Access List // switch (CommandParamaters[2].charAt(0)) { // Grant User Access // case Command.Access.Grant: if ((UserIs.ActualBroadcaster()) || ((Settings.SupportMode) && (UserIs.Author()))) { if (CommandParamaters[2].length > 1) { SetUserAccess(true, CommandParamaters[2].substring(1).toLowerCaseTrim()); output = '\n' + '{{0}}: access has been granted to {{1}} for the current session.' + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2].substring(1).toLowerCaseTrim()); SendTo.Default(output, CurrentUser); output = '\n' + '{{0}}: command access has been granted to you for the current session.' + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, CommandParamaters[2].substring(1).toLowerCaseTrim()); } else { output = '\n' + '{{0}}: no user name was specified.' + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); }; }; break; // Grant User Access // // Revoke User Access // case Command.Access.Revoke: if ((UserIs.ActualBroadcaster()) || ((Settings.SupportMode) && (UserIs.Author()))) { if (CommandParamaters[2].length > 1) { SetUserAccess(false, CommandParamaters[2].substring(1).toLowerCaseTrim()); output = '\n' + '{{0}}: access has been revoked for {{1}} for the current session.' + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2].substring(1).toLowerCaseTrim()); SendTo.Default(output, CurrentUser); output = '\n' + '{{0}}: your command access has been revoked for the current session.' + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, CommandParamaters[2].substring(1).toLowerCaseTrim()); } else { output = '\n' + '{{0}}: no user name was specified.' + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); }; }; break; // Revoke User Access // default: output = '\n' + "{{0}}: '{{1}}' is not a valid option. Please choose from '{{2}}[U]' or '{{3}}[U]' (where [U] is the user's chat name), or leave blank to show the current list of users with command access." + '\n'; output = output.toReplace(Code.Name, CommandParamaters[2], Command.Access.Grant, Command.Access.Revoke); SendTo.Special(output, CurrentUser); break; }; // (End Switch) InvalidCommand = false; }; break; // Process Access List // // Show Stats // case Command.Stats: if ((UserIs.ActualBroadcaster()) || ((Settings.SupportMode) && (UserIs.Author()))) { output = '\n' + '{{0}}: stats for this session are shown below.' + '\n\n'; output = output.toReplace(Code.Name); output += Utility.ShowStats(); SendTo.Default(output, CurrentUser); InvalidCommand = false; }; break; // Show Stats // // Show Help // case undefined: case Command.Help: SendTo.Default(HelpNotification, CurrentUser); InvalidCommand = false; break; // Show Help // // Toggle Support Mode (Must Be Broadcaster) // case 'support': if (UserIs.ActualBroadcaster()) { Settings.SupportMode = !Settings.SupportMode; Broadcaster.Active = Settings.SupportMode ? Code.Author.toLowerCase() : Broadcaster.Actual; output = '\n' + '{{0}}: support mode {{1}}abled.' + '\n'; output = output.toReplace(Code.Name, (Settings.SupportMode ? 'en' : 'dis' )); SendTo.Special(output, CurrentUser); if (UserIs.ActualBroadcaster() != UserIs.Author()) { SendTo.Special(output, Code.Author.toLowerCase()); }; InvalidCommand = false; }; break; // Toggle Support Mode (Must Be Broadcaster) // // Toggle Debug Mode (Must Be Author) // case 'debug': if ((!(Settings.SupportMode)) && (Debug.Mode) && (UserIs.Author())) { // Escape Debug Mode If Support Mode Is Prematurely Deactivated Debug.Mode = false; output = '\n' + '{{0}}: debug mode disabled.' + '\n'; output = output.toReplace(Code.Name); SendTo.Special(output, CurrentUser); InvalidCommand = false; }; if ((Settings.SupportMode) && (UserIs.Author())) { Debug.Mode = !Debug.Mode; if (Debug.Mode) { Debug.Count = 1; }; output = '\n' + '{{0}}: debug mode {{1}}abled.' + '\n'; output = output.toReplace(Code.Name, (Debug.Mode ? 'en' : 'dis' )); SendTo.Special(output, CurrentUser); InvalidCommand = false; }; break; // Toggle Debug Mode (Must Be Author) // // Toggle Verbose Debug Mode (Must Be Author) // case 'verbose': if ((!(Settings.SupportMode)) && (Debug.Mode) && (Debug.Verbose) && (UserIs.Author())) { // Allow Verbose Debug Mode Toggle If Support Mode Is Prematurely Deactivated Debug.Verbose = !Debug.Verbose; output = '\n' + '{{0}}: verbose debug mode {{1}}abled.' + '\n'; output = output.toReplace(Code.Name, (Debug.Verbose ? 'en' : 'dis' )); SendTo.Special(output, CurrentUser); InvalidCommand = false; }; if ((Settings.SupportMode) && (UserIs.Author())) { if (Debug.Mode) { Debug.Verbose = !Debug.Verbose; } else { Debug.Mode = true; Debug.Verbose = true; }; output = '\n' + '{{0}}: verbose debug mode {{1}}abled.' + '\n'; output = output.toReplace(Code.Name, (Debug.Verbose ? 'en' : 'dis' )); SendTo.Special(output, CurrentUser); InvalidCommand = false; }; break; // Toggle Verbose Debug Mode (Must Be Author) // // Invalid Command Option // default: InvalidCommand = true; break; // Invalid Command Option // }; // (End Switch) }; break; // Commands // }; // (End Switch) Feature.Messager(CommandParamaters, msg); }; // Broadcaster, Moderators (If "Allowed"), And "Always-Allowed Users" Only // if (held) { for (i=0;i<msg['m'].length;i++) { if (i == 0) { var oldmsg = holder; } else { oldmsg += msg['m'].charAt(i); }; }; msg['m'] = oldmsg; }; /* ************************************************** */ ShowDebugMessage("InvalidCommand="+InvalidCommand); /* ************************************************** */ if ((Debug.Mode && UserIs.Author()) || CommandCheck == Code.Command) { if (InvalidCommand && CommandParamaters[0].charAt(0) == '/') { output = '\n' + "{{0}}: invalid command or access denied: '{{1}}'." + '\n' if (UserIs.ActualBroadcaster() || UserIs.ActiveBroadcaster() || UserIs.AllowedModerator(msg) || UserIs.AlwaysAllowed()) { output += '\n' + FormatCommand("{{2}}' to see a list of the available commands.", false); output = output.toReplace(Code.Name, msg['m'].trim(), Command.Help); } else { output = output.toReplace(Code.Name, msg['m'].trim()); }; SendTo.Special(output, CurrentUser); }; }; /* Disabled: NOT COMPATIBLE WITH MULTIPLE APP/BOT COMBINATIONS if (CommandCheck == Code.Command) { output = "Command {{0}}executed: '{{1}}'"; output = output.toReplace((InvalidCommand ? 'not ' : '' ), msg['m']); msg['m'] = output; }; */ }; // Command Handler // // Utility Functions // // Chaturbate Tip Handler // var LastTipAmount = 0; var LastTipper = null; var TopTipAmount = 0; var TopTipper = null; var TopTipperOpt = null; var TopTipperOptOut = {}; var onTip = function (tip) { /* ************************************************** */ ShowDebugMessage("* onTip(tip)"); /* ************************************************** */ LastTipAmount = parseInt(tip['amount']); LastTipper = tip['from_user']; /* ************************************************** */ ShowDebugMessage("LastTipper=" + LastTipper); ShowDebugMessage("LastTipAmount=" + LastTipAmount); /* ************************************************** */ CurrentUser = LastTipper; if (LastTipAmount > TopTipAmount) { /* ************************************************** */ ShowDebugMessage("New Top Tip Amount"); /* ************************************************** */ TopTipAmount = LastTipAmount; /* ************************************************** */ ShowDebugMessage("TopTipAmount=" + TopTipAmount); /* ************************************************** */ if (TopTipperOpt != LastTipper) { /* ************************************************** */ ShowDebugMessage("New Top Tipper"); /* ************************************************** */ TopTipperOpt = LastTipper; /* ************************************************** */ ShowDebugMessage("TopTipperOpt=" + TopTipperOpt); ShowDebugMessage("(Old) TopTipperOptOut[CurrentUser]=" + TopTipperOptOut[CurrentUser]); /* ************************************************** */ TopTipperOptOut[CurrentUser] = TopTipperOptOut[CurrentUser] ? true : false; /* ************************************************** */ ShowDebugMessage("(New) TopTipperOptOut[CurrentUser]=" + TopTipperOptOut[CurrentUser]); /* ************************************************** */ TopTipper = TopTipperOptOut[CurrentUser] ? null : TopTipperOpt; /* ************************************************** */ ShowDebugMessage("TopTipper=" + TopTipper); /* ************************************************** */ output = '\n'; output += '{{0}}: Congratulations!' + '\n\n'; output += "You are now the 'top tipper' for this session and will have a unique color in the chat room until you are overtaken by a new user. If you would prefer to opt-out of this feature, type '/optout' in the chat room. If you change your mind, you can opt back in by typing '/optin'." + '\n'; output = output.toReplace(Code.Name); SendTo.Default(output, TopTipper) }; }; DoPMUserList.Build(); /* ************************************************** */ ShowDebugMessage("* onTip(tip) Complete"); /* ************************************************** */ }; cb.onTip(function(tip) { return onTip(tip); }); // Chaturbate Tip Handler // // Chaturbate Welcome Handler // var onEnter = function (user) { /* ************************************************** */ ShowDebugMessage("* onEnter(user)"); /* ************************************************** */ CurrentUser = user['user']; SetModeratorStatus(user); if (UserIs.Author() && (!(UserIs.ActualBroadcaster()))) { output = '{{0}} is being used by {{1}}.' + '\n'; output = output.toReplace(Identification, Broadcaster.Actual); SendTo.Special(output, Code.Author.toLowerCase()); }; /* ************************************************** */ ShowDebugMessage("* onEnter(user) Complete"); /* ************************************************** */ }; cb.onEnter(function(user) { return onEnter(user); }); // Chaturbate Welcome Handler // // Chaturbate Message Handler // var onMessage = function (msg) { /* ************************************************** */ ShowDebugMessage("* onMessage(msg)"); /* ************************************************** */ CurrentUser = msg['user']; SetModeratorStatus(msg); msg['m'] = msg['m'].replace(/\s\s+/g, ' '); /* ************************************************** */ ShowDebugMessage("msg=" + msg['m']); /* ************************************************** */ Utility.CheckForCommand(msg); /* ************************************************** */ ShowDebugMessage("Settings.ColorizerStatus=" + Settings.ColorizerStatus); ShowDebugMessage("CommandColor=" + CommandColor); /* ************************************************** */ if (Settings.ColorizerStatus && (!(CommandColor))) { Feature.Colorizer(msg); }; /* ************************************************** */ ShowDebugMessage("* onMessage(msg) Complete"); /* ************************************************** */ return msg; }; cb.onMessage(function (msg) { return onMessage(msg); }); // Chaturbate Message Handler // // Startup // var Startup = {}; Startup.Message = '\n' + '{{0}} has been activated.' + '\n'; Startup.Message = Startup.Message.toReplace(Identification); Startup.Init = function () { /* ************************************************** */ ShowDebugMessage("* Startup.Init()"); /* ************************************************** */ Settings.NotificationStyle.Weight = Settings.NotificationStyle.Weight.toLowerCase(); SendTo.Default(Startup.Message); cb.setTimeout(Startup.Delay, 2000); /* ************************************************** */ ShowDebugMessage("* Startup.Init() Complete"); /* ************************************************** */ }; Startup.Delay = function () { /* ************************************************** */ ShowDebugMessage('* Startup.Delay()'); /* ************************************************** */ /* cb.setTimeout(SendTo.ImportantUsers(CommandList), 2000); */ cb.setTimeout(SendTo.ImportantUsers('\n' + FormatCommand("{{0}}' to see a list of the available commands.".toReplace(Command.Help), false)), 2000); /* ************************************************** */ ShowDebugMessage('* Startup.Delay() Complete'); /* ************************************************** */ }; cb.setTimeout(Startup.Init, 1); // Startup //
© Copyright Chaturbate 2011- 2026. All Rights Reserved.