Refactor discord bot for maintainability #3
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
florian/foundry-hosting!3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cursor/refactor-discord-bot-for-maintainability-64ab"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Modularize Discord bot for improved maintainability and TypeScript readiness, ensuring full backward compatibility.
Open in Web • Open in Cursor
Bug: Improper Error Handling Causes Infinite Reconnection
The
client.on("error")handler attempts to reconnect by callingclient.login()on an already logged-in client. This will fail as Discord.js clients cannot be re-logged in. The logic also lacks error type checking (e.g., for invalid tokens) and rate limiting, which can lead to infinite reconnection loops and Discord API rate limits.discord/index.js#L33-L42github.com/florianbeisel/foundry-hosting@0153427074/discord/index.js (L33-L42)Fix in Cursor • Fix in Web
Bug: Bot Startup Clears Unused Map Instead of Active Monitors
The bot uses two separate
statusMonitorsMaps: one inmonitoring.jsfor managing active instance monitors, and an unusedclient.statusMonitorsproperty. On startup,client.statusMonitors.clear()is called, which incorrectly attempts to clear the unused map instead of stopping the active monitors managed bymonitoring.js. This leads to inconsistent state management and potential memory leaks, as active monitors are not properly cleared on bot restarts. ThestopAllMonitoring()function frommonitoring.jsshould be used for proper cleanup.discord/services/monitoring.js#L5-L6github.com/florianbeisel/foundry-hosting@0153427074/discord/services/monitoring.js (L5-L6)discord/events/ready.js#L25-L26github.com/florianbeisel/foundry-hosting@0153427074/discord/events/ready.js (L25-L26)Fix in Cursor • Fix in Web
Bugbot free trial expires on August 6, 2025
Learn more in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.