No description
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
main.go | ||
README.md |
Discord EuropaFM Radio Bot
A Discord bot that streams EuropaFM Spanish radio to your voice channel.
Requirements
- Go 1.22 or higher
- FFmpeg installed on your system
- Discord Bot Token
Setup
-
Install FFmpeg on your system:
- Ubuntu/Debian:
sudo apt install ffmpeg
- macOS:
brew install ffmpeg
- Windows: Download from FFmpeg website
- Ubuntu/Debian:
-
Create a Discord Bot:
- Go to Discord Developer Portal
- Create a new application
- Go to the "Bot" tab and click "Add Bot"
- Under "Privileged Gateway Intents", enable "Server Members Intent"
- Copy your bot token
-
Invite the bot to your server:
- Go to OAuth2 > URL Generator
- Select "bot" and "applications.commands" scopes
- Select permissions: "Connect", "Speak", "Send Messages"
- Open the generated URL and authorize the bot for your server
-
Get your Server ID (for guild-specific command registration):
- Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
- Right-click on your server name in the server list and select "Copy ID"
- Alternatively, you can see the server ID in the bot's debug logs when it connects
Usage
Running from source
- Clone this repository
- Run the bot with your Discord token:
OrDISCORD_TOKEN=your_token_here go run main.go
go run main.go -token your_token_here
Command-line options
The bot accepts the following command-line options:
-token string
: Discord bot token (can also be set via DISCORD_TOKEN environment variable)-debug
: Enable debug logging for more verbose output (helpful for troubleshooting)-guild string
: Register commands for a specific guild (server) instead of globally - this is faster for testing (commands update instantly)
Example with debug mode and guild-specific registration:
go run main.go -token your_token_here -debug -guild your_server_id
Using Docker
-
Build the Docker image:
docker build -t discord-europa-fm .
-
Run the container:
docker run -e DISCORD_TOKEN=your_token_here discord-europa-fm
With debug mode:
docker run -e DISCORD_TOKEN=your_token_here -e DEBUG=1 discord-europa-fm
With guild-specific command registration:
docker run -e DISCORD_TOKEN=your_token_here -e GUILD_ID=your_server_id discord-europa-fm
Alternatively, use docker-compose:
-
Create a
.env
file with your Discord token:DISCORD_TOKEN=your_token_here DEBUG=1 GUILD_ID=your_server_id # Optional: for guild-specific command registration
-
Run with docker-compose:
docker-compose up -d
Commands
Once the bot is running, you can use the following slash commands in your Discord server:
/europafm play
- Start streaming EuropaFM radio in your voice channel/europafm stop
- Stop streaming and leave the voice channel
Troubleshooting
If you're having audio issues:
- Make sure FFmpeg is properly installed and available in your system PATH
- Verify that the bot has permissions to join and speak in voice channels
- Check that you're in a voice channel before using the play command
- Make sure the radio stream URL is still valid
Unknown Integration Error
If you see "Unknown Integration" when using slash commands, it might be because:
- The bot is offline or not properly connected to Discord
- The slash commands haven't been properly registered with Discord
- The bot may need permissions it doesn't currently have
Solutions to try:
- Run the bot with
-debug
flag to get more detailed logs about what's happening - Use guild-specific command registration with
-guild your_server_id
for faster updates (global commands can take up to an hour to propagate) - Check if your bot has the "applications.commands" scope when you invited it to your server
- Try re-inviting the bot with the correct permissions and scopes
- Verify that your bot token is correct and not expired
- Check the Discord Developer Portal to make sure your application has the bot feature enabled