Skip to content
Jayden Bailey edited this page Aug 30, 2016 · 13 revisions

Table of Contents

Introduction

  1. Step 1: Preparation
  2. Step 2: Download and setup MusicBot
  3. Step 3: Start the bot
  4. Step 4: Running the bot in a Screen (Optional)

Introduction

Installing the bot on OSX requires the downloading of several libraries. These libraries are best managed with Homebrew. Homebrew and a basic text editor are required for this MusicBot to function.

Step 1: Preparation

Let's get everything ready to install.

1.a: Installing a TextEditor

If you do not have a text editor, download a basic text editor from the Apple App Store (TextWrangler, or equivalent) or download an outside editor such as Atom.

1.b: Installing Homebrew

Following that, you will install Homebrew To install Homebrew open up Terminal.app found on your computer and copy+paste the following command then press RETURN:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Run brew update to fetch the latest package data.

###1.c: Installing xcode-select

In order for the bot to function properly you need to install xcode command line tools to your mac. You will do this in Terminal.app by running the following command line:

xcode-select --install

A dialog box will open asking if you want to install xcode-select. Select install and finish the installation.

###1.d: Installing Python

Next, you need to install Python3.5 or later. ClickHere to start downloading Python3.5.1.

After downloading, open the python-3.5.1-macosx10.6.pkg you downloaded to begin installation.

This will be the first thing you see when it opens. Click Continue. Python installer initial screen

Click Continue. Python read me screen

Read the Software License Agreement then Click Continue Python license screen

Click Agree. Python license accept screen

Choose your installation destination (Recommended: Downloads), then Click Install. Python installation destination and type

After the installation screen you will see this... Click Close. Python install successful screen

Congratulations you have successfully installed Python3.5!!

1.e: Installing dependencies

To install dependencies, enter the following commands without sudo

brew install git
brew install ffmpeg
brew install opus
brew install libffi
brew install libsodium

2: Download and setup MusicBot

To get the latest version of MusicBot, run this command using Terminal.app:

cd desktop
git clone https://github.com/SexualRhinoceros/MusicBot.git MusicBot -b master 
cd    

cd'ing to the desktop allows you to quickly find your MusicBot folder as it places the folder directly on your desktop.

###2.a: Allowing Terminal to Run Files

In order for Terminal.app to run the .command files needed for the bot you will need to do the following:

In Terminal.app type the command below followed by a space:

chmod +x 

Click and drag the file update_macdeps.command into terminal then press RETURN. Repeat the above for the runbot_mac.command file. You should then be able to double-click the command files to run the bot.

Example:

Terminal chmod commands

2.b: Install python dependencies

Run the following file that is located in your MusicBot's main folder.
Run this file:

update_macdeps.command    

You may have to right click the file, mouse over 'Open With' then select 'Terminal.app'

This installs the various python dependencies used by the bot.

2.c: Change configuration files

If you haven't already done so, you will need to create a Discord oAuth2 BOT account.
Go to https://discordapp.com/developers/applications/me and create a new application.
Use this video for reference: https://www.youtube.com/watch?v=yQhdjAWmObM

Note: When creating the Bot User, remember to untick "Require OAuth2 Code Grant". This is for multiple scopes, but since you only use one it will break the authorization if you tick it.

Untick OAuth2 Code Grant

To invite your bot to your server replace <CLIENT ID> with your bot's client ID in this link:
https://discordapp.com/oauth2/authorize?&client_id=<CLIENT ID>&scope=bot&permissions=0

Example:
https://discordapp.com/oauth2/authorize?client_id=17000000000000296&scope=bot&permissions=0

For more info refer to: https://discordapp.com/developers/docs/topics/oauth2#adding-bots-to-guilds

Note: You need to have the Manage Server permission to add it to a server...

The configuration files are located in the config folder. There are two files, example_options.ini and example_permissions.ini that tell you how to configure the bot. You should copy and rename these files to options.ini and permissions.ini respectively, then edit them.

Music Bot Config Folder

Open options.ini in a text editor of your choosing from the one you downloaded at the beginning of this guide. I suggest TextWrangler or Atom.

Configure the file however you want, it should explain everything you need. The two things you MUST change are the bot's Token and your OwnerID. Begin by making the following changes to the to these lines:

Changing your options.ini

Getting your token

If you have any further questions, you can ask on the help server.

3: Start the bot

To start the bot navigate back to your MusicBot's main folder.
Run:

runbot_mac.command    

You may have to right click the file, mouse over 'Open With' then select 'Terminal.app'

If you see this:

Connected!

Username: [Bot Username]
ID: [Bot User ID]
--Server List--
[Server Name(s)]

that means everything is good and running correctly!

You don't need to do anything else! 😄 You can check out the wiki articles to find out how to use your bot. 😁 If you have further questions please visit our Help Server on Discord.

4: Running the bot in a Screen (Optional)

Running the bot in a screen allows you to close Terminal without it shutting down the bot. If you don't run the bot in a screen, closing Terminal will cancel the bots operations and disconnect it from Discord. Screen simply allows you to close Terminal with out this happening.
(This is an optional step that is only for user preference. You don't have to do this.)

To make your life easier, this is best performed by keeping your MusicBot's folder on the desktop.

If your bot is currently running cancel its operations by pressing Ctrl+C before continuing on to these steps.

If you aren't already in a the music bots folder through Terminal go ahead and perform these steps (if your Terminal line looks like this Name-MacBook-Pro:MusicBot-1.9.7 Username$ or similar, skip to "Run this to make a screen console"):

cd desktop
cd MusicBot

Run this to make a screen console:

screen -S bot

This creates a screen console with the name 'bot' so you can easily come back later if there are any problems. Don't be alarmed that the Terminal window became empty.

To start the bot in this screen, run:

python3.5 run.py

Once that's online and good, press Ctrl+a then d separately to 'detach' from the screen. Your music bot should still be online on your server.

Now you can close your Terminal window and play with your bot!

If you ever want to have a look at the bot's console logs, SSH back into the machine and run:

screen -r bot

That should bring everything back up. NOTE: You can close the terminal without the bot disconnecting, however if you shut down your computer, close the lid, or let it sleep you will have to restart the bot again.

Clone this wiki locally