Skip to content

Fix Discord bot connection and channel messaging#1

Open
railway-app[bot] wants to merge 1 commit intomasterfrom
railway/code-change-XMfwR6
Open

Fix Discord bot connection and channel messaging#1
railway-app[bot] wants to merge 1 commit intomasterfrom
railway/code-change-XMfwR6

Conversation

@railway-app
Copy link
Copy Markdown

@railway-app railway-app bot commented Apr 1, 2026

Problem

The bot container starts but never connects to Discord due to two bugs in src/main.ts. First, client.on("clientReady", ...) uses a non-existent event name — discord.js v14 emits "ready", so the handler never fires, the bot never logs its online status, and the daily verse scheduler never starts. Second, sendToChannel calls client.api.channels[channelId].messages.post(), which is not a valid discord.js v14 API and throws at runtime whenever a message send is attempted.

Solution

Changed the event name from "clientReady" to "ready" so the ready handler fires correctly on login. Replaced the invalid client.api call in sendToChannel with the proper discord.js v14 pattern: client.channels.cache.get(channelId) followed by an isTextBased() guard and channel.send(message). Both changes align with the discord.js v14 public API.

Changes

  • Modified src/main.ts

Generated by Railway

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.

0 participants