Skip to content

Running a 24/7 Discord Radio Bot

If you don’t know what a radio bot is, it’s basically a Discord bot that plays music 24/7 in a channel you’ve set. This guide will explain to you how to run one that’ll play random songs used on your GDPS!

To be able to follow the rest of this guide, you will need to make sure that:

  • You have Bun installed
  • You have a device/server capable of running 24/7
  • You have full access to your GDPS’ SFTP & Discord server (with administrator permissions to add the bot)
  • You have a stable internet connection

Create a Discord application and then a Discord bot from the Discord Developer Portal, then:

  • Copy the bot’s token (you will need it for the .env file)
  • Under the OAuth2 URL Generator select bot then the Connect & Speak permissions
  • Generate the invite link and add the bot to your server

Generating the invite link from the Discord Developer Portal

Add a randomSong.php file anywhere on your GDPS’ SFTP (make sure to replace the require "path/to/incl/lib/connection.php"; line with the correct path on your server):

<?php
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
require "path/to/incl/lib/connection.php"; // Edit the path on this line!
$song = $db->prepare("SELECT * FROM songs WHERE isDisabled = 0 AND download != 'CUSTOMURL' ORDER BY RAND() ASC LIMIT 1");
$song->execute();
$song = $song->fetch();
$data = [
"ID" => $song["ID"],
"author" => $song["authorName"],
"name" => $song["name"],
"download" => $song["download"],
"reuploadID" => $song["reuploadID"],
"reuploadTime" => $song["reuploadTime"]
];
exit(json_encode([
"dashboard" => true,
"success" => true,
"song" => $data
]));
?>

Example: https://m336test.ps.fhgdps.com/randomSong.php (with require "incl/lib/connection.php";)

  1. Download the repository on a device/server that can run 24/7 or clone it with: git clone https://github.com/M336G/gdps-radio-bot.git
  2. Then, in its (decompressed) folder, install dependencies with bun install and fill out a .env file according to your needs (check out .env.example for an example)
  3. Finally, start the bot with bun run start!

On the Discord Developer portal, set:

  • Installation Context to Guild Install only (in the Installation category)
  • Install Link to None (in the Installation category too)
  • Public Bot to false (in the Bot category)

Setting the Installation Context and the Install Link on the Discord Developer Portal

Disabling Public Bot on the Discord Developer Portal


Last updated: July 27th, 2026