Forwards incoming Discord WebSocket messages to HTTP
- Forwards incoming Discord WebSocket messages to HTTP
- Built with TypeScript for type safety
- Uses discord.js v14
- Node.js (v16 or higher)
- A Discord Bot Token
- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section in the left sidebar
- Click "Add Bot"
- Under the "TOKEN" section, click "Copy" to copy your bot token
- In the "Privileged Gateway Intents" section, enable:
- MESSAGE CONTENT INTENT (if needed for your bot to read message content)
- Go to "OAuth2" > "URL Generator"
- Select scopes:
bot - Select bot permissions:
Send Messages,Read Messages/View Channels - Copy the generated URL and open it in your browser to invite the bot to your server
- Install dependencies:
npm install- Create a
.envfile in the root directory (you can copy from.env.example):
DISCORD_BOT_TOKEN=your_discord_bot_token_here
Replace your_discord_bot_token_here with your actual Discord bot token.
# Build the TypeScript code
npm run build
# Start the bot
npm start# Build and run in one command
npm run devThe bot listens for direct messages and automatically replies with "Hallo World" to any message it receives in DMs. It ignores messages from other bots to prevent infinite loops.
.
├── src/
│ └── bot.ts # Main bot code
├── dist/ # Compiled JavaScript (generated)
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
- Bot doesn't respond to DMs: Make sure the bot has the necessary intents enabled in the Discord Developer Portal
- "DISCORD_BOT_TOKEN is not defined" error: Check that your
.envfile exists and contains a valid token - Bot can't read messages: Ensure you've enabled the MESSAGE CONTENT INTENT in the Discord Developer Portal
ISC