Starting off
Introduction
Floppy.js was built from the ground-up to have the best developer experience of any Discord wrapper. In addition, we make to use the ES6 Asynchronous requests and Promises wherever possible for quick and easy error handling.
Before we start, follow this warning: This is not for beginners. We make use of Websockets, handlers and EventEmitters so DO NOT make the same mistake as me and dive into the Discord API without prior knowledge of JavaScript.
Project setup
In this project, we will be making a Multipurpose Bot. We will be naming this "Lime", but you can name it whatever you want. To get started, head to the Discord Developer Portal and hit "Applications". Then, create a new Application with whatever you want to name your bot. Once completed, navigate to the "Bot" tab and add a new bot. This is the user we will be interacting with.
Next, we will need to add the user to a Guild.
A Guild is the API term for a Server, as they are more commonly referred to in the Discord Client.
We can make use of Discord's OAuth2 System for this. Navigate to the "OAuth2" tab and select the "Bot" scope. Then, select the "Administrator" permission.
The Administrator permission grants every permission to the bot. Use wisely!
A link will now appear on the Scopes panel. Open it up, then Authorise the bot into a Guild you own. Now, go into your IDE of choice (I prefer Visual Studio Code for JavaScript programs, but it's up to you) and create the file index.js
. Open your terminal and navigate to the folder and run npm init -y
. This will create an npm package.json file for the bot. To install Floppy.js, run npm i floppy.js
. We are now all setup to start programming!
Whilst going through this guide, check out the code we've written to go with it!
Last updated