Bots Home
|
Create an App
Chat User Logger Thing 3 (CULT3)
Author:
godel17
Description
Source Code
Launch Bot
Current Users
Created by:
Godel17
let me = cb.room_slug; let version = 0; let log = cb.log let message = cb.chatNotice message("Chat User Logger Thing 3 (CULT3) Enabled."); message("Type /debug to see it's output."); message("Type notes to see your notes."); message("Type help for online help."); message(""); //////////////////////////////////////////////////////////////////////////////// // command interpreter //////////////////////////////////////////////////////////////////////////////// function print_help_help () { log("help - the help system."); log(""); log("The help system is meant to guide the design of the root system."); } let notes = { 'skarlet31': [ 'skarlet31 is the original author of this script.'.split(' '), 'http://chaturbate.com/skarlet31'.split(' ') ], 'godel17': [ "godel17 is the next author of this script -- July 7 2019.".split(' '), 'http://chaturbate.com/godel17' ] }; notes[me] = [ "Type 'denotes godel17' to see the notes on that topic, what they have said in chat.".split(' ') ]; let metas = { 'IRL': [ "in real life" ], 'CULT3': [ "Chat User Logger Thing 3 (CULT3)" ] }; let trash = []; // notes that have been filed function add_denote(topic, note) { log("Adding note for '" + topic + "': '" + note + "'."); if(notes[topic]) { notes[topic].push(note); } else { notes[topic] = [ note ]; } } function cmd_dump () { core.data = data; log("// -- Begin Core ++"); log("core = " + JSON.stringify( { 'data': { notes: notes, metas: metas, trash: trash } } )); log("// -- End Core ++"); } function cmd_load (args) { data = core.data; notes = data.notes; metas = data.metas; trash = data.metas; } function file_denote(topic, note_index) { let note = notes[topic][note_index]; trash.push([ topic, note ]); notes[topic][note_index] = undefined; } function print_denotes(topic) { let theNotes = notes[topic]; if(theNotes) { for(let i = 0; i < theNotes.length; i++) { if(theNotes[i]) { log(i + ": " + theNotes[i].join(' ')); } } } else { log("No notes about topic: " + topic); } log(""); } function print_topics() { log("The topics are:"); log(""); for(topic in notes) { log(topic); } log(""); } function cmd_note (args) { add_denote(me, args); } function cmd_notes (args) { print_denotes(me); } function cmd_file (args) { let topic = me; let note_index = parseInt(args[0]); if (isNaN(note_index)) { topic = args[0]; note_index = parseInt(args[1]); } file_denote(topic, note_index); } function cmd_denote (args) { let topic = args[0]; let note = args.slice(1); add_denote(topic, note); } function cmd_denotes (args) { let topic = args[0]; print_denotes(topic); } function cmd_topics (args) { print_topics(); } function cmd_help (args) { log("This is the help system for CULT3."); log(""); if(args.length === 0) { log("Topics: "); log(""); for(command in commands) { log(" " + command + ": " + commands[command].h[0]); } log(""); } else { log(""); let topic = args[0]; if(commands[topic]) { log(" " + topic + ":"); log(""); let helpText = commands[topic].h; for(let i = 0; i < helpText.length; i++) { log(" " + helpText[i]); } } else { log("Unknown help topic: " + args[1]); } log(""); } } function cmd_meta (args) { let word = args[0]; let expansion = args.slice(1); metas[word] = expansion; } function meta_substitute (word) { if(metas[word]) { return metas[word].join(' '); } else { return word; } } function cmd_aleph (args) { } let commands = { 'help': { f: cmd_help, h: [ "Show this help." ]}, 'note': { f: cmd_note, h: ["Add a note.", "Syntax: note <note ...>" ] }, 'notes': { f: cmd_notes, h: [ "Show your notes." ] }, 'topics': { f: cmd_topics, h: [ "Show topics." ] }, 'denote': { f: cmd_denote, h: [ "Add a note about a topic.", "Syntax: denote <topic> <note ...>", "Example: denote skarlet31 wrote this script" ] }, 'denotes': { f: cmd_denotes, h: [ "Show notes about a topic.", "Syntax: denotes <topic>", "Example: denotes skarlet31" ] }, 'file': { f: cmd_file, h: [ "File (hide) a specific note.", "Syntax: file_note <note index>", "Syntax: file_note <topic> <note index>"] }, 'dump': { f: cmd_dump, h: [ "Dump state for later loading." ] }, 'load': { f: cmd_load, h: [ "Load state from previous dumping." ] }, 'meta': { f: cmd_meta, h: [ "Meta word substitution.", "Substitutes words with their 'meta' expansion", "Syntax: meta <word> <expansion...>", "Example: meta this THAT # changes this into THAT" ] }, 'aleph': { f: cmd_aleph, h: [ "WIP: Aleph word expansion.", "Expands specified words with their 'aleph' (argumentative) expansion", "Syntax: aleph <word> <args..> as <expansion containing args...>", "Example: Coming Soon..." ] } } function execute_command(words) { let words2 = []; for(let i = 0; i < words.length; i++) { words2.push(meta_substitute(words[i])); } if(commands[words2[0]]) { commands[words2[0]].f(words2.slice(1)); } } //////////////////////////////////////////////////////////////////////////////// // message handling system //////////////////////////////////////////////////////////////////////////////// let messages = {}; // saved messages table function denote_what_they_said (user, msg) { let x = user + " " + msg; cmd_denote(x.split(' ')); } cb.onMessage(function (msg) { // This tells you more about who is talking in your room. // Enable by typing /debug in your chat window. let m = msg['m']; let user = msg['user']; let gender = msg['gender']; let is_mod = msg['is_mod']; let in_fanclub = msg['in_fanclub']; let has_tokens = msg['has_tokens']; let tipped_recently = msg['tipped_recently']; let tipped_alot_recently = msg['tipped_alot_recently']; let tipped_tons_recently = msg['tippped_tons_recently']; if(gender == 'f') { log(user + " is female."); } else { log(user + " is not female."); } if(m) { log(user + " said '" + m + "'."); } if(is_mod) { log(user + " is a moderator."); } if(has_tokens) { log(user + " has tokens."); } if(in_fanclub) { log(user + " is in my fan club."); } if(tipped_recently) { log(user + " has tipped recently."); } if(tipped_alot_recently) { log(user + " has tipped a lot recently."); } if(tipped_tons_recently) { log(user + " has tipped tons recently."); } if(user === me) { // root mode enabled log("User is the room owner (" + me + ")."); log(""); log("THE USERS CAN SEE YOUR COMMANDS."); log(""); log("Command (root) mode enabled."); log(""); let words = msg['m'].split(" "); log("Your command is: '" + words.join(' ') + "'"); log(""); execute_command(words); } denote_what_they_said(user, m); return msg; });
© Copyright Chaturbate 2011- 2025. All Rights Reserved.