joaonsantos / slashbot

Discord Bot in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

slashbot

This repository contains code for a golang discord music bot implementation that uses slash commands.

why does this exist?

Discord has changed their discord apps api starting in 2022.

The previous bot implementation I did was written using the old way. It also didn't support playlists.

Also, this seemed like a good idea to practice go channels and concurrency anyway.

features

  • streams audio from youtube video to discord voice channel
  • basic playlist support (adding item, moving to next item after play)
  • ability to skip audio stream, moves to next item on playlist

running

locally

Make sure ffmpeg is installed.

$ go run . -guild <guild_id> -channel <channel_id> -token <bot_token>

docker (detached)

$ docker build -t ffmpeg-alpine -f dockerfile.ffmpeg .
$ docker build -t bot . && docker run --rm -d bot -guild <guild_id> -channel <channel_id> -token <bot_token>

You can get the guild and channel id values easily by activating developer mode.

For the bot token, you need to create an account on https://discord.com/developers and create a bot.

limitations

  • the bot was designed to only handle one connection to a server, if it is connected to multiple servers bad things will happen™️

todo

  • stap da warudo! (clean the playlist, stop audio and disconnect)

kudos

Big kudos to:

About

Discord Bot in Go

License:MIT License


Languages

Language:Go 100.0%