Getting Started

Getting started with the Spark framework

Installing Node.js

This framework requires Node.js.
Click the button below to download v8.0 or higher.


Download

After finishing the installation, restart your computer.


Setting up the bot

Download a recommended code editor from below:


After you have finished installation. Create a folder where you will create your bot files. In that folder, create a file; in this tutorial we will call it bot.js.
Paste the following code into the file:

const Spark = require("sparkbots")
Spark.start({
prefix: "prefix-here",
token: "token-here" })

Replace prefix-here with the desired prefix, for example ! or ?.

You can also use an array for multiple prefixes, for example ["!!", "??"].

It is recommended that you use a unique prefix, instead of common prefixes such as !, ?, and ..


Important
Your prefix cannot have any spaces or the bot will exit with an error message.

To get your bot token, click below to create an application.


Create Application

Enter your desired bot name under "App Name", enter your bot description, and an icon. Only "App Name" is required.

After the creation, scroll down to the "Bot" section and click "Create a Bot User".

Somewhere on your page, you should find:

Token: Click to reveal


Click on it and copy the token. It should look something like this:

NDAwMjIzNDI1OTE2MDQzMjY1.DTYgwQ.4z6d5gvUQ685jJhwFNYG_pCrBBo


Replace token-here with the token copied.


Important
Never share your token with anyone. The token provides anyone with access to controlling your bot.
When compromised, reset your token immediately on the bot application page.

Starting the bot

To start your bot, open a command prompt/terminal window. Navigate to the folder by using the cd command:

cd /folder-name/folder-name/etc.

When you are in the same folder as your bot file, type the command npm install sparkbots to install the Spark Framework.

After everything is finished, type node bot.js to start your bot.

If everything went correctly, you should receive a reply on the window starting with:

Your bot (bot-name) is now online! | Running on 1 servers

bot-name is the name you previously set in the application.


You have now successfully set up your bot!


Creating Commands