Skip to content

Major bot improvements and configuration updates#4

Open
killerboyyy777 wants to merge 3 commits intotldrwtf:masterfrom
killerboyyy777:master
Open

Major bot improvements and configuration updates#4
killerboyyy777 wants to merge 3 commits intotldrwtf:masterfrom
killerboyyy777:master

Conversation

@killerboyyy777
Copy link
Copy Markdown

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.

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.
@killerboyyy777
Copy link
Copy Markdown
Author

i hope this matches what you expected, no Problem if i have to change anything

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @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

  • Bot Reliability: Implemented cluster-based auto-restart for index.js to enhance bot uptime and resilience against crashes.
  • Automated Gem Conversion: Added a new feature to index.js that automatically converts eligible emotes and backgrounds into gems on a weekly schedule.
  • Configuration Streamlining: config.js has been updated with new trade rates, refined owner/admin settings, and clearer user messages, including the removal of CS:GO key trading options.
  • Improved Logging & Console Output: Enhanced console output with copyright information, debug logging, and better time formatting. The start.bat script now provides a cleaner console experience.
  • Dependency Updates: All core Node.js dependencies in package.json have been updated to their latest compatible versions for improved security and performance.
  • Simplified Bot Management: Obsolete start_forever.bat and stop.bat scripts have been removed, and the How to start the bot.txt tutorial updated to reflect the new auto-restart behavior.
  • Refined Trade Logic: The logic for buying and selling backgrounds/emotes has been improved in index.js to handle gem amounts more accurately and provide more informative error messages to users.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.js Outdated
Comment thread SETTINGS/config.js
Comment thread index.js
Comment on lines 364 to 383
} 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.)`,
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
} 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.)`,
);

Comment thread index.js Outdated
@tldrwtf tldrwtf requested review from Copilot and tldrwtf November 2, 2025 00:08
@tldrwtf
Copy link
Copy Markdown
Owner

tldrwtf commented Nov 2, 2025

Currently reviewing

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.js
Comment on lines +27 to +30
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}`;
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using toLocaleTimeString() or Intl.DateTimeFormat for more robust time formatting instead of manual padding.

Suggested change
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' });

Copilot uses AI. Check for mistakes.
Comment thread index.js
Comment thread index.js
Comment thread index.js
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}`,
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message contains duplicated 'You have:' text which appears confusing. The second 'You have:' should likely be removed or replaced with clarifying text.

Suggested change
`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 : ''}`,

Copilot uses AI. Check for mistakes.
Comment thread index.js
} else {
const gem = TheirGems[0];
if (gem.amount == Price_In_Gems) {
if (gem.amount >= Price_In_Gems) {
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if (gem.amount >= Price_In_Gems) {
if (gem.amount === Price_In_Gems) {

Copilot uses AI. Check for mistakes.
Comment thread index.js
} else {
const gem = MyGems[0];
if (gem.amount == Price_In_Gems) {
if (gem.amount <= Price_In_Gems) {
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if (gem.amount <= Price_In_Gems) {
if (gem.amount >= Price_In_Gems) {

Copilot uses AI. Check for mistakes.
Comment thread index.js
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);
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line uses tab character for indentation instead of spaces, inconsistent with the rest of the file.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Comment thread SETTINGS/config.js
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.
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@tldrwtf
Copy link
Copy Markdown
Owner

tldrwtf commented Nov 2, 2025

@killerboyyy777
Have you reviewed the above?

@tldrwtf tldrwtf self-assigned this Nov 2, 2025
@tldrwtf tldrwtf added the enhancement New feature or request label Nov 2, 2025
@killerboyyy777
Copy link
Copy Markdown
Author

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.

@killerboyyy777
Copy link
Copy Markdown
Author

Also will ofc apply the changes suggested by copilot when i have the time

@tldrwtf
Copy link
Copy Markdown
Owner

tldrwtf commented Nov 2, 2025

I'll add to a branch with your other commits and test a bit later today for you, if you'd like.

Copy link
Copy Markdown
Owner

@tldrwtf tldrwtf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look into the above proposed fixes in logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants