Skip to content

Fix bumper reminder startup wiring and remove hardcoded override#12

Merged
PhillsPhanbh3 merged 2 commits into
mainfrom
copilot/fix-bumper-reminder-system
Jun 5, 2026
Merged

Fix bumper reminder startup wiring and remove hardcoded override#12
PhillsPhanbh3 merged 2 commits into
mainfrom
copilot/fix-bumper-reminder-system

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

The bumper reminder flow was broken by an argument mismatch in messageCreate, and persisted bump config was never loaded at boot. In addition, a hardcoded startup setup path could override guild-level dynamic configuration.

  • Message handler contract alignment

    • Updated messageCreate wiring to pass only the message object expected by handleMessage.
  • Config hydration on startup

    • Imported and invoked loadConfig() during bot initialization so persisted guildConfig is restored after restart.
  • Removed hardcoded bump setup

    • Deleted static setupBumpReminder(guildId, channelId, roleId) startup call to avoid overriding slash-command/config-driven state.
const { loadConfig, handleMessage } = require("./events/notifications/bumpReminder");

client.on("messageCreate", (message) => {
  handleMessage(message);
});

(async () => {
  loadConfig();
  await Promise.all([connectToMongo(), loadEvents(client), loadComponents(client)]);
})();
Original prompt

Critical Bugs in Bumper Reminder System

The bumper reminder system has three critical issues that prevent it from working correctly:

Issue 1: Incorrect Function Signature - Breaking Message Handler

File: index.js line 52-54
Problem: The handleMessage() function is called with client as the first parameter, but the function in bumpReminder.js only expects the message parameter. This causes the client object to be passed as the message, breaking the entire handler.

Current code (index.js):

client.on("messageCreate", (message) => {
  handleMessage(client, message);  // ← Wrong! Passes client as first param
});

Current function signature (bumpReminder.js):

async function handleMessage(message) {  // ← Only expects message

Issue 2: Configuration Not Loaded on Startup

File: bumpReminder.js
Problem: The loadConfig() function exists and is exported but is never called during bot startup. This means:

  • When the bot restarts, the in-memory guildConfig Map is reset and empty
  • All saved bump configurations are lost
  • The system only works until the bot restarts

Issue 3: Hardcoded Configuration Overrides Dynamic Setup

File: index.js lines 45-50
Problem: A hardcoded setupBumpReminder() call exists with specific guild/channel/role IDs that will override any dynamic configuration from slash commands or the config file. This needs to be removed or environment-variable driven.

Required Fixes

  1. Fix handleMessage call in index.js - Remove the client parameter since it's not used
  2. Load configuration on startup - Call loadConfig() in the async startup function in index.js
  3. Remove hardcoded setup - Delete the hardcoded setupBumpReminder() call from index.js

These changes will ensure:

  • The message handler receives the correct parameters
  • Configurations persist across bot restarts
  • Dynamic configuration from commands takes precedence over hardcoded values

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Help me debug the Bumper reminder system

Assistant: I'll help you debug the Bumper reminder system in the Helper-bot repository. Let me start by exploring the repository structure to understand the codebase and locate the Bumper reminder system.

Assistant: Let me search for more variations of bumper-related code:

Assistant: Let me get the full bumper reminder file to understand the system better:

Assistant: Now let me check the index.js to see how it's being used and look for any setup commands:

Assistant: Now let me check for slash command files:

Assistant: ## Bumper Reminder System – Debugging Analysis

I've identified several critical bugs in your bumper reminder system. Here's what I found:

Critical Issue #1: Missing client Parameter in index.js

In index.js line 53, the code calls:

client.on("messageCreate", (message) => {
  handleMessage(client, message);  // ← Passes client as first param
});

But looking at bumpReminder.js line 55, the function signature is:

async function handleMessage(message) {  // ← Only expects message

The client parameter is never used but is being passed, causing the actual message object to be received as the client parameter. This breaks the entire message handler.

Critical Issue #2: Configuration Not Loading on Startup

In bumpReminder.js, the loadConfig() function is exported but never called in your bot's startup sequence. This means:

  • When the bot restarts, the guildConfig Map is empty (reset)
  • Any saved bump configurations are lost
  • The hardcoded setup in index.js (lines 46-50) is the only configuration that persists

Critical Issue #3: Hardcoded Configuration in index.js

setupBumpReminder(
  "1392910932740538540",
  "1467685229916455013",
  "1467684301280907412"
);

This configuration is hardcoded and will override any dynamic configuration from slash commands or the config file.


Recommended Fixes

Would you like me to create a pull request to fix these issues? The changes would include:

  1. Fix the handleMessage function signature to match how it's being called
  2. Call loadConfig() during bot startup to restore saved configurations
  3. Remove the hardcoded setup or make it environment-variable driven
  4. Search for and ensure there's a /setup-bump command that properly manages configurations

Let me know which issues you'd like me to address, or if you'd like me to provide more specific code solutions!

User: do all the fixes!

Assistant: I'm preparing to create a pull request with all the fixes for your bumper reminder system. Please approve the tool call to proceed.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix critical bugs in bumper reminder system Fix bumper reminder startup wiring and remove hardcoded override Jun 5, 2026
Copilot AI requested a review from PhillsPhanbh3 June 5, 2026 20:37
@PhillsPhanbh3 PhillsPhanbh3 marked this pull request as ready for review June 5, 2026 20:39
@PhillsPhanbh3 PhillsPhanbh3 merged commit 103ce95 into main Jun 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants