Search the Community
Showing results for tags 'node.js'.
Found 2 results
Hello and welcome again. We will continue to build our custom bot. We saw how to start building the bot with Discord API on first part of this tutorial, we’re going to install node.js before coding your bot. The first part of this tutorial is here: PART 2 First, what’s node.js?. Simple and quick explanation: The node.js run-time environment includes all you need to execute java programs written in Java Script. Our bot will be written in JS, Discord and web applications are built with JS too. Node.js is open source, you can work with it on Linux, Mac or Windows OS. It’s a standard. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world. We will use npm to download the Extra Life (to get Extra Life info) and Discord.js (to work with Discord) packages. If you get experience you can get more packages for other cool stuff. Let’s start. First step Install Node.js in your computer. I won't explain how to install because depends of each operating system but the process is simple like installing any other software: https://nodejs.org/en/download/ I’m demonstrating this example on Window System. It’s similar on Linux and Mac. Create a folder for your Discord bot, mine is “Discordbot” Long version explanation (shorter will added later): Open a command prompt on Windows. Run-> type cmd or start-> Windows System->Command prompt Go to your bot folder and run the command “npm init -y” to initialize your Project. This will create a package.json file. No worries, this is like a configuration file to read dependencies, scripts, descriptions, etc. Let’s continue by installing the Discord.js library. This library will allow you to interact with Discord API. Remember you built your bot with the Discord API on part 1. Run the command “npm install --save discord.js”. You will see the following output. No worries for the warnings. Now you have the discord.js library on your computer. Let’s move by installing the Extra Life library to interact with the Extra Life API. Run the command “npm i extra-life-api”. The output is the following. You have the Discord API on your computer too. Let’s do a brief check list. Bot application created on Discord portal (Done) Project initiated (Done) Node.js installed (Done) Discord.js library installed (Done) Extra Life library installed (Done) Alright You got your application bot created and the environment to start coding your bot is ready. Next chapter I will explain how to start to login and run your bot. It will read your Extra Life commands. If you enjoy this, please share!