Giter Club home page Giter Club logo

discord-sound-deck-bot-interface's Introduction

Discord-Sound-Deck-Bot-Interface

Software that allows you to create a discord bot, which plays your custom locally stored sound files in a discord sound channel with a press of a button. This is meant to simulate a personal sound deck on discord. Press a keyboard key to instantly hear a chosen sound in a voice channel, played by a bot instance seperate from your own voice and account.

Setup

Use discord developer portal (https://discord.com/developers/applications), create new application and give it a (possibly unique) name. Go to a bot tab and add one. You should be able to access a token, which is used by the app to access the created bot (see example config.xml file down below). Don't show it to anyone! Now, go to the OAuth tab. Mark the bot scope. You should already have a working link, which allows you to add this bot to your server. However, if you are going to ask somebody else to add the bot to their server, it would be a good idea to check additional bot permissions (to better inform them about it's use):

  • Send Messeges
  • Read Message History
  • Connect
  • Speak

Usage

This is a java command line program with a single argument runned by: java Main CONFIG_FILE where CONFIG_FILE is a path to a XML config file (f.e. config.xml).

Example config.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>

<!--> Bot token generated from discord developer portal (example).  <-->
<token>QFiIOUYMeItlN0tTEwxRNzMz.X6m4fg.MullaV4De5Wz0epoUBHscARQ0</token>
<paths>
    <!--> List of paths to sound files. <-->
    <path>clap.wav</path>
    <path>seinfeld-theme.mp3</path>
    <path>oof.mp3</path>
</paths>
<keys>
    <!--> List of key values (in the same order as paths). You can obtain them from:
	  https://javadoc.io/static/com.1stleg/jnativehook/2.0.3/constant-values.html <-->
    <key>82</key>
    <key>79</key>
    <key>4</key>
</keys>
</configuration>

Why do a 'bot interface' instead of a regular discord bot with a dedicated server (like groovy, for example)?

While the client-server approach would be more intuitive to use (no need to set up a seperate bot instance for every user), there are multiple reasons why the current implementation may be considered better:

  • safety concerns

    As the software is using what is essentially a key logger to catch input, you would probably not want that data going to wrong hands. Since all of this data is processed locally, there is no need to worry about that (as you can confirm in the source code).

  • latency

    As there are no middlemen that obtain and process the sound data (like the hypothetical server would), naturally there is going to be less latency all around.

Here, a simple approach like this ends up working surprisingly well.

Used libraries

  1. JDA for discord integration.
  2. LavaPlayer for sound file reformatting and streaming.
  3. JNativeHook for catching input.

discord-sound-deck-bot-interface's People

Contributors

jchyb avatar

Watchers

 avatar

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.