mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-09 16:42:48 +00:00
expanded permissions functionality - added packr for bundling static assets
This commit is contained in:
93
readme.md
93
readme.md
@@ -1,51 +1,88 @@
|
||||
# Discord Sound Bot
|
||||
|
||||
This is a soundboard bot for discord. The back end is in GoLang and the front end uses React.
|
||||
A soundboard bot for discord with a Go back end and React front end.
|
||||
|
||||
<img src="http://i.imgur.com/jtAyJZ1.png"/>
|
||||

|
||||
|
||||
## How to use
|
||||
|
||||
NOTE: Currently the binaries in the release package only run on linux. Check them out [here](https://github.com/mgerb/go-discord-bot/releases)
|
||||
* [Download latest release here](https://github.com/mgerb/go-discord-bot/releases)
|
||||
* Install [youtube-dl](https://github.com/rg3/youtube-dl/blob/master/README.md#installation)
|
||||
* Install [ffmpeg](https://www.ffmpeg.org/download.html)
|
||||
* edit your config.json file
|
||||
* run the executable
|
||||
|
||||
- download bot.zip and extract everything
|
||||
- rename config.template.json to config.json
|
||||
- add your bot token and preferred upload password (leave as is for no password)
|
||||
- run the bot with `./bot` (you may need to use sudo if you leave it on port 80)
|
||||
### Commands
|
||||
|
||||
## Flags
|
||||
* `clip` - clips the past minute of audio
|
||||
* `summon` - summons the bot to your current channel
|
||||
* `dismiss` - dismisses the bot from the server
|
||||
* `<audio clip>` - play a named audio clip
|
||||
|
||||
> -p, run in production mode
|
||||
### Uploading files
|
||||
|
||||
> -tls, run with auto tls
|
||||
Discord oauth is used to authenticate users in order to upload files.
|
||||
To get oauth working you must set up your bot client secret/id in the config.
|
||||
You must also set up the redirect URI. This is needed so discord can redirect
|
||||
back to your site after authentication. Discord doesn't like insecure redirects
|
||||
so you will have to use a proxy for this. I prefer using [caddy](https://github.com/mholt/caddy)
|
||||
with the following config.
|
||||
|
||||
## Setting up Youtube downloader
|
||||
```
|
||||
https://localhost {
|
||||
tls self_signed
|
||||
proxy / http://localhost:8080 {
|
||||
transparent
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Install [youtube-dl](https://github.com/rg3/youtube-dl/blob/master/README.md#installation)
|
||||
For public hosting you will want to use something like this.
|
||||
|
||||
### NOTE
|
||||
```
|
||||
https://<your domain name> {
|
||||
tls <your email>
|
||||
proxy / http://localhost:8080 {
|
||||
transparent
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you get a permissions error with ffmpeg on mac or linux:
|
||||
`sudo chmod +x dist/ffmpeg_linux`
|
||||
### Clipping audio
|
||||
|
||||
Sounds are stored in the `sounds` directory. You may copy files directly to this folder rather than uploading through the site.
|
||||
If the bot is in a channel it listens to all audio. Use the `clip` command
|
||||
to record the past minute of conversation. Access all clips in the "Clips"
|
||||
section of the site.
|
||||
|
||||
### Stats
|
||||
|
||||
If logging is enabled the bot will log all messages and store in a database file. Currently the bot keeps track of
|
||||
all messages that contain links in them. I added this because it's something we use in my discord.
|
||||
Check it out in the "Stats" page on the site.
|
||||
|
||||
## Building from Source
|
||||
|
||||
### Dependencies
|
||||
- Go
|
||||
- node/npm
|
||||
- make
|
||||
|
||||
* Go
|
||||
* node/npm
|
||||
* make
|
||||
|
||||
### Compiling
|
||||
- Make sure dependencies are installed
|
||||
- `make all`
|
||||
- Rename the `config.template.json` to `config.json`
|
||||
- add configurations to `config.json`
|
||||
- run the executable
|
||||
- open a browser `localhost:<port>`
|
||||
- upload files
|
||||
- success!
|
||||
|
||||
* Make sure dependencies are installed
|
||||
* Rename the `config.template.json` to `config.json`
|
||||
* add configurations to `config.json`
|
||||
* `cd client && npm run dev`
|
||||
* `go run main.go`
|
||||
* open a browser `localhost:<config_port>`
|
||||
|
||||
[Packr](https://github.com/gobuffalo/packr) is used to bundle the static web assets into the binary.
|
||||
Use these commands to compile the project. The client must be built first.
|
||||
|
||||
* `packr build`
|
||||
* `packr install`
|
||||
|
||||
### Windows
|
||||
I've only compiled and run this on linux so far, but I've recently added cross platform support.
|
||||
|
||||
I only run this on linux. I'm not sure if it will work on windows, but it should without too much work.
|
||||
|
||||
Reference in New Issue
Block a user