- JavaScript 100%
| commands | ||
| data/migrations | ||
| utils | ||
| .env.example | ||
| .gitignore | ||
| bot.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
Warning
This source code was never intended to be released publicly; expect it to be messy and uncommented.
gdps-radio-bot
Play songs from your GDPS 24/7 on your Discord server!
Previously ColdGDPS' music bot.
Prerequisites
- Bun installed
- A device/server capable of running 24/7
- Full access to:
- Your GDPS file server
- Your Discord server (Administrator permissions)
Usage
You must have full permissions on both your Discord server and your GDPS server.
1. Create a Discord application and then a Discord bot from the Discord Developer Portal
- Copy the bot's token (you will need it for the
.envfile) - Under the OAuth2 URL Generator:
- Select
bot - Select these permissions:
Connect&Speak
- Select
- Generate the invite link and add the bot to your server
2. Add a randomSong.php file anywhere on your GDPS file server (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";
$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
]));
?>
The file must be publicly accessible by the bot (via HTTP/HTTPS).
3. 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
cd gdps-radio-bot
Then:
- Install dependencies with
bun install - Create a
.envfile - Fill it according to
.env.example- Paste your Discord bot token
- Set your GDPS endpoint URL accordingly (including
http://orhttps://) - Paste the channel ID in which the bot will play songs 24/7
Warning
Never share your
.envfile or bot token publicly.
4. Run bun run start in the bot's directory.
Make sure that:
- The bot is online on Discord
- It plays songs
- The machine running it stays online 24/7
Optional: on the Discord Developer Portal, you may also disallow anyone from inviting the bot to their server by setting:
- Installation Context to
Guild Installonly (in the Installation category) - Install Link to
None(in the Installation category too) - Public Bot to
false(in the Bot category)
Contributing
You are completely free to contribute to the project if you want to, it would be really appreciated!
License
This project is licensed under the MIT License.