Apps Home
|
Create an App
followw
Author:
zashirt
Description
Source Code
Launch App
Current Users
Created by:
Zashirt
/** * App: Ask for Follow * Version: 1.1 * Author: Custom * Date: 14.09.24 */ var followMessage = 'Hey, I noticed that you are not following me. If you are enjoying it, please follow so you won\'t miss my next shows!'; // Define settings choices if you want the model to configure the follow message cb.settings_choices = [ {name:'custom_follow_message', type:'str', label:'Custom follow message for non-followers', defaultValue:'Hey, I noticed that you are not following me. If you are enjoying it, please follow so you won\'t miss my next shows!'} ]; // Function to check if the user is a moderator or model function isModOrModel(user) { return user['is_mod'] || user['is_model']; } // Function to send a message to users who are not following function sendFollowRequestToNonFollowers() { var users = cb.getRoomUsers(); // Get all users currently in the room for (var i = 0; i < users.length; i++) { var user = users[i]; if (!user['is_following']) { // Check if the user is NOT following cb.sendNotice(cb.settings.custom_follow_message || followMessage, user['user'], '#00FF00', '#000000', 'bold'); } } } // Handle messages cb.onMessage(function (msg) { // Check if the message is the /askfollow command if (msg['m'].match(/\/askfollow/i)) { // Prevent the message from being sent to the chat msg['X-Spam'] = true; // Check if the user is a moderator or the model if (isModOrModel(msg['user'])) { // Send follow request only to non-followers sendFollowRequestToNonFollowers(); } else { // Send a notice to the user that they are not authorized to use the command cb.sendNotice('You are not authorized to use this command.', msg['user'], '#FF0000', '#000000', 'bold'); } } return msg; }); // Initialize the app with the custom follow message function init() { followMessage = cb.settings.custom_follow_message || followMessage; cb.sendNotice('The model or moderators can use the /askfollow command to ask non-followers to follow!', '', '#00FF00', '#000000', 'bold'); } // Run the initialization function init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.