# How to Run This Bot in Local

## Penduhulan

AutoForwards Bot is an open source project, anyone can develop it further, but before trying to develop it, it is good to know how to run this bot and how it works.

{% hint style="info" %}
Note: Before doing Clone there are several software that you must prepare, here is the software.

* [Git](https://git-scm.com/downloads)
* [NodeJS](https://nodejs.org/en/download)
  {% endhint %}

## Tutorial Run in Local

### Step 1 - Clone this project / Download this project

{% tabs %}
{% tab title="Clone Project" %}

* Before cloning, you must have git, you can get it [here](https://git-scm.com/downloads).
* If you have opened the [project page](https://github.com/dhino12/TelegramBot-AutoForward). Then click the <mark style="background-color:green;"><> Code</mark> button and copy the Project HTTPS link, as shown below<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/ilEcK2aWYhwZbke3mEzz/clone%20project.png" alt=""><figcaption></figcaption></figure>
* If so, you can open the git software, which you have installed before, then type \
  `git clone <THE GIT LINK YOU COPIED>` if so press enter.
* still in the git software, type `cd TelegramBot-AutoForward`, and press enter
* if you have downloaded and installed [NodeJS](https://nodejs.org/en/download), the next step you can type in the git software, `npm i` and press enter. Wait for it to finish
* Finish<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/bRw9Il8DNU8CBAh6liMX/clone%20project.png" alt=""><figcaption><p>Git software, clone project and install nodejs package</p></figcaption></figure>

{% endtab %}

{% tab title="Download Project" %}

* Open the project page [TelegramBot-AutoForward](https://github.com/dhino12/TelegramBot-AutoForward)
* Click button <mark style="background-color:green;"><> Code</mark>.
* Click button `Download ZIP`
* If you have `extract zip`&#x20;
* Then open cmd in a way, when cmd on the windows explorer url like this.<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/Rr6hg55RAvJ1aQTM7OmO/run%20cmd.png" alt=""><figcaption></figcaption></figure>
* If so, type `cd TelegramBot-AutoForward` , and press enter
* Next, type `npm i`. [NodeJS](https://nodejs.org/en/download) is required to run this
* Finish<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/EHNZ3WgOF4Z2eqeH3NXU/cmd%20npm%20i.png" alt=""><figcaption><p>npm i, dengan langkah download projek</p></figcaption></figure>

{% endtab %}
{% endtabs %}

### Step 2 - Prepare .env

[.env](https://github.com/dhino12/TelegramBot-AutoForward/blob/master/.env) is the development environment needed to run this TelegramBot-AutoForward project, previously we have prepared the[ .env](https://github.com/dhino12/TelegramBot-AutoForward/blob/master/.env) file, just fill in the values

* Open the .env file, which is located in the TelegramBot-AutoForward folder (which you have cloned)
* there are several keys that must be filled with value

{% hint style="info" %}
**Note:** to fill in the key, you can follow the tabs menu below.

NODE\_ENV= \<Fill in the development>

BOT\_TOKEN= \<obtained from [BotFather](https://t.me/botfather), on telegram>

APPID= \<obtained from [mytelegram](https://my.telegram.org/auth)>

APPHASH=\<obtained from [mytelegram](https://my.telegram.org/auth)>
{% endhint %}

{% tabs %}
{% tab title="APPID & APPHASH" %}

* First step open, [my.telegram.org](https://my.telegram.org/auth).
* fill in your **phone-number** in the form provided by telegram, if so click next.
* You will be asked to enter a **confirmation code**, you can check your telegram, the code sent by the telegram, and paste it on the form provided, if so, press **sign in**.
* Click **API development tools**.&#x20;
* yey 🙌 You can copy the **App api\_id** and **App api\_hash** columns, don't forget to fill in the **App title** and **short name** according to the bot you created..<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/JCTlWtDpjEr1zpLxyN1l/mytelegram.png" alt=""><figcaption></figcaption></figure>

{% endtab %}

{% tab title="BOT\_TOKEN" %}

* To get **BOT\_TOKEN**, open your telegram visit BotFather, click on [here](https://t.me/botfather).
* Type`/start` to view the list of commands.
* Type `/newbot` to create a new bot.
* Then enter the name of the bot you want to create.
* If so you will be given`BOT_TOKEN`. 🙌<br>

  <figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/Cn4468ogNvnSYthOdKib/create%20newbot.png" alt="" width="542"><figcaption><p>Membuat bot baru</p></figcaption></figure>

{% endtab %}
{% endtabs %}

* If you have gotten all the codes and tokens, then fill in the .env file, according to the required values
* Finish, YEY ✨

### Step 3 - Running Bot

Once everything is ready, you just need to open cmd / git, then run `npm run dev,` finished you can use every command on the bot, if there are bugs please write to [issue dalam github](https://github.com/dhino12/TelegramBot-AutoForward/issues)

<figure><img src="https://content.gitbook.com/content/dzJkuIA539DrSlGIJhmc/blobs/yh3X4caXYxfklpraVlqx/finished%20bot.png" alt="" width="548"><figcaption></figcaption></figure>
