Bots Home
|
Create an App
TheKodyy v2
Author:
thekodyy
Description
Source Code
Launch Bot
Current Users
Created by:
Thekodyy
// Define the settings your app will use cb.settings_choices = [ { name: 'room_title_prefix', type: 'str', label: 'Room Title Prefix', defaultValue: 'thekodyy LIVE — Flex & Tease!' }, { name: 'goal_in_title', type: 'choice', label: 'Show Goal Progress in Title?', choice1: 'yes', choice2: 'no', defaultValue: 'yes' }, { name: 'goal_amount', type: 'int', label: 'Goal Amount (tokens)', defaultValue: 0 }, { name: 'goal_description', type: 'str', label: 'Goal Description', defaultValue: '' }, { name: 'hashtag1', type: 'str', label: 'Hashtag 1', defaultValue: '#jock' }, { name: 'hashtag2', type: 'str', label: 'Hashtag 2', defaultValue: '#muscle' }, { name: 'hashtag3', type: 'str', label: 'Hashtag 3', defaultValue: '#new' }, { name: 'hashtag4', type: 'str', label: 'Hashtag 4', defaultValue: '#shy' }, { name: 'hashtag5', type: 'str', label: 'Hashtag 5', defaultValue: '#daddy' }, { name: 'tip_menu_interval', type: 'int', label: 'Tip Menu Interval (seconds)', defaultValue: 300 }, { name: 'tip_menu_title', type: 'str', label: 'Tip Menu Title', defaultValue: '🔥 thekodyy Tip Menu 🔥' }, // 10 menu items max { name: 'menu_item1', type: 'str', label: 'Menu Item 1', defaultValue: '💬 5 – Tell me you like me' }, { name: 'menu_item2', type: 'str', label: 'Menu Item 2', defaultValue: '❤️ 10 – Tell me you love me' }, { name: 'menu_item3', type: 'str', label: 'Menu Item 3', defaultValue: '💪 20 – Flex for you' }, { name: 'menu_item4', type: 'str', label: 'Menu Item 4', defaultValue: '🔥 30 – Flash ass' }, { name: 'menu_sort_order', type: 'choice', label: 'Sort Tip Menu by', choice1: 'Low to High', choice2: 'High to Low', defaultValue: 'Low to High' }, { name: 'private_rate_mention', type: 'str', label: 'Private Show Rate Mention', defaultValue: 'Private shows 60 tokens/minute' }, // Notices, max 10 { name: 'notice1', type: 'str', label: 'Notice 1', defaultValue: 'Respect the space, respect the model.' }, { name: 'notice2', type: 'str', label: 'Notice 2', defaultValue: 'Tips fuel the show and keep it lit.' }, { name: 'notice3', type: 'str', label: 'Notice 3', defaultValue: 'Invite me to private for exclusive requests.' }, { name: 'notice4', type: 'str', label: 'Notice 4', defaultValue: 'Follow thekodyy for more flex and fun.' }, { name: 'notice5', type: 'str', label: 'Notice 5', defaultValue: 'Keep chat clean, no spam or hate.' }, { name: 'notice_interval', type: 'int', label: 'Notice Rotation Interval (seconds)', defaultValue: 180 }, { name: 'reminder_text', type: 'str', label: 'Public Reminder (fixed)', defaultValue: 'Follow thekodyy to chat. Tip to fuel the show.' }, { name: 'reminder_interval', type: 'int', label: 'Public Reminder Interval (seconds)', defaultValue: 300 }, // Blocked words (10 max) { name: 'blocked_word1', type: 'str', label: 'Blocked Word 1', defaultValue: 'skype' }, { name: 'blocked_word2', type: 'str', label: 'Blocked Word 2', defaultValue: 'snapchat' }, { name: 'blocked_word3', type: 'str', label: 'Blocked Word 3', defaultValue: 'onlyfans' }, { name: 'blocked_word4', type: 'str', label: 'Blocked Word 4', defaultValue: 'whatsapp' }, { name: 'blocked_word5', type: 'str', label: 'Blocked Word 5', defaultValue: 'discord' }, { name: 'blocked_word6', type: 'str', label: 'Blocked Word 6', defaultValue: 'email' }, { name: 'blocked_word7', type: 'str', label: 'Blocked Word 7', defaultValue: 'phone' }, { name: 'blocked_word8', type: 'str', label: 'Blocked Word 8', defaultValue: 'address' }, { name: 'blocked_word9', type: 'str', label: 'Blocked Word 9', defaultValue: '' }, { name: 'blocked_word10', type: 'str', label: 'Blocked Word 10', defaultValue: '' }, { name: 'spam_delay', type: 'int', label: 'Seconds Between Messages (anti-spam)', defaultValue: 5 }, { name: 'captcha_enabled', type: 'choice', label: 'Captcha for Anonymous Users?', choice1: 'yes', choice2: 'no', defaultValue: 'yes' }, { name: 'follower_gate', type: 'choice', label: 'Followers Only Chat?', choice1: 'yes', choice2: 'no', defaultValue: 'yes' }, // 2Chill Rank System { name: 'sexy_threshold', type: 'int', label: 'Tokens Needed for Sexy Rank', defaultValue: 100 }, { name: 'naughty_threshold', type: 'int', label: 'Tokens Needed for Naughty Rank', defaultValue: 300 }, { name: 'emoji_chill', type: 'str', label: 'Chill Rank Emoji', defaultValue: '❄️' }, { name: 'emoji_sexy', type: 'str', label: 'Sexy Rank Emoji', defaultValue: '🔥' }, { name: 'emoji_naughty', type: 'str', label: 'Naughty Rank Emoji', defaultValue: '😈' }, { name: 'daily_reset_hour', type: 'int', label: 'Daily Reset Hour (0-23, server time)', defaultValue: 0 }, ]; // ========== In-memory state ========== const userData = {}; let lastResetDay = null; let rotatingNoticeIndex = 0; let tokensRaised = 0; const userLastMessageTime = {}; // ========== Functions ========== // Build the room title dynamically function buildRoomTitle() { const parts = []; if (cb.settings.room_title_prefix?.trim()) parts.push(cb.settings.room_title_prefix.trim()); if (cb.settings.goal_in_title === 'yes' && cb.settings.goal_amount > 0) { parts.push(`Goal: ${tokensRaised}/${cb.settings.goal_amount} tokens`); if (cb.settings.goal_description?.trim()) parts.push(`(${cb.settings.goal_description.trim()})`); } const tags = []; for (let i = 1; i <= 5; i++) { const tag = cb.settings[`hashtag${i}`]; if (tag?.trim()) tags.push(tag.trim()); } if (tags.length) parts.push(tags.join(' ')); return parts.join(' | '); } // Update the room title using Chaturbate API function updateRoomTitle() { const newTitle = buildRoomTitle(); cb.setRoomTitle(newTitle); } // Rotate the notices in chat function rotateNotices() { const notices = []; for (let i = 1; i <= 10; i++) { const n = cb.settings[`notice${i}`]; if (n?.trim()) notices.push(n.trim()); } if (notices.length === 0) return; if (rotatingNoticeIndex >= notices.length) rotatingNoticeIndex = 0; cb.chatNotice(notices[rotatingNoticeIndex]); rotatingNoticeIndex++; cb.setTimeout(rotateNotices, (cb.settings.notice_interval || 180) * 1000); } // Public reminder notice (fixed text) function publicReminder() { if (!cb.settings.reminder_text?.trim()) return; cb.chatNotice(cb.settings.reminder_text); cb.setTimeout(publicReminder, (cb.settings.reminder_interval || 300) * 1000); } // Display the tip menu in chat function displayTipMenu() { const menuItems = []; for (let i = 1; i <= 10; i++) { const item = cb.settings[`menu_item${i}`]; if (item?.trim()) { // Extract tip amount number for sorting const match = item.match(/(\d+)/); const tip = match ? parseInt(match[1], 10) : 0; menuItems.push({ text: item.trim(), tip }); } } if (cb.settings.menu_sort_order === 'High to Low') { menuItems.sort((a, b) => b.tip - a.tip); } else { menuItems.sort((a, b) => a.tip - b.tip); } let menuStr = `${cb.settings.tip_menu_title || '🔥 Tip Menu 🔥'}\n`; menuItems.forEach((item, idx) => { menuStr += `${idx + 1}. ${item.text}\n`; }); if (cb.settings.private_rate_mention?.trim()) { menuStr += `\n${cb.settings.private_rate_mention.trim()}`; } cb.chatNotice(menuStr); } // Check if user can send message (anti-spam) function canUserSendMessage(user) { const now = Date.now(); if (!userLastMessageTime[user.name]) userLastMessageTime[user.name] = 0; if (now - userLastMessageTime[user.name] < (cb.settings.spam_delay || 5) * 1000) return false; userLastMessageTime[user.name] = now; return true; } // Check if text contains any blocked word function containsBlockedWord(text) { text = text.toLowerCase(); for (let i = 1; i <= 10; i++) { const badWord = (cb.settings[`blocked_word${i}`] || '').toLowerCase().trim(); if (badWord && text.includes(badWord)) return badWord; } return null; } // 2Chill Rank functions function getRank(tipTotal) { if (tipTotal >= cb.settings.naughty_threshold) return 'naughty'; if (tipTotal >= cb.settings.sexy_threshold) return 'sexy'; return 'chill'; } function getEmoji(rank) { if (rank === 'naughty') return cb.settings.emoji_naughty; if (rank === 'sexy') return cb.settings.emoji_sexy; return cb.settings.emoji_chill; } // Reset daily user data function resetDailyData() { for (const user in userData) { userData[user].tipTotal = 0; userData[user].rank = 'chill'; } lastResetDay = new Date().getDate(); cb.chatNotice('🧊 Daily tip ranks reset! New day, new climb!'); } // Check if daily reset needed function checkReset() { const now = new Date(); if (lastResetDay !== now.getDate() && now.getHours() >= cb.settings.daily_reset_hour) { resetDailyData(); } } // Daily MVP shoutout function dailyMVPShoutout() { checkReset(); let maxTip = 0; let topUser = null; for (const user in userData) { if (userData[user].tipTotal > maxTip) { maxTip = userData[user].tipTotal; topUser = user; } } if (topUser && maxTip > 0) { cb.chatNotice(`🏆 Daily MVP is ${topUser} with ${maxTip} tokens tipped! ${getEmoji(userData[topUser].rank)}`); } cb.setTimeout(dailyMVPShoutout, 24 * 60 * 60 * 1000); } // ========== Event Handlers ========== cb.onConnect = function () { lastResetDay = new Date().getDate(); dailyMVPShoutout(); updateRoomTitle(); displayTipMenu(); rotateNotices(); publicReminder(); }; cb.onTip = function (tip) { checkReset(); tokensRaised += tip.amount; updateRoomTitle(); const userName = tip.fromUser.toLowerCase(); if (!userData[userName]) { userData[userName] = { tipTotal: 0, rank: 'chill' }; } userData[userName].tipTotal += tip.amount; const prevRank = userData[userName].rank; const newRank = getRank(userData[userName].tipTotal); userData[userName].rank = newRank; if (prevRank !== newRank) { cb.chatNotice(`✨ ${tip.fromUser} leveled UP from ${prevRank.toUpperCase()} to ${newRank.toUpperCase()}! ${getEmoji(newRank)}`); } }; cb.onMessage = function (msg) { checkReset(); if (!msg || !msg.text) return; // Followers-only chat gate if (cb.settings.follower_gate === 'yes' && !msg.user.isFollower) { cb.sendNotice(`${msg.user.name}, chat is for followers only. Please follow thekodyy to participate.`); return false; } if (!canUserSendMessage(msg.user)) return false; const blockedWord = containsBlockedWord(msg.text); if (blockedWord) { cb.sendNotice(`${msg.user.name}, your message contains a blocked word: "${blockedWord}" and was not sent.`); return false; } const userName = msg.user.name.toLowerCase(); if (!userData[userName]) { userData[userName] = { tipTotal: 0, rank: 'chill' }; } const rank = getRank(userData[userName].tipTotal); const emoji = getEmoji(rank); const tipCount = userData[userName].tipTotal; // Rewrite message with rank emoji and tip count const newText = `${emoji} ${msg.user.name} (${tipCount} tokens tipped): ${msg.text}`; msg.text = newText; cb.appendMessage(msg); return false; };
© Copyright Chaturbate 2011- 2026. All Rights Reserved.