Major bot improvements and configuration updates#4
Major bot improvements and configuration updates#4killerboyyy777 wants to merge 3 commits intotldrwtf:masterfrom
Conversation
Refactored index.js to add cluster-based auto-restart, improved logging, and implemented weekly auto-gem conversion. Updated config.js with new rates, owner/admin settings, and streamlined messages. Enhanced tutorial files with modification credits. Removed unused batch scripts and updated start.bat for better console output. Updated dependencies in package.json for compatibility and security.
|
i hope this matches what you expected, no Problem if i have to change anything |
Summary of ChangesHello @killerboyyy777, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant enhancements to the bot's stability, automation, and user experience. Key changes include the integration of a cluster module for automatic restarts, a new weekly process for converting inventory items into gems, and a comprehensive update to the bot's configuration. These updates aim to make the bot more robust, efficient, and easier to manage, while also clarifying trade interactions for users. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant improvements to the bot, including cluster-based auto-restarts for better stability, a new weekly auto-gem conversion feature, and enhanced logging. The configuration has been updated with new rates and messages, and dependencies have been refreshed for security and compatibility. The changes are generally positive, but I've identified a critical bug in a user-facing message and a few areas where maintainability and consistency could be improved. My detailed feedback is in the comments below.
| } else if (MSG.toUpperCase() === '!PRICE') { | ||
| client.chatMessage( | ||
| SENDER, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & Emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | ||
| ); | ||
| } else if (MSG.toUpperCase() === '!RATE') { | ||
| client.chatMessage( | ||
| SENDER, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | ||
| ); | ||
| } else if (MSG.toUpperCase() === '!RATES') { | ||
| client.chatMessage( | ||
| SENDER, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | ||
| ); | ||
| } else if (MSG.toUpperCase() === '!PRICES') { | ||
| client.chatMessage( | ||
| SENDER, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | ||
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | ||
| ); |
There was a problem hiding this comment.
The command handling for !PRICE, !RATE, !RATES, and !PRICES is duplicated. All four blocks execute the exact same code. This can be refactored into a single block to improve code maintainability and reduce redundancy. You can group the commands into an array and check if the received message is one of them.
| } else if (MSG.toUpperCase() === '!PRICE') { | |
| client.chatMessage( | |
| SENDER, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & Emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | |
| ); | |
| } else if (MSG.toUpperCase() === '!RATE') { | |
| client.chatMessage( | |
| SENDER, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | |
| ); | |
| } else if (MSG.toUpperCase() === '!RATES') { | |
| client.chatMessage( | |
| SENDER, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | |
| ); | |
| } else if (MSG.toUpperCase() === '!PRICES') { | |
| client.chatMessage( | |
| SENDER, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n1 CS:GO Key for Our ${CONFIG.Rates.SELL.CSGO_To_Gems} Gems \r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n1 CS:GO Key for Your ${CONFIG.Rates.BUY.Gems_To_CSGO_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\n\r\nKey Swap Rates:\r\nYour ${CONFIG.Rates.Key_Swaps.TF2_To_CS[1]} CS:GO Keys for our ${CONFIG.Rates.Key_Swaps.TF2_To_CS[0]} TF2 Keys -> Use !SwapCS\r\nYour ${CONFIG.Rates.Key_Swaps.CS_To_TF2[1]} TF2 Keys for our ${CONFIG.Rates.Key_Swaps.CS_To_TF2[0]} CS:GO Keys -> Use !SwapTF`, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | |
| ); | |
| } else if (['!PRICE', '!RATE', '!RATES', '!PRICES'].includes(MSG.toUpperCase())) { | |
| client.chatMessage( | |
| SENDER, | |
| `Sell Your: \r\n1 TF2 Key for Our ${CONFIG.Rates.SELL.TF2_To_Gems} Gems\r\n\r\nBuy Our: \r\n1 TF2 Key for Your ${CONFIG.Rates.BUY.Gems_To_TF2_Rate} Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & Emotes for ${CONFIG.Rates.BUY.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)\r\nSelling any of OUR Backgrounds & emotes for ${CONFIG.Rates.SELL.BG_And_Emotes} Gems (Send offer & add correct number of my gems for auto accept.)`, | |
| ); |
|
Currently reviewing |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces cluster-based auto-restart functionality, weekly auto-gem conversion, and configuration updates. The changes streamline the bot's operation by removing manual restart scripts and improving error handling.
Key Changes
- Added cluster-based auto-restart mechanism to automatically recover from crashes
- Implemented weekly automated gem conversion for backgrounds and emotes above configured threshold
- Removed CS:GO key trading functionality and updated rates for TF2 keys only
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| stop.bat | Removed manual stop script (replaced by cluster management) |
| start_forever.bat | Removed forever.js-based startup script (replaced by cluster management) |
| start.bat | Updated to include console title, clear screen, and trace warnings |
| package.json | Updated dependencies to newer versions for compatibility and security |
| index.js | Added cluster restart logic, auto-gem conversion function, improved logging, removed "AI initiating" messages |
| Tutorial/Tutorial.txt | Added modification credits for 2025 changes |
| Tutorial/How to start the bot.txt | Updated startup instructions to reflect new cluster-based restart |
| SETTINGS/config.js | Updated rates, removed CS:GO references, added admin help, modified welcome messages |
| SETTINGS/TotalSold.json | Reset profit counters to zero |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hours = String(time.getHours()).padStart(2, '0'); | ||
| const minutes = String(time.getMinutes()).padStart(2, '0'); | ||
| const seconds = String(time.getSeconds()).padStart(2, '0'); | ||
| return `${hours}:${minutes}:${seconds}`; |
There was a problem hiding this comment.
[nitpick] Consider using toLocaleTimeString() or Intl.DateTimeFormat for more robust time formatting instead of manual padding.
| const hours = String(time.getHours()).padStart(2, '0'); | |
| const minutes = String(time.getMinutes()).padStart(2, '0'); | |
| const seconds = String(time.getSeconds()).padStart(2, '0'); | |
| return `${hours}:${minutes}:${seconds}`; | |
| return time.toLocaleTimeString('en-GB', { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' }); |
| client.chatMessage( | ||
| SENDER, | ||
| `You have:\r\n\r\n${theirTF2}TF2 Keys\r\n${TF2_Msg} You have this many Gems ${theirGems} Gems ${Gems_Msg}`, | ||
| `You have:\r\n\r\n${theirTF2}TF2 Keys\r\n${TF2_Msg} You have:\r\n\r\n${theirGems} Gems ${Gems_Msg}`, |
There was a problem hiding this comment.
Message contains duplicated 'You have:' text which appears confusing. The second 'You have:' should likely be removed or replaced with clarifying text.
| `You have:\r\n\r\n${theirTF2}TF2 Keys\r\n${TF2_Msg} You have:\r\n\r\n${theirGems} Gems ${Gems_Msg}`, | |
| `You have:\r\n\r\n${theirTF2} TF2 Keys${TF2_Msg ? '\r\n' + TF2_Msg : ''}\r\n${theirGems} Gems${Gems_Msg ? '\r\n' + Gems_Msg : ''}`, |
| } else { | ||
| const gem = TheirGems[0]; | ||
| if (gem.amount == Price_In_Gems) { | ||
| if (gem.amount >= Price_In_Gems) { |
There was a problem hiding this comment.
Logic error: should check for exact match (===) or at least equal (>= is already used but line 1598 calculation suggests exact match was intended). When user sends more gems than required, line 1598 calculates profit as gem.amount - (MyItems.length * CONFIG.Rates.BUY.BG_And_Emotes) which could result in incorrect profit tracking if excess gems are provided.
| if (gem.amount >= Price_In_Gems) { | |
| if (gem.amount === Price_In_Gems) { |
| } else { | ||
| const gem = MyGems[0]; | ||
| if (gem.amount == Price_In_Gems) { | ||
| if (gem.amount <= Price_In_Gems) { |
There was a problem hiding this comment.
Logic error: condition checks if bot's gems are less than or equal to required price, but should check if bot has enough gems (>=). This will accept trades when the bot doesn't have enough gems to give.
| if (gem.amount <= Price_In_Gems) { | |
| if (gem.amount >= Price_In_Gems) { |
| Database.Profit.Buy.CRAP[0] | ||
| += TheirItems.length | ||
| * (CONFIG.Rates.SELL.BG_And_Emotes - CONFIG.Rates.BUY.BG_And_Emotes); | ||
| Database.Profit.Buy.CRAP[0] += TheirItems.length * (CONFIG.Rates.SELL.BG_And_Emotes - CONFIG.Rates.BUY.BG_And_Emotes) + (Price_In_Gems - gem.amount); |
There was a problem hiding this comment.
Line uses tab character for indentation instead of spaces, inconsistent with the rest of the file.
| Database.Profit.Buy.CRAP[0] += TheirItems.length * (CONFIG.Rates.SELL.BG_And_Emotes - CONFIG.Rates.BUY.BG_And_Emotes) + (Price_In_Gems - gem.amount); | |
| Database.Profit.Buy.CRAP[0] += TheirItems.length * (CONFIG.Rates.SELL.BG_And_Emotes - CONFIG.Rates.BUY.BG_And_Emotes) + (Price_In_Gems - gem.amount); |
| HELP: "Available Commands:\r\n\r\n!Prices ⮞ Check our current Rates/Prices\r\n!Price ⮞ Check our current Rates/Prices\r\n!Rate ⮞ Check our current Rates/Prices\r\n!Rates ⮞ Check our current Rates/Prices\r\n\r\n!Check ⮞ Check how many Keys & Gems you have to see what we have to offer you!\r\n\r\n!Info ⮞ Info about Owner + Misc other information\r\n\r\n!BuyCS [# of CS:GO Keys] ⮞ Buy CS:GO Keys for Gems\r\n!BuyTF [# of TF2 Keys] ⮞ Buy TF2 Keys for Gems\r\n\r\n!SwapCS [# of CS:GO Keys] ⮞ Swap CS:GO Keys for TF2 Keys\r\n!SwapTF [# of TF2 Keys] ⮞ Swap TF2 Keys for CS:GO Keys\r\n\r\n!SellCS [# of CS:GO Keys] ⮞ Sell CS:GO Keys for Gems\r\n!SellTF [# of TF2 Keys] ⮞ Sell TF2 Keys for Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & Emotes for 9 Gems ea!\r\nJust start a Trade Offer with me and enter any/ all Emoticons/Backgrounds you would like to sell! Then, Add the correct rate of gems from my inventory into the trade. (9 Gems per Emote/BG) Bot will auto accept if rates match/will decline if they do not.\r\n" // Check for anything you want to change. | ||
| WELCOME: "Hello, welcome to my Key-BG-Emote-Gems Swap Bot. Let's get started! Type !help, !check, or !info.\r\n\r\nIn the case of any unforeseen error please message my Owner.\r\n", // Message sent when they first add you. | ||
| BROADCAST: "/quote Bot Gems restocked", // For the !Broadcast command. Do not abuse this. | ||
| HELP: "Available Commands:\r\n\r\n!Prices ⮞ Check our current Rates/Prices\r\n!Price ⮞ Check our current Rates/Prices\r\n!Rate ⮞ Check our current Rates/Prices\r\n!Rates ⮞ Check our current Rates/Prices\r\n\r\n!Check ⮞ Check how many Keys & Gems you have to see what we have to offer you!\r\n\r\n!Info ⮞ Info about Owner + Misc other information\r\n\r\n!BuyTF [# of TF2 Keys] ⮞ Buy TF2 Keys for Gems\r\n\r\n!SellTF [# of TF2 Keys] ⮞ Sell TF2 Keys for Gems\r\n\r\nWe're also:\r\nBuying Your Backgrounds & Emotes for 9 Gems each!\r\n(Only Gemable Backgrounds and Emotes)\r\nJust start a Trade Offer with me and enter any/ all Emoticons/Backgrounds you would like to sell! Then, Add the correct rate of gems from my inventory into the trade. (10 Gems per Emote/BG) Bot will auto accept if rates match/will decline if they do not.\r\n", // Check for anything you want to change. |
There was a problem hiding this comment.
Inconsistent gem rates in help message: states '9 Gems each' but then says '(10 Gems per Emote/BG)'. Should consistently use CONFIG.Rates.BUY.BG_And_Emotes value (which is set to 10) throughout the message.
|
@killerboyyy777 |
|
Might still have to add some changes, in some cases i am loading szeam inventory to often. Sadly eidnt have much time (and still do not jave muvh time atm) to make them. |
|
Also will ofc apply the changes suggested by copilot when i have the time |
|
I'll add to a branch with your other commits and test a bit later today for you, if you'd like. |
tldrwtf
left a comment
There was a problem hiding this comment.
Look into the above proposed fixes in logic.
Refactored index.js to add cluster-based auto-restart, improved logging, and implemented weekly auto-gem conversion. Updated config.js with new rates, owner/admin settings, and streamlined messages. Enhanced tutorial files with modification credits. Removed unused batch scripts and updated start.bat for better console output. Updated dependencies in package.json for compatibility and security.