Apps Home
|
Create an App
Tip Goal Tracker Bot
Author:
seattlescarletjojo
Description
Source Code
Launch App
Current Users
Created by:
Seattlescarletjojo
// Bot settings cb.settings_choices = [ {name: 'tip_goal', type: 'int', minValue: 1, maxValue: 10000, defaultValue: 500, label: 'Tip Goal'}, {name: 'milestone_interval', type: 'int', minValue: 10, maxValue: 1000, defaultValue: 100, label: 'Milestone Interval'}, {name: 'goal_message', type: 'str', minLength: 1, maxLength: 256, defaultValue: '🎉 We did it! Tip goal reached! 🎉', label: 'Message When Goal Is Reached'}, {name: 'milestone_message', type: 'str', minLength: 1, maxLength: 256, defaultValue: '💰 We’ve hit [milestone] tokens so far! Let’s keep going!', label: 'Milestone Announcement Message'} ]; // Variables to track tips and milestones let currentTips = 0; let nextMilestone = cb.settings.milestone_interval; // Function to announce progress function announceMilestone() { let milestoneMessage = cb.settings.milestone_message.replace("[milestone]", currentTips); cb.sendNotice(milestoneMessage); } // Handle tips and track progress cb.onTip(function(tip) { currentTips += tip['amount']; // Check if the milestone is reached if (currentTips >= nextMilestone) { announceMilestone(); nextMilestone += cb.settings.milestone_interval; } // Check if the goal is reached if (currentTips >= cb.settings.tip_goal) { cb.sendNotice(cb.settings.goal_message); currentTips = 0; // Reset tips after reaching the goal nextMilestone = cb.settings.milestone_interval; // Reset the milestone tracker } }); // Announce the starting goal cb.sendNotice("🎯 Let's hit " + cb.settings.tip_goal + " tokens! Every tip counts toward the goal!");
© Copyright Camscaster.Com 2011- 2025. All Rights Reserved.