Coder Social home page Coder Social logo

channel-commander's Introduction

Discord Channel Commander Bot

Many large FPS and MMO groups use a Channel Commander (CC) or whisper function to communicate between squads in game. Most gaming VOIP tools have a CC or whisper function. Except Discord. So this bot adds CC functionality (sort of).

You will need ONE (1) CC bot per user in CC and a channel for all the CC bots (and only the CC bots) to sit in. The bot MUST be run locally on the computer of the person who wants to be in CC.

Installation

This bot runs on Python. It works on Python 3.6 but Python 3.5.3 or better should work. If you need Python, Anaconda is an easy way to get it for Windows, Mac and Linux.

For Windows specifically, it may be easier to get python from the Microsoft Store. You may also need Microsoft Visual C++ 14.0, which can be found with Microsoft Visual C++ Build Tools or with this Direct Download Link. But using Anaconda will make installation easier.

Once you have Python, download or clone this repository.

You'll also need the Discord Python API. The origional is avaliable via pip or GitHub but this bot needs some features that are in a pull request of the rewite but not merged and the pull request is behind the branch. So I forked discord.py and added the changes. You will need to download that from my GitHub. Credit to Bottersnike for the edits.

Once downloaded, drop the discord folder (the one inside the folder you download) into the same folder as channel_commander.py. For some reason, installing the library seems to break things but using it like this doesn't. Your channel-commander folder should look like this:

discord (folder)
cc_audio.py
channel_commander.py
channel_commander.txt
...

You will need to install some Python packages: aiohttp, websockets, pyaudio, keyboard and pynacl. You can use pip to install these. pyaudio also needs portaudio. You may also need the opus libraries to make everything work.

Windows

  • Open the start menu, type cmd and click on "Command Prompt".
  • Change directory to where you have downloaded the bot by typing cd C:\path\to\bot.
  • If you installed Anaconda, type conda install portaudio and hit ENTER.
  • If you did not install Anaconda, you will have to build portaudio from source (sorry). Instructions are on portaudio's webpages
  • Type pip install -r requirements.txt and hit ENTER.
  • If you need opus, you can get it from the Opus Website

MAC

  • Open the launchpad, type terminal and click on "Terminal".
  • Change directory to where you have downloaded the bot by typeing cd /path/to/bot.
  • If you installed Anaconda, type conda install portaudio and hit ENTER.
  • If you did not install Anaconda but have Homebrew, type brew install portaudio and hit ENTER.
  • If you don't have Anaconda or homebrew, type /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" and hit ENTER to install homebrew. Then type brew install portaudio and hit ENTER.
  • Type pip install -r requirements.txt and hit ENTER.
  • If you need opus and have Homebrew, type brew install opus and hit ENTER.
  • If you need opus and don't have Homebrew, type /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" and hit ENTER to install homebrew, then type brew install opus and hit ENTER.

Linux

  • Open the launchpad, type terminal and click on "Terminal".
  • Change directory to where you have downloaded the bot by typeing cd /path/to/bot.
  • If you installed Anaconda, type conda install portaudio and hit ENTER.
  • If you did not install Anaconda, type sudo apt install portaudio19-dev and hit ENTER.
  • Type pip install -r requirements.txt and hit ENTER.
  • If you need opus, type sudo apt install libopus-dev and hit ENTER.

Setting Up

The settings you will need to finalise are in channel_commander.txt. It has four values TOKEN, cc_name, cc_channel, cc_key.

  • cc_name (I'll get back to TOKEN): The name that you use in the server you want to use the bot in. This allows only you to control the bot.

  • cc_channel: The name of the channel you will be using for CC. This channel is where all the CC bots will sit and talk to each other.

  • cc_key: Hot key for talking over CC as PTT. I think only keyboard keys will work. Using mouse keys is something I should look into at some point.

  • TOKEN (I said I'd get back to it): This is the unique token for your bot. Get if from your bot's page on Discord's Applications. If you don't have a bot, or forgot how to find its token, see below.

Getting a Bot Token

If you need a bot, follow this:

  1. Go to Discord's Applications page and click on "Create Application". This will, as the name suggests, create an application that can use Discord's API. Give it a name and a nice avatar.
  2. Click on "Bot" and then "Add Bot"
  3. Click on "Copy" under "Token" to copy your token and paste it into the TOKEN field in channel_commander.txt

Getting CC Bot into your server

The CC bot is only useful if it's in a server. You'll need to get an invite link to invite it. This is generated in the OAuth2 tab of your bot's page on Discord's Applications. In the "Scopes" area, check "bot" and copy the generated link. If you own or are an admin on your server, paste the link into your browser and invite the bot. If you aren't, send the link to someone who is.

Using CC Bot

Now you've installed everything, updated channel_commander.txt and got the bot onto your server, it's time to use it!

To run the bot, open a command prompt/terminal. For Windows, open the start menu, type cmd and click on "Command Prompt". For Mac and Linux, open the terminal. Change directory to where you have downloaded the bot by typing cd C:\path\to\bot in Windows or cd /path/to/bot in Mac or Linux. Then type python channel_commander.py and hit ENTER. Mac may need root to run, if so type sudo python channel_commander.py and hit ENTER.

If all goes well, after a moment the command prompt/terminal should now read:

client.user.name <Name_of_Bot>
client.user.id <some numbers>
Owned by <cc_name>
Audio input at 48000Hz with 2 channels
Audio output at 48000Hz with 2 channels

If it doesn't something has gone wrong. Try it all again maybe? I dunno...

Once it's running, there are only a couple of commands. These are typed into any of the channels of the server the bot is in and they all start with !cc

  • !cc help: Shows the help list incase you forget anything
  • !cc rename new_name: Changes CC bot's nickname to new_name
  • !cc shutdown: Shuts down CC bot
  • !cc start: Connects CC bot to cc_channel so it/you can speak and hear CC
  • !cc stop: Disconnects CC bot from cc_channel. May cause the bot to crash and I don't know why (yet).

Channel Commander

Once you and your cronies have your CC Bots running, you will need to set up the channels properly. Put all of your CC Bots into a single channel so they can talk to each other. Then you can be somewhere else. When you press and hold your cc_key and talk, your voice will be broadcast by your CC Bot. The other CC Bots will hear this and broad cast your voice to their respective owners.

That's it. Get to it and rule the battlefield with your chums!

channel-commander's People

Contributors

adocilesloth 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.