a music bot
  • Python 99.4%
  • Shell 0.3%
  • Dockerfile 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
haldu 1baf5ebc81
All checks were successful
Build and Push Docker Image / build (push) Successful in 22s
Give segue clip uploads an mp3 name so ffmpeg will save them.
A temporary ".mp3.part" file made ffmpeg refuse the format, so !segue add failed on a normal mp3.
2026-11-30 18:19:24 -05:00
.forgejo/workflows push to dockerhub (regression) 2026-04-06 15:52:21 -07:00
cogs Give segue clip uploads an mp3 name so ffmpeg will save them. 2026-11-30 18:19:24 -05:00
data Custom Radio Segues / Intro->Segue 2026-09-29 19:56:51 -04:00
plugins plugins support 2025-06-03 18:49:22 -04:00
.dockerignore update ignore files 2026-05-03 22:58:19 +02:00
.gitattributes Initial commit 2023-08-18 20:55:44 -04:00
.gitignore Custom Radio Segues / Intro->Segue 2026-09-29 19:56:51 -04:00
.python-version Change over to UV 2026-05-03 22:14:54 +02:00
AGENTS.md Trim cached audio after 30 days and manage segue clips from Discord. 2026-11-30 18:14:18 -05:00
config.py.example DM the bot owner when YouTube cookies go stale, and accept a new cookies.txt in DMs. 2026-11-25 16:09:18 -05:00
dave_voice.py Use davey 0.2 and install its voice encryption keys. 2026-11-25 17:58:54 -05:00
Dockerfile Fix YouTube downloads, float package updates on startup, and accept !intro. 2026-11-25 17:28:17 -05:00
entrypoint.sh Update entrypoint.sh 2026-06-20 08:43:16 -04:00
func.py Trim cached audio after 30 days and manage segue clips from Discord. 2026-11-30 18:14:18 -05:00
hathor.py Trim cached audio after 30 days and manage segue clips from Discord. 2026-11-30 18:14:18 -05:00
lastfm_session_gen.py Dockerfied 2025-06-02 15:42:25 -04:00
LICENSE Create LICENSE 2025-05-18 03:28:52 -04:00
logs.py implemented rich logging 2025-05-20 21:16:06 -04:00
pyproject.toml Predict artist and title from the upload before asking AI. 2026-11-25 18:19:20 -05:00
pyrightconfig.json Type checking can burn in hell. 2026-05-03 22:54:43 +02:00
README.md Trim cached audio after 30 days and manage segue clips from Discord. 2026-11-30 18:14:18 -05:00
track_identity.py Predict artist and title from the upload before asking AI. 2026-11-25 18:19:20 -05:00
uv.lock Predict artist and title from the upload before asking AI. 2026-11-25 18:19:20 -05:00

Hathor

A discord music bot.

Hathor offers:

  • 🎶 Music playback from YouTube, Spotify, and SoundCloud.
  • 🤖 Radio stations generated using AI.
  • 🔀 Fuse multiple radio stations together to increase variety.
  • 🎤 DJ segues for songs.
  • 📑 Queue management (skip, bump, etc).
  • 💬 Ask AI.
  • 📸 AI image generation.
  • 🧐 Have AI generate an image generation prompt.
  • 🤬 Responds to "@grok".
  • 🧩 Plugin support.

🚀 Installation

1. From Source

git clone https://git.dsabecky.com/nothaldu/hathor.git
cd hathor
uv run python hathor.py

2. From DockerHub

docker pull nothaldu/hathor:latest
docker run -d \
  --name hathor \
  --restart unless-stopped \
  -v /full/path/to/data:/app/data \
  -v /full/path/to/db:/app/db \
  -v /full/path/to/plugins:/app/plugins \ # optional
  nothaldu/hathor:latest
  • /app/data → your folder with config.py and JSON
  • /app/db → your folder for cached music or other persistent files

Age-restricted YouTube videos need a signed-in cookies.txt in that data folder (YOUTUBE_COOKIES = True). The container cannot see your browser. On your computer, sign in to YouTube, export cookies.txt with the "Get cookies.txt LOCALLY" extension, and drag the file into the bot's DMs. You can also copy it yourself to data/cookies.txt on the host.


⚙️ Configuration

  1. (From Source only) Copy the example config into your data folder:

    mkdir data
    cp config.py.example data/config.py
    
  2. Edit data/config.py:

    DISCORD_BOT_TOKEN      # Your Discord bot token
    OPENAI_API_KEY         # Your OpenAI API key
    SPOTIFY_CLIENT_ID      # Your Spotify client ID
    SPOTIFY_CLIENT_SECRET  # Your Spotify client secret
    YOUTUBE_API_KEY        # Your Google API key
    
    BOT_ADMIN              # Your Discord user ID (no quotes)
    

🔗 (Optional) Last.FM Scrobbling

In data/config.py add:

LASTFM_API_KEY    # Your Last.FM API key
LASTFM_API_SECRET # Your Last.FM API secret
LASTFM_SERVER     # The server ID to scrobble for

Then generate your session key:

uv run python3 lastfm_session_gen.py
# Follow prompts, then:
uv run python3 lastfm_session_gen.py TOKEN_FROM_PREVIOUS_STEP
# Copy SESSION_KEY back into data/config.py

💬 Commands

Music

- !play <query|url>  
- !playnext <query|url>
- !aiplaylist <theme>
- !pause / !resume / !skip  
- !queue / !clear / !remove <#> / !bump <#>  
- !shuffle / !repeat

Radio

- !radio <theme> / !radio to toggle  
- !fuse <theme1> | <theme2> | …  
- !defuse <theme>  
- !segue / !seg
- !segue list
- !segue add <name> (+ one audio attachment)
- !segue remove <name>
- !segue replace <name> (+ one audio attachment)
- !segue rename <old> | <new>

!segue weight changes are for people with DJ permission. Adding, listing, replacing, renaming, and removing clips is only the owner of that server, or the bot owner. Attach one audio file (30 seconds or less) to !segue add and !segue replace. New clips are used on the next segue, without a restart.

AI

- !chatgpt <prompt>
- !imagine <prompt>
- !gptimagine <prompt>  
- !gptedit <prompt> + image attachments

Server Admin

- !join / !leave
- !permissions [add | remove] [channel | role | user ] <ID>
- !volume <1-100>

Bot Owner

- !botservers
- !botleave
- !botsync

🙏 Acknowledgements