This is a Discord bot designed to:
✅ Fix Twitter and Instagram links in Discord messages
✅ Provide a fun /roulette command
✅ Fetch League of Legends build links using /build <champion>
✅ Flip a virtual coin with /flip
✅ Retrieve server information using /serverinfo
✅ Display bot statistics via /stats
✅ Fetch user details using /userinfo
This guide will help you set up, run, and deploy the bot on Railway for 24/7 availability.
Before you start, make sure you have:
- ✅ A Discord Bot Token (Create a bot here)
- ✅ A GitHub account (for storing the bot code)
- ✅ A Railway.app account (Sign up here)
- ✅ Node.js installed (>= v16)
- ✅ npm (comes with Node.js)
- Go to Discord Developer Portal
- Click New Application → Enter a name → Create
- Go to Bot on the sidebar, then click Add Bot
- Copy the Bot Token (you will need this later)
- Under Privileged Gateway Intents, enable:
- ✅ MESSAGE CONTENT INTENT
- ✅ SERVER MEMBERS INTENT (if needed)
- Go to OAuth2 → Click URL Generator
- Under Scopes, check
botandapplications.commands - Under Bot Permissions, select:
- View Channels
- Send Messages
- Manage Messages
- Manage WebHooks
- Embed Links
- Read Message History
- Use Slash Commands
- Copy the generated URL and invite the bot to your server.
git clone https://github.com/TomasPereiraa/FixTwitterDiscordBot.git
cd FixTwitterDiscordBotnpm installCreate a .env file in the project root and add:
DISCORD_BOT_TOKEN=your-bot-token-here
CLIENT_ID=your-discord-application-idReplace your-bot-token-here and your-discord-application-id with your actual values.
/discord-bot
│── /commands
│ ├── roulette.js # Slash command for roulette
│ ├── build.js # Slash command for LoL champion builds
│ ├── flip.js # Coin flip command
│ ├── serverinfo.js # Fetches server details
│ ├── stats.js # Displays bot statistics
│ ├── userinfo.js # Fetches user details
│── /events
│ ├── interactionCreate.js # Handles commands & autocomplete
│ ├── messageCreate.js # Handles Twitter/Instagram link fix
│ ├── ready.js # Runs when bot starts
│── /data
│ ├── champions.json # List of all LoL champions for autocomplete
│ ├── roulette.json # List of all numbers and colors
│── index.js # Main bot file
│── deploy-commands.js # Registers slash commands
│── .env # Stores bot token
│── package.json # Project dependencies
node deploy-commands.jsIf successful, you should see:
Registering slash commands...
Slash commands registered successfully.
node index.jsIf successful, you should see:
Logged in as YOURBOTNAME#YOURBOTNUMBERTAG
- Go to Railway.app.
- Click New Project → Deploy from GitHub Repo.
- Select your FixTwitterDiscordBot repository.
- In Railway, go to Settings → Variables.
- Add the following variables:
DISCORD_BOT_TOKEN = your-bot-token-hereCLIENT_ID = your-discord-application-id
- Railway will detect the project as a Node.js app.
- Click Deploy and wait for the process to complete.
- Once deployed, check the logs to confirm it's running:
Logged in as YOURBOTNAME#YOURBOTNUMBERTAG
Your bot is now live and running 24/7 on Railway! 🚀