In this wiki article we will be running through the setup process of the WISP.js bot, it's fairly simple to run locally although it is also supported on SyteSpace's discord bot hosting.
Before we start, please be aware that WISP.js only works with node.js 12+ and discord.js 12+. You can check the version of your Node.js by excuting node --version and the version of your discord.js.. npm view discord.js version. You will need to make sure you also have Node.js installed on your system if you don't already :) To get started, you'll need to download WISP.js from the Github Repo. Once you have downloaded it, you will need to move the zip file into a sensible location and extract the contents. Once you have done this, you should have something that looks similar to this:
Once you have done this, we are now ready to start editing the config file. Open the config file in a text editor, i will be using Visual Studio Code for the purpose of this tutorial. When you open the config file you will see all of the options that you will need to customise, everything is clearly explained in the config file. Please take your time to read everything before progressing onto the next step. Firstly, you will need to fill out the api key. To generate an api key navigate to https://syte.space/account/security and click "Create New", you can put anything in the name field as it doesn't really matter. The other box you can leave empty. Don't give your API key to anyone you don't trust 100%! The copy the string of numbers and letters you generated and enter it into the field below:
Next, we need to fill in the BOTTOKEN field, if you haven't already you will need to create a discord bot application. Go to https://discordapp.com/developers/applications, and create an application name it to whatever you want. Then you will need to click on the "Bot" tab on the left, and create a bot user.
Once you've done this, click on "OAuth2" on the same side menu. Click on "bot" in the scopes section and then select on "Administrator" under the Bot Permissions area. After this, copy the link it gives you and enter it into your browser.
Then follow the link generated and add the discord bot to a server of your choice. We recommened only adding it to a small discord server with only you and other players of your server, ideally other trusted staff members. Although, if you setup the permissions in the config file correctly, you can restrict certain commands to certain roles.
Next, you will need to change the Panel URL, enter https://syte.space/ be sure to include the / at the end.
Now we will need to configure the bot's permissions. Firstly you will need to grab the role ids for people who you want to be able to do everything with the bot. Only give this to people you trust! To get the role id for your administrator role, simply navigate to your server tag the role. And add "\" infront of the role tag. Once you hit enter it should give you the discord role id.
Copy this string of numbers, you will only need the numbers and can get rid of the <@& and >, (In this example our role id is 563441156902354944)
In the exports.permissions area of your config file you can change what role each execute and perform each command, simply putting the role ids in the fields will allow everyone with that selected role to acceess the corrosponding command.
In our example we are only allowing role 2 to access "cmd" but not "power", Note: Adding a * into the fields will allow anyone to execute the command, no permissions required.
Finally, you will need to scroll to the bottom of the config file. We will need to change around the server config.
In these fields you will need to enter your server name. From the screnshot above, the red fields will need to be your server names e.g hub, bungee, skyblock. And the green fields which are in speech marks, will need to be your server ids for each server respectivly.
You can find your server's unique identifier in the highlighted area on your panel homepage. You should then end up with something that looks similar to the following:
This is all for the configuration file. Next we will need to work on getting the bot up and running locally on our pc to make sure everything is working as it's meant to.
Navigate to where you put all of your WISP.js bot files and click on the directory extention (for windows) and type in "cmd", this will open up a command window.
Once you have the command window open you will need to install all discord.js and all of the modules it needs to operate. This can all be done by excuting just one command, type in npm install into the command prompt. This will install discord.js and all of the modules needed for the bot to operate.
After you have done this your discord bot should be all good to launch, to start your discord bot. Type into the command prompt "node index.js", this will start your bot and if successful should display you with your discord bot's user information.
Your bot then should be seen as online in your discord server. You can then run the command "!help", which will display you with a list of the commands for wisp.js
You can now perform actions such as, checking the status of a server, checking the online player count of a server, send a power signal to a server and sending a command to the server's console.
For example, "!hub1 status".
Congratulations! Your bot is now fully setup. We will be offering brief support in the SyteSpace Discord Server in the #general-support channel, for setting up WISP.js with our panel.
Massive Thanks to Maineiac for creating this awesome bot, if you have any problems please contact us in our discord to double check it's not an issue you've made setting the bot up, before creating an issue on WISP.js' github.