A music recognition bot for Discord. Uses the Music Recognition API.
- Get a token from AudD and copy it to the AudDToken in config.json
- Create an application here: https://discordapp.com/developers/applications
- Copy the secret to the DiscordToken in config.json and the Client ID to DiscordAppID in config.json
- Create a bot
- Build the binary (e.g.
go build -v ./...
) or download one compiled by GitHub and run it (e.g.,./discordBot
) - Open
https://discordapp.com/api/oauth2/authorize?client_id=<INSERT CLIENT ID HERE>&permissions=277026819136&scope=bot%20applications.commands
and add the bot to a server
Please note that to be able to identify music from messages you replied with "!song" to, the bot needs access to the privelleged Message Content intent.
- To identify a song from an audio/video file or a link, reply to it with !song or or right-click on the message and pick App -> Recognize This Song
- To recognize music from a voice channel, send
!song @mention
or /song-vc slash command, mentioning the person who is playing the song (like !song @MusicBot) - If you want the bot to listen to a channel so it can immediately recognize the song from the last 15 second of audio, type !listen or use the /listen slash command.
If you have a stream, with this bot you can automatically post all the songs to Discord.
- Add a stream to the API with the Music Recognition API for streams
- change
127.0.0.1:port
to:port
in config.json - make a setCallbackUrl API request:
- https://api.audd.io/setCallbackUrl/?api_token=YOUR_AUDD_TOKEN&url=http://YOUR_SERVER_IP:4541/?secret=SECRET_CALLBACK_TOKEN%26chat=CHAT_ID
- CHAT_ID is the Discord chat ID where the bot will post the recognition results.
- SECRET_CALLBACK_TOKEN is any string you want. Need it to ensure the callbacks are from a trusted source. Add it to config.json.
The bot prints IDs of all the text channel it has access to when it restarts or is being added to a new server or on the !here command.