A custom discord bot :D
- Originally written to roll dice.
- Expanded to be able to cache and play YouTube audio (using yt-dlp)
- Can grab video's audio for on the go listening (eg, on the bus), allowing for phone to be locked
- This bypasses YouTube's paid feature where you can turn your screen off and still listen
- Has a ChatGPT interface (text-davinci-003)
Use help (with prefix) to see commands in Discord.
help: shows this commandping: ping the botroll(orr): roll some dicejoin: join the voice channel you're currently inleave(ordc): leave the connected voice channel in the serverplay(orp): play some music (control withpause/resume/stop)grab: grab a youtube video, extract the audio, and reply with the audio file as a.mp3chat: chat with the bot (OpenAI's text-davinci-003)
The bot owner is also able to use the following commands:
list: list all the guilds that the bot is part ofbail: leave a guildsleep: shut down the bot
Bail allows the bot to be removed from a server without the owner being part of said server.
All audio played is cached in ./media/ as mp3 files and can be deleted occasionally.
To run your own instance of Pandora, you will need some extra files in the project's src/ directory.
src/env with
DISCORD_TOKEN=[Discord token here]
src/variables.py with
class botVars:
prefix = [prefix]
owner = [numerical Discord ID]
blocklist = [list of numerical Discord ID] # can be empty listThe prefix should be a single character used as the prefix for bot commands.
Then, install dependences
Install screen
sudo apt install screenIf you don't have python3 and pip already, install them
sudo apt install python-is-python3 python3-pip ffmpegInstall python dependencies
pip install discord.py python-dotenv numpy yt-dlp openai
pip install -U discord.py[voice]Then run run.sh
chmod +x run.sh
./run.shAlternatively, run docker build -t pandora . to build the docker image, and docker run pandora to run pandora. Please note that the docker image is not thoroughly tested and may contain bugs.
Generate a discord bot invite URL on the applications page and invite to a server.