From d1ab6e9da5daca96f8eb36ce9f427e365335f46d Mon Sep 17 00:00:00 2001 From: Bioblaze Payne Date: Sat, 5 Sep 2020 22:08:24 -0700 Subject: [PATCH] Updated Shit for Release --- index.js | 3 +- modules/Bot.js | 279 +++++++++++++++++- plugins/casino/README.md | 7 - plugins/casino/cFunctions.js | 45 --- plugins/casino/casino.js | 30 -- plugins/casino/casino.json | 3 - plugins/casino/plugins/blackjack/README.md | 11 - plugins/casino/plugins/blackjack/blackjack.js | 244 --------------- .../casino/plugins/blackjack/blackjack.json | 3 - plugins/casino/plugins/dice/README.md | 7 - plugins/casino/plugins/dice/dice.js | 102 ------- plugins/casino/plugins/dice/dice.json | 3 - plugins/casino/plugins/gamble/README.md | 7 - plugins/casino/plugins/gamble/gamble.js | 86 ------ plugins/casino/plugins/gamble/gamble.json | 3 - plugins/casino/plugins/slots/README.md | 7 - plugins/casino/plugins/slots/slots.js | 182 ------------ plugins/casino/plugins/slots/slots.json | 3 - plugins/casino/plugins/wheel/README.md | 5 - plugins/casino/plugins/wheel/wheel.js | 125 -------- plugins/casino/plugins/wheel/wheel.json | 3 - plugins/eventlog/eventlog.js | 30 +- 22 files changed, 295 insertions(+), 893 deletions(-) delete mode 100644 plugins/casino/README.md delete mode 100644 plugins/casino/cFunctions.js delete mode 100644 plugins/casino/casino.js delete mode 100644 plugins/casino/casino.json delete mode 100644 plugins/casino/plugins/blackjack/README.md delete mode 100644 plugins/casino/plugins/blackjack/blackjack.js delete mode 100644 plugins/casino/plugins/blackjack/blackjack.json delete mode 100644 plugins/casino/plugins/dice/README.md delete mode 100644 plugins/casino/plugins/dice/dice.js delete mode 100644 plugins/casino/plugins/dice/dice.json delete mode 100644 plugins/casino/plugins/gamble/README.md delete mode 100644 plugins/casino/plugins/gamble/gamble.js delete mode 100644 plugins/casino/plugins/gamble/gamble.json delete mode 100644 plugins/casino/plugins/slots/README.md delete mode 100644 plugins/casino/plugins/slots/slots.js delete mode 100644 plugins/casino/plugins/slots/slots.json delete mode 100644 plugins/casino/plugins/wheel/README.md delete mode 100644 plugins/casino/plugins/wheel/wheel.js delete mode 100644 plugins/casino/plugins/wheel/wheel.json diff --git a/index.js b/index.js index eab7044a..65fbaa13 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ const path = require('path'); const util = require('util'); const trovojs = require('trovo.js'); -const BottomBar = require('inquirer/lib/ui/bottom-bar'); var DEV = false; @@ -117,7 +116,7 @@ client.on('chatMessage', (message) => { client.sendMessage(Bot.translate("bot.contact_creator")); } }).catch((e) => { - console.log(e); + Bot.log(e); if (e) { client.sendMessage(Bot.translate("bot.process_error", { err: e diff --git a/modules/Bot.js b/modules/Bot.js index 6f39c526..771c68fc 100644 --- a/modules/Bot.js +++ b/modules/Bot.js @@ -1113,9 +1113,100 @@ Bot.prototype.defaultFallbackLocalization = () => { "chatlog": { "activated": "Chatlog Processor Activated.", "deactivated": "Chatlog Processor Deactivated." + }, + "jsoncommands":{ + "plugins":{ + "create":{ + "exists_error" : "{com} already exists!", + "error_writing": "Error writing {fileName} : {error}", + "no_args":"You didn't specify a response", + "created": "Command: {com} , has been added.", + "activated": "jsoncommands - Create plugin has been Activated.", + "deactivated": "jsoncommands - Create plugin has been Activated." + }, + "edit":{ + "edited":"Command {command}, has been edited.", + "error_writing": "Error writing {fileName} : {error}", + "no_args":"You didn't specify a response", + "no_command":"{command} doesn't exist or is a pre-installed command", + "activated": "jsoncommands - Edit Plugin Activated", + "deactivated": "jsoncommands - Edit Plugin Deactivated" + }, + "delete":{ + "no_command":"{command} doesn't exist or is a pre-installed command", + "error_writing": "Error writing {fileName} : {error}", + "deleted":"Command {command}, has been deleted", + "activated":"jsoncommands - Delete Plugin Activated", + "deactivated": "jsoncommands - Delete Plugin Deactivated" + } + }, + "activated": "Json Commands has been Activated.", + "deactivated": "Json Commands has been Deactivated.", + "no_command": "{command} doesn't exist or is a pre-installed command", + "existsError": "{com} already exists!", + "no_args" : "You didn't specify a response", + "errorEditing": "You didn't specify what you'd like to edit the command to.", + "errorWriting": "Error writing {fileName} : {error}", + "created": "Command: {command}, has been added.", + "edited": "Command {command}, has been edited.", + "deleted": "Command {command}, has been deleted" + }, + "user_info": + { + "activated": "User Information has been Activated", + "deactivated" : "User Information has been Deactivated", + "plugins": + { + "adding": + { + "error_user": "Please @ a user to give them points. ex: !add @user 1000", + "success": "{user} has added {ammount} points to {receiver} balance. They now have: {points} points", + "activated": "Add Plugin activated", + "deactivated": "Add Plugin deactivated" + }, + "give": + { + "success": "{user} has given {ammount} points to {receiver}", + "insufficient_funds": "{user} you do not have enough points to give away. Please do !points to see your current points.", + "negative": "You cannot give a user negative points.", + "error_user": "Please @ a user to give them points. ex: !give @user 1000", + "activated": "Give Plugin activated", + "deactivated": "Give Plugin deactivated" + }, + "points": + { + "activated": "Points Plugin has been activated", + "deactivated": "Points Plugins has been deactivated", + "message": "@{user} has {points} points." + }, + "level": + { + "activated": "Level Plugin has been activated", + "deactivated": "Level Plugins has been deactivated", + "message": "@{user} is level: {level} (XP: {xp}/{goal})." + }, + "seen": + { + "activated": "Seen Plugin Activated", + "deactivated":"Seen Plugin Deactivated", + "message": "@{user} was last seen: {seen}", + "no_args":"You didn't specify a user." + } + } } }, "plugins": { + "8ball": + { + "activated": "8-Ball Plugin Activated", + "deactivated": "8-ball Plugin Deactivated" + }, + "alerts": + { + "activated" : "Alerts have been Activated", + "deactivated" : "Alerts have been Deactivated", + "error_writing" : "Error writing {fileName} : {error}" + }, "bot": { "activated": "Bot Information Plugin Activated", "deactivated": "Bot Information Plugin Deactivated", @@ -1125,11 +1216,112 @@ Bot.prototype.defaultFallbackLocalization = () => { "consolecommand": "This bot was created by Bioblaze Payne", "consolecommanddesc": "Tells you information about the Bot itself." }, + "casino": { + "activated": "Casino Games Pack Activated", + "deactivated": "Casino Games Pack Deactivated", + "message": "Welcome to the casino, check out our games: Blackjack, dice, slots & wheel.", + "plugins": + { + "blackjack": + { + "activated": "Casino - Blackjack Game Activated", + "deactivated": "Casino - Blackjack Game Deactivated", + "you_lost": "Unfortunately you lost.", + "player_blackjack": "Blackjack! You have earned {playerBet} points.", + "player_hand": "Your hand: ${cards} (Total: ${total})", + "dealer_hand": "Dealers Hand: {dealer_hand}", + "dealerfinishdraw" : "The dealer has finished drawing cards and his hand contains: {dealerHandString}(Total: {dealerTotalH})", + "dealer_blackjack": "Dealer Blackjack! You lose", + "dealer_bust": "Dealer's hand passed 21. You won {playerBetH} Points.", + "instructions": "Please use '!blackjack stand' to keep your hand as is or '!blackjack hit' to be dealt an additional card.", + "draw": "The results are equal. You got your points back.", + "win": "Congratulations, You won {playerBetH} points.", + "no_points": "You don't have enough points to play.", + "new_hand": "Your new hand: {handString} (Total: {playerTotalH})", + "error_bet": "Please enter a valid number.", + "progress": "Please finish the game you started first.", + "banned": "We are sorry, you have been banned from our casino." + }, + "dice": + { + "activated": "Casino - Dice Game Activated", + "deactivated": "Casino - Dice Game Deactivated", + "error_bet": "Please enter a valid number.", + "banned": "We are sorry, you have been banned from our casino. @{user}", + "balance": "You don't have enough points to play. @{user}", + "min_bet": "Please enter a valid bet amount. Minimum amount is 20 points. @{user}", + "results": "Dice you rolled: {playerDice1}, {playerDice2} (Total: {playerTotal}).\nCasino dice: {dealerDice1}, {dealerDice2} (Total: {dealerTotal}).", + "lose": "Unfortunately you lost @{user}", + "draw": "The results are equal. You got your points back. @{user}", + "win":"Congratulations, You won {playerBetH} points. @{user}" + }, + "gamble": + { + "activated": "Casino - Gamble Game Activated", + "deactivated": "Casino - Gamble Game Deactivated", + "error_bet": "Please enter a valid number or all.", + "banned": "We are sorry, you have been banned from our casino. @{user}", + "balance": "You don't have enough points to gamble. @{user}", + "min_bet": "Please enter a valid gamble amount. Minimum amount is 100 points. @{user}", + "win":"Congratulations, You won {win} points. @{user}" + }, + "slots": + { + "activated": "Casino - Slots Game Activated", + "deactivated": "Casino - Slots Game Deactivated", + "banned": "We are sorry, you have been banned from our casino. @{user}", + "error_bet":"Please enter a valid number.", + "balance":"You don't have enough points to play. @{user}", + "min_bet":"Please enter a valid bet amount. Minimum amount is 100 points. @{user}", + "win": "Congratulations, You won {playerBet} points. @{user}" + }, + "wheel": + { + "activated":"Casino - Wheel Game Activated", + "deactivated": "Casino - Wheel Game Deactivated", + "banned":"We are sorry, you have been banned from our casino. @{user}", + "typo": "Correct Usage: !wheel <1, 2, 5, 10, 20> @{user}", + "balance":"You don't have enough points to play. @{user}", + "min_bet":"Please enter a valid bet amount. Minimum amount is 100 points. @{user}", + "spun": "The wheel has been spun and it points ${wheel}. @{user}", + "win":"Congratulations, You won {playerBet} points. @{user}", + "lose":"Unfortunately you lost @{user}" + } + } + }, + "google": { + "activated": "Google search has been Activated", + "deactivated": "Google search has been Deactivated", + "processed": "@{user} - {result}", + "args": "Example Usage: = !google search , !google random" + }, + "gamep": { + "activated": "game picker has been Activated", + "deactivated": "game picker has been Deactivated", + "processed": "@{user} randomly picked {result}", + "incorrect": "@{user} incorrect argument user must use 'pick' to initiate game randomizer" + }, + "hydrate": { + "activated": "Hydrate has been Activated", + "deactivated": "Hydrate has been Deactivated", + "error": "Hydrate Error: {error}", + "start": "Great, I will make sure the streamer stays hydrated! 💧", + "interval": "Streamer, I recommend you drink some water! I will remind you again in 30 minutes" + }, + "instagram": { + "activated": "IG has been Activated", + "deactivated": "IGhas been Deactivated", + "error": "IG Error: {error}", + "info": "@{user} streamer's latest instagram post - https://www.instagram.com/p/{result}" + }, "shoutout": { "activated": "Shout-out has been Activated", "deactivated": "Shout-out has been Deactivated", "mentionuser": "Check out {mention} at https://trovo.live/{user} - They are an awesome streamer and deserve some community love!", - "mentionaccount": "Check out {account} at https://trovo.live/{account} - They are an awesome streamer and deserve some community love!" + "mentionaccount": "Check out {account} at https://trovo.live/{account} - They are an awesome streamer and deserve some community love!", + "args": "Example Usage: = !so default , !so raid ", + "raid": "This is a raid. Go to the channel of @{raidedChannel} now. --> https://trovo.live/{raidedChannel}", + "undefined": "Username is missing. Try again" }, "say": { "activated": "Say has been Activated", @@ -1140,6 +1332,63 @@ Bot.prototype.defaultFallbackLocalization = () => { "activated": "Ping has been Activated", "deactivated": "Ping has been Deactivated", "pong": "@{user} Pong I dare say." + }, + "time": + { + "activated":"Time Plugin has been Activated", + "deactivated": "Time Plugin has been Deactivated", + "message" : "The streamers local time is: {time}" + }, + "poll": { + "activated": "Poll System aktivated", + "deactivated": "Poll System Deactivated", + "permissions": "You don't have permission to do that!", + "pollstarted": "Poll started, type !poll {votelist}", + "startUsage": "Usage: !poll start ...", + "pollRunning": "Poll already running", + "pollstopped": "Poll is finished. Winner is:", + "results": "{voteItem}: {votes}", + "pollNotRunning": "There is no poll running!", + "alreadyVoted": "Only 1 vote for each User. @{user}", + "startFailed": "The start failed, please try again", + "missingargs": "Usage: !poll | getList | Moderator & creator: {commandlist}", + "somethingsWrong": "Something went wrong try again or contact the Streamer or the Mods", + "itemNotInList": "{item} is not in the Votelist. Type: !poll getList to see a list of items to vote for", + "sameValues": "Vote items can't be the same Values poll will be reseted", + "uservoted": "Thanks for Voting. @{user}", + "voteReseted": "The vote has stopped and the List was cleared!", + "winner": "{name} with {votes} votes!" + }, + "urbandictionary": { + "activated": "Urbandictionary has been Activated", + "deactivated": "Urbandictionary has been Deactivated", + "error": "Urbandictionary Error: {error}", + "info": "@{user} {word} - {definition}" + }, + "warzone": { + "activated": "Warzone Stats has been Activated", + "deactivated": "Warzone Stats has been Deactivated", + "error": "Warzone Stats Error: {error}", + "info": "@{user} Here are my Warzone Stats:\r Kills: {kills}\r Deaths: {deaths}\rK/D Ratio: {kdr}\rWins: {wins}\r Top 5 Placements: {top5}\r Top 10 Placements: {top10}\r I played {totma} rounds\r On average I live for: {avgLife}\r I am currently level {level}" + }, + "xkcd": { + "activated": "XKCD has been Activated", + "deactivated": "XKCD has been Deactivated", + "error": "XKCD Error: {error}", + "processed": "@{user} - {result}" + }, + "giveaway": + { + "activated": "Giveaway activated", + "deactivated": "Giveaway deactivated", + "started": "Giveaway started you have {h}:{m}:{s} to type !join", + "runningGiveaway": "You still have time to type !join", + "winner": "The Giveaway winner is {user}", + "noOneJoined": "No one Joined the Giveaway", + "noTime": "You need to set a Time for the Giveaway", + "userExists": "You can only join the Giveaway 1 Time", + "userJoined": "User {username} joined the Giveaway", + "notRunning": "There is no Giveaway at the moment" } }, "services": { @@ -1156,7 +1405,16 @@ Bot.prototype.defaultFallbackLocalization = () => { "deactivated": "OBS Service Deactivated", "connected": "Connected to OBS", "retry_attempt": "Unable to connect to OBS. Attempting to reconnect: {count} of {max}", - "stopping_retry": "Stopping OBS connection attempts" + "stopping_retry": "Stopping OBS connection attempts", + "no_source": "Couldn't find Source: {source} in Scene: {scene}" + }, + "slobs": + { + "activated": "SLOBS Service Activated", + "deactivated": "SLOBS Service Deactivated", + "error": "Slobs Error: {error}", + "close": "Slobs Closed. Reason: {close}", + "connected": "Connected to SLOBS" }, "http": { "activated": "HTTP Overlay Module Started on Port({settings.port})", @@ -1176,10 +1434,12 @@ Bot.prototype.defaultFallbackLocalization = () => { "status": "STATUS", "state": "STATE", "plugin_load_access_error": "Error Accessing Plugin Directory ({directory})\r\nError: {err}", + "plugin_unload_access_error": "Error Accessing a Plugin Directory ({directory})\r\nError: {err}", "active": "Active", "inactive": "In-active", "loaded": "LOADED", "plugin_load_try_error": "Error Attempting to Load Plugin({name}) located at: {dir}\r\nError: {err}", + "plugin_unload_try_error": "Error Attempting to Load Plugin({name}) located at: {dir}\r\nError: {err}", "get_plugin_error": "Invalid Plugin Requested. Check your spelling for Plugin: {plugin}", "get_processor_error": "Invalid Processor Requested. Check your spelling for Processor: {processor}", "get_service_error": "Invalid Service Requested. Check your spelling for Service: {service}", @@ -1223,7 +1483,7 @@ Bot.prototype.defaultFallbackLocalization = () => { "processor_deactivate_desc": "Deactivates a Processor.", "deactivate_all_processors_desc": "Deactivates all Processors.", "activate_all_processors_desc": "Activates all Processors.", - "processor_already_active": "Processor already Active, cannot active processor.", + "processor_already_active": "Processor already Active, cannot active processor.", "processor_activated": "Activated Processor, and updated Settings file for the Processor.", "processor_activated_error": "Error while trying to Activate Processor({name})\r\nError: {e}", "processor_already_inactive": "Processor already Inactive, cannot deactivate processor.", @@ -1231,8 +1491,8 @@ Bot.prototype.defaultFallbackLocalization = () => { "processor_deactivated_error": "Error while trying to Deactivate Processor({name})\r\nError: {e}", "processors_deactivated": "All Processors Deactivated, and updated the Settings file for each Processor.", "processors_activated": "All Processors Activated, and updated the Settings file for each Processor.", - "reloaded_processor": "Reloaded Processor~", - "processor_name_invalid": "No Processor found by that name, please check your Spelling and try again.", + "reloaded_processor": "Reloaded Processor~", + "processor_name_invalid": "No Processor found by that name, please check your Spelling and try again.", "service_info_desc": "Gives you information on a Service within the System~", "services_desc": "Displays a List of all Services within Trovobot, that are LOADED.", "service_reload_desc": "Reloads a specific Service.", @@ -1240,7 +1500,7 @@ Bot.prototype.defaultFallbackLocalization = () => { "service_deactivate_desc": "Deactivates a Service.", "deactivate_all_services_desc": "Deactivates all Services.", "activate_all_services_desc": "Activates all Services.", - "service_already_active": "Service already Active, cannot active service.", + "service_already_active": "Service already Active, cannot active service.", "service_activated": "Activated Service, and updated Settings file for the Service.", "service_activated_error": "Error while trying to Activate Service({name})\r\nError: {e}", "service_already_inactive": "Service already Inactive, cannot deactivate service.", @@ -1248,8 +1508,8 @@ Bot.prototype.defaultFallbackLocalization = () => { "service_deactivated_error": "Error while trying to Deactivate Service({name})\r\nError: {e}", "services_deactivated": "All Services Deactivated, and updated the Settings file for each Service.", "services_activated": "All Services Activated, and updated the Settings file for each Service.", - "reloaded_service": "Reloaded Service~", - "service_name_invalid": "No Service found by that name, please check your Spelling and try again.", + "reloaded_service": "Reloaded Service~", + "service_name_invalid": "No Service found by that name, please check your Spelling and try again.", "setlang_console": "Sets the Language in the System", "setlang_invalid": "That is a invalid Language Option please try one of these Options: {langs}", "setlang_switch": "Changed Language to ({to}) from Language ({from})", @@ -1269,7 +1529,8 @@ Bot.prototype.defaultFallbackLocalization = () => { "setup_failed": "Failed to Setup\r\nError: {err}", "setup_console": "Allows you to Setup the Settings.json from the Console directly." } - }); + } + ); } module.exports = (() => { diff --git a/plugins/casino/README.md b/plugins/casino/README.md deleted file mode 100644 index 25b2e941..00000000 --- a/plugins/casino/README.md +++ /dev/null @@ -1,7 +0,0 @@ - - -Plugin Pack by Ulash Trovo: https://trovo.live/ulash Discord: Ulash#3836 Donate: https://trovo.live/ulash <3 - -Description: Free Huge Casino Pack - -Commands: !casino diff --git a/plugins/casino/cFunctions.js b/plugins/casino/cFunctions.js deleted file mode 100644 index 75fd0b60..00000000 --- a/plugins/casino/cFunctions.js +++ /dev/null @@ -1,45 +0,0 @@ -const bannedUsers = []; - -// For Generating Random Number -function randomNumber() { - return Math.random(); -} - -// Checking for is randomNumber number or not -function isNumeric(num) { - return !isNaN(num); -} - -// Blackjack hand calculating command -function calculateHand(hand) { - const cardNumber = hand.length; - let handSize = 0; - let ace = false; - - for (let i = 0; i < cardNumber; i++) { - if (hand[i] === 'A') { - handSize += 1; - ace = true; - } else if (hand[i] === 'K' || hand[i] === 'Q' || hand[i] === 'J') { - handSize += 10; - } else { - handSize += parseInt(hand[i], 10); - } - } - - if (ace === true && handSize + 10 < 22) { - handSize += 10; - } - - return handSize; -} - -function checkBanned(uid) { - if (bannedUsers.includes(uid)) { - return true; - } - - return false; -} - -module.exports = { randomNumber, isNumeric, calculateHand, checkBanned }; \ No newline at end of file diff --git a/plugins/casino/casino.js b/plugins/casino/casino.js deleted file mode 100644 index fb71e543..00000000 --- a/plugins/casino/casino.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('../../modules/Bot.js'); - -module.exports = { - name: 'Casino Games Pack', // Name of the Plugin - description: "Casino Games Pack", - author: "Original By Ulash. Updated by Krammy", - license: "Apache-2.0", - command: 'casino', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 10, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - client.sendMessage(Bot.translate("plugins.casino.message", { - user: data.user - })); - }, - activate() { - if (fs.existsSync(path.join(__dirname, 'plugins'))) { - Bot.loadPlugins(path.join(__dirname, 'plugins')); - } - Bot.log(Bot.translate("plugins.casino.activated")) - }, - deactivate() { - if (fs.existsSync(path.join(__dirname, 'plugins'))) { - Bot.unloadPlugins(path.join(__dirname, 'plugins')); - } - Bot.log(Bot.translate("plugins.casino.deactivated")) - } -}; diff --git a/plugins/casino/casino.json b/plugins/casino/casino.json deleted file mode 100644 index 1479d270..00000000 --- a/plugins/casino/casino.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "active": true -} \ No newline at end of file diff --git a/plugins/casino/plugins/blackjack/README.md b/plugins/casino/plugins/blackjack/README.md deleted file mode 100644 index a7e8045b..00000000 --- a/plugins/casino/plugins/blackjack/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Plugin Pack by Ulash Trovo: https://trovo.live/ulash Discord: Ulash#3836 Donate: https://trovo.live/ulash <3 - -Updated to 2.0.0 by: Krammy - -Description: Free Huge Casino Pack - -Command: !blackjack amount - -For draw a new card !blackjack hit - -For finish !blackjack stand diff --git a/plugins/casino/plugins/blackjack/blackjack.js b/plugins/casino/plugins/blackjack/blackjack.js deleted file mode 100644 index 8c629fc3..00000000 --- a/plugins/casino/plugins/blackjack/blackjack.js +++ /dev/null @@ -1,244 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('./../../../../modules/Bot.js'); -const deck = ['A', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'K', 'Q']; -var cFunctions = null; -var userInfo = null; - -function reset(data) -{ - userInfo[data.user].playingBlackjack = false; - userInfo[data.user].blackjackDealerHand = []; - userInfo[data.user].blackjackHand = []; - userInfo[data.user].blackjackBet = 0; -} -function hit(client, data) -{ - let handString = ' '; - let dealerHandString = ' '; - if (userInfo[data.user].playingBlackjack === false) { - return; - } - const playerBetH = userInfo[data.user].blackjackBet; - - userInfo[data.user].blackjackHand.push(deck[Math.floor(cFunctions.randomNumber() * 11)]); - const playerTotalH = cFunctions.calculateHand(userInfo[data.user].blackjackHand); - - for (let n = 0; n < userInfo[data.user].blackjackHand.length; n++) { - handString += `${userInfo[data.user].blackjackHand[n]}, `; - } - - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.new_hand", { - handString : handString, - playerTotalH : playerTotalH - })); - - if (playerTotalH > 21) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.you_lost")); - reset(data); - } - - else if (playerTotalH === 21) { - let dealerTotalH = cFunctions.calculateHand(userInfo[data.user].blackjackDealerHand); - while (dealerTotalH < 17) { - userInfo[data.user].blackjackDealerHand.push(deck[Math.floor(cFunctions.randomNumber() * 11)]); - dealerTotalH = cFunctions.calculateHand(userInfo[data.user].blackjackDealerHand); - } - - for (let nn = 0; nn < userInfo[data.user].blackjackDealerHand.length; nn++) { - dealerHandString += `${userInfo[data.user].blackjackDealerHand[nn]}, `; - } - - client.sendMessage(Bot.translate( "plugins.casino.plugins.blackjack.dealerfinishdraw", { - dealerHandString: dealerHandString, - dealerTotalH: dealerTotalH - } - )); - - if (dealerTotalH > 21) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.dealer_bust", - { - playerBetH: (playerBetH* 2) - } - )); - userInfo[data.user].points += playerBetH * 2; - reset(data); - } - if (dealerTotalH === playerTotalH) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.draw")); - userInfo[data.user].points += playerBetH; - reset(data); - } - if (playerTotalH > dealerTotalH) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.win", - { - playerBetH: (playerBetH * 2) - })); - userInfo[data.user].points += playerBetH * 2; - reset(data); - } - if (playerTotalH < dealerTotalH) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.you_lost")); - reset(data); - } - } -} -function stand(client, data) -{ - if (userInfo[data.user].playingBlackjack === false) { - return; - } - - const playerBetS = userInfo[data.user].blackjackBet; - - const playerTotalS = cFunctions.calculateHand(userInfo[data.user].blackjackHand); - - let dealerTotalS = cFunctions.calculateHand(userInfo[data.user].blackjackDealerHand); - while (dealerTotalS < 17) { - userInfo[data.user].blackjackDealerHand.push(deck[Math.floor(cFunctions.randomNumber() * 11)]); - dealerTotalS = cFunctions.calculateHand(userInfo[data.user].blackjackDealerHand); - } - - var dealerHandString = ' '; - for (let nnn = 0; nnn < userInfo[data.user].blackjackDealerHand.length; nnn++) { - dealerHandString += `${userInfo[data.user].blackjackDealerHand[nnn]}, `; - } - - client.sendMessage( - Bot.translate( "plugins.casino.plugins.blackjack.dealerfinishdraw", { - dealerHandString: dealerHandString, - dealerTotalH: dealerTotalS - })); - - if (dealerTotalS > 21) { - playerBetH = playerBetH * 2; - client.sendMessage( - Bot.translate("plugins.casino.plugins.blackjack.dealer_bust", - { - playerBetH: playerBetH - } - )); - userInfo[data.user].points += playerBetS; - reset(data); - } else if (dealerTotalS === playerTotalS) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.draw")); - userInfo[data.user].points += playerBetS; - reset(data); - } else if (playerTotalS > dealerTotalS) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.win", - { - playerBetH: (playerBetH * 2) - })); - userInfo[data.user].points += playerBetS * 2; - reset(data); - } else if (playerTotalS < dealerTotalS) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.you_lost")); - reset(data); - } -} -function setup(client, data) -{ - // The entered bet is immediately decreasing and saved. - const playerBet = parseInt(data.args[0], 10); - userInfo[data.user].blackjackBet = playerBet; - userInfo[data.user].points = parseInt(userInfo[data.user].points) - parseInt(playerBet); - userInfo[data.user].playingBlackjack = true; - - // Hands are dealt - for (let n = 0; n < 2; n++) { - userInfo[data.user].blackjackHand.push(deck[Math.floor(cFunctions.randomNumber() * 11)]); - userInfo[data.user].blackjackDealerHand.push(deck[Math.floor(cFunctions.randomNumber() * 11)]); - } - - // Calculating hands - const playerTotal = cFunctions.calculateHand(userInfo[data.user].blackjackHand); - const dealerTotal = cFunctions.calculateHand(userInfo[data.user].blackjackDealerHand); - - client.sendMessage( - (Bot.translate("plugins.casino.plugins.blackjack.player_hand"), - { - cards: userInfo[data.user].blackjackHand.join(","), - total: playerTotal - } - )); - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.dealer_hand", - { - dealer_hand: userInfo[data.user].blackjackDealerHand[0] - })); - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.instructions" -)); - - // If it is 21, won immediately - if (playerTotal === 21) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.player_blackjack", - { - playerBet:playerBet - })); - userInfo[data.user].points = parseInt(userInfo[data.user].points) + parseInt(playerBet * 3); - reset(data); - } - else if (dealerTotal === 21) - { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.dealer_blackjack")); - reset(data); - } -} - -module.exports = { - name: 'blackjack', // Name of the Plugin - description: "Blackjack game plugin", - author: "Original by Ulash. Updated by Krammy", - license: "Apache-2.0", - command: 'blackjack', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 5, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - - if (data.args[0] === 'hit') - { - hit(client, data); - } - else if (data.args[0] === 'stand') - { - stand(client, data); - } - else{ - - //Check if user banned from playing - if (cFunctions.checkBanned(data.user) === true) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.banned")); - } - - //Check if user already playing - else if (userInfo[data.user].playingBlackjack === true) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.progress")); - } - - // Waiting for like to enter a bet amount like !blackjack 1000 - else if (cFunctions.isNumeric(data.args[0]) === false) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.error_bet")); - } - //Check points - else if (parseInt(data.args[0], 10) > userInfo[data.user].points) { - client.sendMessage(Bot.translate("plugins.casino.plugins.blackjack.new_hand")); - } - //Start Game - else - { - setup(client,data); - } - - } - }, - activate() { - userInfo = require(path.join(Bot.root, 'data/users/users.json')); - cFunctions = require('../../cFunctions.js'); - Bot.log(Bot.translate("plugins.casino.plugins.blackjack.activated")) - }, - deactivate() { - userInfo = null; - cFunctions = null; - Bot.log(Bot.translate("plugins.casino.plugins.blackjack.deactivated")) - } - }; - \ No newline at end of file diff --git a/plugins/casino/plugins/blackjack/blackjack.json b/plugins/casino/plugins/blackjack/blackjack.json deleted file mode 100644 index ff4e0d2a..00000000 --- a/plugins/casino/plugins/blackjack/blackjack.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "active" : true -} \ No newline at end of file diff --git a/plugins/casino/plugins/dice/README.md b/plugins/casino/plugins/dice/README.md deleted file mode 100644 index 78a08fdb..00000000 --- a/plugins/casino/plugins/dice/README.md +++ /dev/null @@ -1,7 +0,0 @@ - - -Plugin Pack by Ulash Trovo: https://trovo.live/ulash Discord: Ulash#3836 Donate: https://trovo.live/ulash <3 - -Description: Free Huge Casino Pack - -Command: !dice amount diff --git a/plugins/casino/plugins/dice/dice.js b/plugins/casino/plugins/dice/dice.js deleted file mode 100644 index 5768f669..00000000 --- a/plugins/casino/plugins/dice/dice.js +++ /dev/null @@ -1,102 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('./../../../../modules/Bot.js'); -var cFunctions = null; -var userInfo = null; - - - -module.exports = { - name: 'dice', // Name of the Plugin - description: "Dice game plugin", - author: "Original by Ulash. Updated by Krammy", - license: "Apache-2.0", - command: 'dice', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 5, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - if (cFunctions.checkBanned(data.user) === true) - return client.sendMessage(Bot.translate("plugins.casino.plugins.dice.banned", - { - user: data.user - })); - - if (cFunctions.isNumeric(data.args[0]) === false) { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.error_bet")); - return; - } - - const playerBet = parseInt(data.args[0], 10); - - if (playerBet > userInfo[data.user].points) { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.balance", - { - user: data.user - })); - return; - } - if (playerBet < 20) { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.min_bet", - { - user: data.user - }) - ); - return; - } - - userInfo[data.user].commandDate = new Date(); - - userInfo[data.user].points -= playerBet; - - const playerDice1 = Math.floor(cFunctions.randomNumber() * 6 + 1); - const playerDice2 = Math.floor(cFunctions.randomNumber() * 6 + 1); - const playerTotal = playerDice1 + playerDice2; - - const dealerDice1 = Math.floor(cFunctions.randomNumber() * 6 + 1); - const dealerDice2 = Math.floor(cFunctions.randomNumber() * 6 + 1); - const dealerTotal = dealerDice1 + dealerDice2; - - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.results", - { - playerDice1: playerDice1, - playerDice2: playerDice2, - playerTotal: playerTotal, - dealerDice1: dealerDice1, - dealerDice2: dealerDice2, - dealerTotal: dealerTotal - } - )); - - if (playerTotal < dealerTotal) { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.lose", - { - user: data.user - })); - } else if (playerTotal === dealerTotal) { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.draw", - { - user: data.user - })); - userInfo[data.user].points += playerBet; - } else { - client.sendMessage(Bot.translate("plugins.casino.plugins.dice.win", - { - playerBetH : (playerBet * 2), - user : data.user - })); - userInfo[data.user].points += 2 * playerBet; - } - }, - - activate() { - userInfo = require(path.join(Bot.root, 'data/users/users.json')); - cFunctions = require('../../cFunctions.js'); - Bot.log(Bot.translate("plugins.casino.plugins.dice.activated")) - }, - - deactivate() { - userInfo = null; - cFunctions = null; - Bot.log(Bot.translate("plugins.casino.plugins.dice.deactivated")) - } -} \ No newline at end of file diff --git a/plugins/casino/plugins/dice/dice.json b/plugins/casino/plugins/dice/dice.json deleted file mode 100644 index d8723734..00000000 --- a/plugins/casino/plugins/dice/dice.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "activate" : true -} \ No newline at end of file diff --git a/plugins/casino/plugins/gamble/README.md b/plugins/casino/plugins/gamble/README.md deleted file mode 100644 index 4bdcc142..00000000 --- a/plugins/casino/plugins/gamble/README.md +++ /dev/null @@ -1,7 +0,0 @@ -Plugin Pack by Krammy - -Trovo: https://trovo.live/krammy Discord: Krammy#0001 - -Description: Gamble command. - -Command: !gamble amount diff --git a/plugins/casino/plugins/gamble/gamble.js b/plugins/casino/plugins/gamble/gamble.js deleted file mode 100644 index 9dde9e23..00000000 --- a/plugins/casino/plugins/gamble/gamble.js +++ /dev/null @@ -1,86 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('./../../../../modules/Bot.js'); -var cFunctions = null; -var userInfo = null; - - - -module.exports = { - name: 'Gamble', // Name of the Plugin - description: "Gamble game plugin", - author: "Krammy", - license: "Apache-2.0", - command: 'gamble', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 5, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - if (cFunctions.checkBanned(data.user) === true) - return client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.banned", - { - user: data.user - })); - - if (cFunctions.isNumeric(data.args[0]) === false || data.args[0] !== "all") { - client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.error_bet")); - return; - } - playerBet = 0; - if (data.args[0] == "all") - { - playerBet = parseInt(userInfo[data.user].points, 10); - } - else - { - playerBet = parseInt(data.args[0], 10); - } - if (playerBet > userInfo[data.user].points) { - client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.balance", - { - user: data.user - })); - return; - } - if (playerBet < 20) { - client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.min_bet", - { - user: data.user - }) - ); - return; - } - - userInfo[data.user].points -= playerBet; - - const rnd = Math.random() * 100; - - if (rnd > 50) - { - client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.win", - { - win: (userInfo[data.user].points * 2), - user: data.user - })); - userInfo[data.user].points += (playerBet * 2) - } - else - { - client.sendMessage(Bot.translate("plugins.casino.plugins.gamble.lose", - { - user: data.user - })); - } - }, - - activate() { - userInfo = require(path.join(Bot.root, 'data/users/users.json')); - cFunctions = require('../../cFunctions.js'); - Bot.log(Bot.translate("plugins.casino.plugins.dice.activated")) - }, - - deactivate() { - userInfo = null; - cFunctions = null; - Bot.log(Bot.translate("plugins.casino.plugins.dice.deactivated")) - } -} \ No newline at end of file diff --git a/plugins/casino/plugins/gamble/gamble.json b/plugins/casino/plugins/gamble/gamble.json deleted file mode 100644 index 7622ac1b..00000000 --- a/plugins/casino/plugins/gamble/gamble.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "active":true -} \ No newline at end of file diff --git a/plugins/casino/plugins/slots/README.md b/plugins/casino/plugins/slots/README.md deleted file mode 100644 index 4a92ecb2..00000000 --- a/plugins/casino/plugins/slots/README.md +++ /dev/null @@ -1,7 +0,0 @@ - - -Plugin Pack by Ulash Trovo: https://trovo.live/ulash Discord: Ulash#3836 Donate: https://trovo.live/ulash <3 - -Description: Free Huge Casino Pack - -Command: !slots amount diff --git a/plugins/casino/plugins/slots/slots.js b/plugins/casino/plugins/slots/slots.js deleted file mode 100644 index a2ecf672..00000000 --- a/plugins/casino/plugins/slots/slots.js +++ /dev/null @@ -1,182 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('../../../../modules/Bot.js'); -var cFunctions = null; -var userInfo = null; - - - -module.exports = { - name: 'slots', // Name of the Plugin - description: "Slots game plugin", - author: "Original by Ulash. Updated by Krammy", - license: "Apache-2.0", - command: 'slots', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 5, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - if (cFunctions.checkBanned(data.user) === true) { - return client.sendMessage( - Bot.translate("plugins.casino.plugins.slot.banned",{ - user: data.user - }), - ); - } - if (!data.args[0]) - return client.sendMessage( - Bot.translate("plugins.casino.plugins.slot.min_bet",{ - user: data.user - }) - ); - if (cFunctions.isNumeric(data.args[0]) === false) - return client.sendMessage(Bot.translate("plugins.casino.plugins.slot.error_bet",{ - user: data.user - }),); - - const playerBet = parseInt(data.args[0], 10); - if (playerBet > parseInt(userInfo[data.user].points, 10)) { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.balance",{ - user: data.user - }),); - return; - } - if (playerBet < 100) { - client.sendMessage( - Bot.translate("plugins.casino.plugins.slot.min_bet",{ - user: data.user - }), - ); - return; - } - - userInfo[data.user].points -= playerBet; - - const symbolsBase = [ - ':lurk ', - ':greenheart ', - ':angry ', - ':righthead :lefthead ', - ':cake ', - ':gg ', - ':ez ', - ]; - const symbols = [ - ':ez ', - ':lurk ', - ':greenheart ', - ':greenheart ', - ':angry ', - ':angry ', - ':angry ', - ':righthead :lefthead ', - ':righthead :lefthead ', - ':righthead :lefthead ', - ':righthead :lefthead ', - ':cake ', - ':cake ', - ':cake ', - ':cake ', - ':cake ', - ':gg ', - ':gg ', - ':lol ', - ':gg ', - ':lol ', - ':gg ', - ]; - const slotResults = []; - - let counter; - let lurkCounter = 0; - let rngResult; - - for (counter = 0; counter < 3; counter++) { - rngResult = Math.floor(cFunctions.randomNumber() * symbols.length); - slotResults.push(symbols[rngResult]); - - if (rngResult === 1) { - lurkCounter += 1; - } - } - - client.sendMessage( - `[ ${slotResults[0]} | ${slotResults[1]} | ${slotResults[2]} ] @${data.user}`, - ); - - if (lurkCounter > 0) { - if (lurkCounter === 3) { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *500), - user: data.user - })); - userInfo[data.user].points += playerBet * 500; - } else if (lurkCounter === 2) { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *5), - user: data.user - })); - userInfo[data.user].points += playerBet * 5; - } else if (lurkCounter === 1) { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *2), - user: data.user - })); - userInfo[data.user].points += playerBet * 2; - } - } - - if (slotResults[0] === slotResults[1] && slotResults[0] === slotResults[2]) { - if (slotResults[0] === ':greenheart ') { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *250), - user: data.user - })); - userInfo[data.user].points += playerBet * 250; - } else if (slotResults[0] === ':righthead :lefthead ') { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *100), - user: data.user - })); - userInfo[data.user].points += playerBet * 100; - } else if (slotResults[0] === ':angry ') { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *75), - user: data.user - })); - userInfo[data.user].points += playerBet * 75; - } else if (slotResults[0] === ':cake ') { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *50), - user: data.user - })); - userInfo[data.user].points += playerBet * 50; - } else if (slotResults[0] === ':gg ') { - client.sendMessage(Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *25), - user: data.user - })); - userInfo[data.user].points += playerBet * 25; - } else if (slotResults[0] === ':ez ') { - client.sendMessage( - Bot.translate("plugins.casino.plugins.slot.win",{ - playerBet: (playerBet *1000), - user: data.user - }) - ); - userInfo[data.user].points += playerBet * 1000; - } - } - }, - - activate() { - userInfo = require(path.join(Bot.root, 'data/users/users.json')); - cFunctions = require('../../cFunctions.js'); - Bot.log(Bot.translate("plugins.casino.plugins.dice.activated")) - }, - - deactivate() { - userInfo = null; - cFunctions = null; - Bot.log(Bot.translate("plugins.casino.plugins.dice.deactivated")) - } -} \ No newline at end of file diff --git a/plugins/casino/plugins/slots/slots.json b/plugins/casino/plugins/slots/slots.json deleted file mode 100644 index ff4e0d2a..00000000 --- a/plugins/casino/plugins/slots/slots.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "active" : true -} \ No newline at end of file diff --git a/plugins/casino/plugins/wheel/README.md b/plugins/casino/plugins/wheel/README.md deleted file mode 100644 index 307f3161..00000000 --- a/plugins/casino/plugins/wheel/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Plugin Pack by Ulash Trovo: https://trovo.live/ulash Discord: Ulash#3836 Donate: https://trovo.live/ulash <3 - -Description: Free Huge Casino Pack - -Command: !wheel <1, 2, 5, 10, 20> diff --git a/plugins/casino/plugins/wheel/wheel.js b/plugins/casino/plugins/wheel/wheel.js deleted file mode 100644 index 4ff1d2dd..00000000 --- a/plugins/casino/plugins/wheel/wheel.js +++ /dev/null @@ -1,125 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Bot = require('./../../../../modules/Bot.js'); -var cFunctions = null; -var userInfo = null; - - - -module.exports = { - name: 'wheel', // Name of the Plugin - description: "wheel game plugin", - author: "Original by Ulash. Updated by Krammy", - license: "Apache-2.0", - command: 'wheel', // This is the Command that is typed into Chat! - permissions: [], // This is for Permissisons depending on the Platform. - cooldown: 5, // this is Set in Seconds, how long between the next usage of this command. - execute(client, data) { - if (cFunctions.checkBanned(data.user) === true) return client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.banned", - { - user:data.user - })); - if (cFunctions.isNumeric(data.args[0]) === false) return client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.typo", - { - user:data.user - })); - if (cFunctions.isNumeric(data.args[1]) === false) return client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.typo", - { - user:data.user - })); - if ( - parseInt(data.args[1], 10) !== 1 && - parseInt(data.args[1], 10) !== 2 && - parseInt(data.args[1], 10) !== 5 && - parseInt(data.args[1], 10) !== 10 && - parseInt(data.args[1], 10) !== 20 - ) - return client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.typo", - { - user:data.user - })); - - const playerBet = parseInt(data.args[0], 10); - if (playerBet > userInfo[data.user].points) { - client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.balance", - { - user:data.user - })); - return; - } - if (playerBet < 100) { - client.sendMessage( - Bot.translate("plugins.casino.plugins.wheel.balance", - { - user:data.user - }), - ); - return; - } - - userInfo[data.user].commandDate = new Date(); - - userInfo[data.user].points -= playerBet; - - let wheel = Math.floor(cFunctions.randomNumber() * 100) + 1; - - if (wheel < 41) { - wheel = 1; - } else if (wheel > 40 && wheel < 66) { - wheel = 2; - } else if (wheel > 65 && wheel < 81) { - wheel = 5; - } else if (wheel > 80 && wheel < 91) { - wheel = 10; - } else if (wheel > 90 && wheel < 98) { - wheel = 20; - } else { - wheel = 40; - } - - client.sendMessage(Bot.translate("plugins.casino.plugins.wheel", - { - wheel: wheel, - user: data.user - })); - - if (wheel === 40) { - client.sendMessage( - Bot.translate("plugins.casino.plugins.wheel", - { - playerBet: (playerBet * (wheel + 1)), - user: data.user - }) - ); - userInfo[data.user].points += playerBet * (wheel + 1); - } - - if (parseInt(data.args[1], 10) === wheel) { - client.sendMessage( - Bot.translate("plugins.casino.plugins.wheel", - { - playerBet: (playerBet * (wheel + 1)), - user: data.user - }) - ); - userInfo[data.user].points += playerBet * (wheel + 1); - } else { - client.sendMessage(Bot.translate("plugins.casino.plugins.wheel.lose", - { - user: data.user - })); - } - }, - - activate() { - userInfo = require(path.join(Bot.root, 'data/users/users.json')); - cFunctions = require('../../cFunctions.js'); - Bot.log(Bot.translate("plugins.casino.plugins.wheel.activated")) - }, - - deactivate() { - userInfo = null; - cFunctions = null; - Bot.log(Bot.translate("plugins.casino.plugins.wheel.deactivated")) - } -} \ No newline at end of file diff --git a/plugins/casino/plugins/wheel/wheel.json b/plugins/casino/plugins/wheel/wheel.json deleted file mode 100644 index 1322ae4a..00000000 --- a/plugins/casino/plugins/wheel/wheel.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "active": true -} \ No newline at end of file diff --git a/plugins/eventlog/eventlog.js b/plugins/eventlog/eventlog.js index ee056f50..2d1b997e 100644 --- a/plugins/eventlog/eventlog.js +++ b/plugins/eventlog/eventlog.js @@ -5,6 +5,7 @@ const Bot = require('../../modules/Bot.js'); const settings = require('./eventlog.json'); +var save_interval = null; var events = {}; @@ -17,21 +18,38 @@ module.exports = { permissions: [], // This is for Permissisons depending on the Platform. cooldown: 60, // this is Set in Seconds, how long between the next usage of this command. execute(client, data) { - if (settings.use_data_folder) { - - } else { - - } + events.log.push(data); }, activate() { if (settings.use_data_folder) { - events = require(path.join(Bot.data, 'eventlogs', 'eventlogs.json')); + try { + events = require(path.join(Bot.data, 'eventlogs', 'eventlogs.json')); + } catch(e) { + events = {}; + } } else { events = require(path.join(__dirname, 'eventlogs.json')); } + if (events.log == undefined) { + events.log = []; + } + save_interval = setInterval(function() { + try { + var dir = null; + if (settings.use_data_folder) { + dir = path.join(Bot.data, 'eventlogs', 'eventlogs.json'); + } else { + dir = path.join(__dirname, 'eventlogs.json'); + } + fs.writeFileSync(dir, JSON.stringify(events, null, 2)); + } catch(e) { + Bot.log(e); + } + }, 5000); Bot.log(Bot.translate("plugins.bot.activated")) }, deactivate() { Bot.log(Bot.translate("plugins.bot.deactivated")) + clearInterval(save_interval); } };