> For the complete documentation index, see [llms.txt](https://djsguide.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://djsguide.js.org/starting-and-hosting-your-bot/making-your-bot-online.md).

# Making your bot online

In the last guide, we talked about how to get your application/bot ready. In this guide, we will show you how to make your bot online, with the importing and the actual coding of the bot in node.js. We will talk about 24/7 hosting.

### Importing packages required

In a windows 10 or mac, make sure that the latest version of node.js command prompt is installed and have npm enabled in set up wizard. Create a folder with a name `my-discord-bot`

Mainly, the only required package is [discord.js](https://discord.js.org). Type in the following code:

{% code title="index.js" %}

```javascript
const Discord = require("discord.js")
//do npm install discord.js in node.js command prompt to make the code work
const client = new Discord.Client()
```

{% endcode %}

{% hint style="info" %}
All of the code in this guide is in index.js
{% endhint %}

There is a library made by our team that make coding a discord bot easier. See [the official documentation](https://discordlib.js.org) for using it.

### The ready event and login method

Now that we imported the package, let's move on to the ready event and login method.

The ready event will be emitted when the bot is ready to ready message and do action. The game setting method and a lot of other method will go in here. They will be included in some later guides. Here are the example code below:

{% code title="index.js" %}

```javascript
client.on("ready", () => {
    console.log(`${client.user.tag} is ready to server ${client.guilds.size} servers!`)
})
```

{% endcode %}

But the ready event requires a bot to be logged in. You could do that with the following code:

{% code title="index.js" %}

```javascript
client.login("token")
//Change 'token' to your own bot token you get in discord developer portal
```

{% endcode %}

So I guess that is it for this guide! in the next guide, we will talk about 24/7 hosting.
