Giter VIP home page Giter VIP logo

go-discord-bot's Introduction

Discord Sound Bot

A soundboard bot for discord. Built with Go/React.

Image

How to use

With docker-compose

Make sure to create a config.json file in your data volume. Take a look at config.template.json for example configurations.

docker-compose.yml

version: "3"

services:
  go-discord-bot:
    image: mgerb/go-discord-bot:latest
    restart: unless-stopped
    ports:
      - 8088:8080
    volumes:
      - <path to your data directory>:/bot
      - /usr/local/bin/youtube-dl:/usr/bin/youtube-dl

Running Bot Scripts

Use the following scripts

  • restore-messages
    • used to search message history and store in database
  • update-db
    • used to run additional DB change scripts (will likely never have to be run)

Example:

docker-compose exec go-discord-bot /server/bot-scripts update-db
docker-compose exec go-discord-bot /server/bot-scripts restore-message <roomID>

Commands

  • 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
  • random - play a random audio clip

Uploading files

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 with the following config.

https://localhost {
  tls self_signed
  proxy / http://localhost:8080 {
    transparent
  }
}

For public hosting you will want to use something like this.

https://<your domain name> {
  tls <your email>
  proxy / http://localhost:8080 {
    transparent
  }
}

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 (1.17+)
  • node/npm (node 16)

Compiling and Running

  • cd client && npm install && npm run build
  • cd server && go build -o ../bot
  • ./bot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.