Setup - HopsonCommunity/HopsonBot GitHub Wiki

Setting up the bot

Creating a bot application

You'll need to either create a new server or use an existing one to test the bot on.

To create a new bot application, click here website. Log in if you haven't already and click the "New App" button. Give it any name and a profile picture if you wish. Press the "Create App" button when you're done.

You should be on your bot's info screen at this point. Scroll down a bit to the section named "Bot" and click the blue/purple button which says "Create a Bot User." This turns your "app" into a bot.

Getting the bot onto your server

Keep your bot's info page open and go to this link. Tick the box that says "Administrator" on the big list of permissions. This will make your bot an admin when it joins the server. You don't need to enable any of the other boxes since administrator = can do everything. Probably.

A bit below the boxes are some other things. There's a text field with the text "Client ID". Keep this in mind.

Now go to your bot's info page. Use your browser's search-inside-page function (CTRL+F) to search for the text "Client ID". You can look for it yourself as well, it's somewhere near the top.

If you found the "Client ID" text you can see that there is a long string of random numbers next to it. This is your bot's user ID, or formally known as "Client ID." Go ahead and copy this ID.

Now go back to the permissions calculator page (the one I linked you to earlier!). Paste the ID into the text field that says "Client ID" (I hope you kept this text field in mind like I told you!). If the line under the field turns green, you're ready to continue reading. Double-check that you've enabled the "Administrator" permission near the top.

Now go to the bottom of the page. There's a big link. Click that link. There's a drop-down selection menu. Click it and select the server you want the bot to go to. After you've done that, press the big blue/purple button at the bottom. Confirm that you are not a bot yourself and you're good to go. Close the window/tab when the site tells you to.

If everything went well, your bot should now be on the selected server.

Running the bot

Fork this repository and clone the fork onto your PC. You'll need to download Node.js for the bot to work. You also need npm to download the necessary packages.

After you've installed Node.js (and npm), open up a terminal window (command prompt for Windows users) and navigate to the repository which you cloned. Type the command npm install to download all the necessary packages that Node.js will use while running the bot.

Next, you will need to create a bot token in order to run the bot. Go here to find your token.

Hit CTRL+F and search for "token". Navigate to the topmost result. It should say "Token: click to reveal." Click it.

The long string of random characters is your bot's token. Don't share it to anyone unless you want them to have access to the bot.

Copy this token and follow the below instructions.

Create a config.js file in the data/ folder with the following contents:

//config.js
module.exports = 
{
    getToken: function() 
    {
        return "your_token_here";
    }
}

Go back to your terminal/command prompt. Type npm start. This will run the "start" script that is located in the package.json file. If everything goes right, it should say something about the bot logging in and such. This is good. Go back to the server where you added the bot into. The bot should be online.

To test if everything works, type >help into the chat. If the bot responds with a list of commands, you've done everything right.