Skip to content

How to run thatskybot on Discord

Tracey edited this page Jul 8, 2020 · 2 revisions

Summary

https://discordapp.com/channels/621746949485232154/621746950458572801/661640455657619486

  1. Go to https://github.com/e-a-h/That-Sky-Bot/ and clone it to your computer. Check that you have the requirements. Then git checkout dev-music

Set up Discord

  1. Go to https://discordapp.com/developers/applications/ and create a new application with a bot.
  • Take note of where to copy the "token" for your bot (client secret).
  • Make a test server on Discord with a #logs channel.
  • Go to your Discord settings > Appearance > turn on Developer Mode.
  • Right click and copy ID of the #logs channel, and store it somewhere.

Then invite it to your server: https://github.com/sky-music/sky-python-music-sheet-maker/wiki/Invite-a-Discord-bot-to-your-server

Set up the database

  1. I used https://mariadb.com/ for the database (I have a Mac https://mariadb.com/kb/en/installing-mariadb-on-macos-using-homebrew/)

In a terminal, run this to start the server:

mysql.server start

The first time following these steps, create an empty database with a user:

sudo mysql -u root
CREATE database skybot;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON skybot.* TO 'username'@localhost;
FLUSH PRIVILEGES

Replace username and password, keeping the single quotes. (Username and password are used later in step 4)

Warning ⚠️: The password will be written in plain text, so it is advised to use a password that you don’t use anywhere else.

Set up the bot

  1. Make a new file in That-Sky-Bot called config.json, and paste the contents from config.example.json

Edit the corresponding parts of config.json:

  • token is the Discord token from step 2
  • DATABASE_USER and DATABASE_PASS are your username and password from step 3
  • DATABASE_HOST is localhost, DATABASE_NAME is skybot, DATABASE_PORT depends (I have 3306 for MariaDB)
  • log_channel is the ID from step 2
  • make sure that “Music” is in the list of cogs
  1. Remove the existing python-music-sheet-maker folder to add our python music sheet maker as a submodule:
rm -rf sky-python-music-sheet-maker
git rm sky-python-music-sheet-maker
git submodule add https://github.com/sky-music/sky-python-music-sheet-maker.git

https://stackoverflow.com/questions/20929336/git-submodule-add-a-git-directory-is-found-locally-issue

Run the bot

  1. Run this to start the database connection, each time before starting the bot. (If you're following these steps for the first time, you may already have it up.)
mysql.server start

Then run sky.py. Ctrl + C to stop running the bot

Switch branches on the sky-python-music-sheet-maker submodule

Change directory to where you saved the bot:

cd YOUR_FILEPATH/That-Sky-Bot

Then go to the sky-python-music-sheet-maker submodule, and git checkout the dev branch (or any other branch):

cd sky-python-music-sheet-maker
git checkout dev