Setting Up WizBot on OSX (macOS)

Table of Contents
Prerequisites
Installing Homebrew
Downloading and Running WizBot
Running WizBot with the Terminal closed
Using WizBot with pm2 (easiest method)
Using WizBot with tmux (if you don't want to use pm2)
Doing a clean reinstall

Prerequisites

Installing Homebrew

  • Open Terminal (if you don't know how to, click on the magnifying glass on the top right corner of your screen and type Terminal on the window that pops up).
  • Copy and paste this command, then press Enter:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Installing the prerequisites

Run this command in Terminal (copy-paste the entire block):

brew install wget git ffmpeg openssl opus opus-tools opusfile libffi libsodium tmux python youtube-dl redis npm

brew services start redis

npm install pm2@3.1.3 -g
Installing dotNET Core SDK
  • Download dotNET Core SDK 3.1
  • Open the .pkg file you've downloaded and install it.
  • Run this command in Terminal. There won't be any output. (copy-paste the entire block):
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/

ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Downloading and Running WizBot

  • Use the following command to download and run the installer. (PS: Do not rename the linuxAIO.sh file)
    cd ~ && wget -N https://github.com/Wizkiller96/WizBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh
  • Choose Option 1 to download WizBot. Once installation is completed you should see the options again.
  • Choose Option 5 to set up your credentials according to this guide, or find and edit the credentials.json file manually.
  • Choose Option 2 to Run WizBot (Normally).
  • Check in your Discord server if your new bot is working properly. Once you're done testing, type .die on Discord to shut it down. The Terminal should automatically return to the main menu.

Running WizBot with the terminal closed

If you run WizBot through option 2 or 3 and close the terminal, WizBot will also close. To avoid this, you'll need to use a process manager that will keep it open and running in the background. This section of the guide instructs on how to achieve this with pm2 and tmux. Whether you pick one or the other, please do not simultaneously, or you're going to get double responses to every command.

Using WizBot with pm2 (easiest method)

  • pm2 will not only allow WizBot to run in the background, but will also automatically launch WizBot upon system reboots.
  • Open the installer, if you haven't already:
    cd ~ && wget -N https://github.com/Wizkiller96/WizBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh
  • Run Option 7 (ignore Option 6, that's for Linux only).
  • Pick whether you want to run it with or without auto-restart and auto-update.
  • Once it's done, run Option 8 to exit.
  • That's it. Your bot should be running in the background. Feel free to close the Terminal window.
    Managing WizBot with pm2
  • Use the following commands on Terminal to check your WizBot setup:
  • pm2 status to see all pm2 processes
  • pm2 info WizBot to see information about WizBot
  • pm2 logs WizBot to view real-time logs of WizBot, or
  • pm2 logs WizBot --lines number (number = how many lines you want to output) to see a specific amount of lines of the log. The logfile is also stored and presented at the top of these commands
    Updating WizBot with pm2
  • If you have set up WizBot with auto-update, simply run .die on your Discord server. That's it.
  • If you have set up WizBot with no auto-update:
  • Shut your bot down with pm2 stop WizBot
  • Open the installer with bash linuxAIO.sh and choose Option 1
  • Once it's done, exit the installer with Option 8 and run pm2 restart WizBot
    • You can watch your bot going online with pm2 logs WizBot

Using WizBot with tmux (if you don't want to use pm2)

  • On the Terminal, create a new session:
  • tmux new -s wizbot

The above command will create a new session named wizbot (you can replace “wizbot” with anything you prefer, it's your session name).

  • Run the installer: bash linuxAIO.sh
  • Choose 2 to Run WizBot normally.
  • NOTE: With this option, if you use .die on Discord, the bot will shut down and stay offline until you manually run it again.
  • Choose 3 to Run WizBot with Auto Restart.
  • NOTE: With this option, the bot will auto run if you use .die, making it function as a restart.

If you pick Option 3, you will be shown the following options:

1. Run Auto Restart normally without Updating.
2. Run Auto Restart and update WizBot.
3. Exit
  • With Option 1, the bot will restart on .die command and will not download the latest build available.
  • With Option 2, the bot will restart and download the latest build available everytime the .die command is used.

Now check your Discord server, the bot should be online.

  • To move the bot to the background, press Control+B, release the keys then hit D. That will detach the session, allowing you to finally close the terminal window and not worry about having your bot shut down in the process.
    Updating WizBot with tmux
  • If you're running WizBot with auto-update, just type .die in your Discord server. That's it!
  • If you're running WizBot with no auto-update:
  • Kill your previous session.
    - Check the session name with tmux ls
    - Kill with tmux kill-session -t wizbot (don't forget to replace "wizbot" with whatever you named your bot's session).
    • Create a new session: tmux new -s wizbot
    • Run this command: cd ~ && wget -N https://github.com/Wizkiller96/WizBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh
    • Choose Option 1 to download the most up to date version of WizBot.
    • Once it's done, choose Option 2 or 3 and detach the session by pressing Control+B, release then D.
      Additional Information
  • If you want to see the active sessions, run tmux ls. That will give you the list of the currently running sessions.
  • If you want to switch to/see a specific session, type tmux a -t wizbot (wizbot is the name of the session we created before so, replace it with the session name you have created).
  • If you want to go through the log, press Control+B, release the keys then hit Page Up or Page Down to navigate.
    • Don't forget to always detach from the session by pressing Control+B then D once you're done.
  • If you want create a new session, run tmux new -s wizbot. If you want to kill it, run tmux kill-session -t wizbot

Doing a clean reinstall

  • Make a backup of your credentials (~/WizBot/src/WizBot/credentials.json)
  • Make a backup of the database (~/WizBot/src/WizBot/bin/Release/netcoreapp2.0/data/WizBot.db)
  • Make a backup of the images (~/WizBot/src/WizBot/data/images.json)
  • Delete the WizBot folder
  • Install the bot from scratch, replace the files you backed up and run.

Help! My music isn't working

Make sure you have the Google API Key in your credentials.json If music still isn't working, try reinstalling ffmpeg:

  • brew update && brew upgrade (Update formulae and Homebrew itself && Install newer versions of outdated packages)
  • brew prune (Remove dead symlinks from Homebrew’s prefix)
  • brew doctor (Check your Homebrew installation for common issues)
  • Then try brew install ffmpeg again.