From 21bbdcfce7de386e8b6a77a7140d9d0c2484146d Mon Sep 17 00:00:00 2001 From: Robson Date: Tue, 6 Feb 2024 11:56:40 -0300 Subject: [PATCH] refactor: apply few changes on readme files --- docs/README-en.md | 87 +++++++++++++++++++++++++++++++---------------- docs/README.md | 45 +++++++++++++++++++----- 2 files changed, 93 insertions(+), 39 deletions(-) diff --git a/docs/README-en.md b/docs/README-en.md index a6a38df..002ed5b 100644 --- a/docs/README-en.md +++ b/docs/README-en.md @@ -3,78 +3,105 @@ [![pytest](https://img.shields.io/badge/pytest-enabled-brightgreen?logo=pytest&logoColor=#0A9EDC)](https://docs.pytest.org/en/7.4.x/) # Discord Bot -Não fala inglês? [Clique aqui](https://github.com/Robso-creator/discord_bot/blob/main/README.md) para ver esta página em português -This is a Discord bot project developed in Python that offers a variety of features to enhance the user experience on Discord servers. The bot was created to be flexible, user-friendly, and expandable, allowing customization of commands and integration with other services. +Don't speak Portuguese? [Click here](https://github.com/Robso-creator/discord_bot/blob/main/README-en.md) to view +this page in English -Commands documentation available [here](https://robso-creator.github.io/discord_bot/commands/) +This is a Discord bot project developed in Python that offers a variety of features to enhance the user experience on +Discord servers. The bot was created to be flexible, user-friendly, and expandable, allowing customization of commands +and integration with other services. -# Table of Contents +Documentation of commands is available [here](https://robso-creator.github.io/discord_bot/commands/) -* [Generating Required Tokens](#generating-required-tokens) - * [Creating a Discord Bot Account](#creating-a-discord-bot-account) - * [Generating NASA API Authentication Token](#generating-nasa-api-authentication-token) +# Summary + +* [Creating Necessary Tokens](#creating-necessary-tokens) + * [Generate bot account on Discord](#generate-bot-account-on-discord) + * [Generate NASA API authentication token](#generate-nasa-api-authentication-token) * [Setup & Launch](#setup-&-launch) -# Generating Required Tokens +# Creating Necessary Tokens + +For the bot to function properly, some tokens need to be provided. Below you can understand how to generate them. -For the bot to function properly, some tokens need to be provided. Below, you can understand how to generate them. +## Generate bot account on Discord -## Creating a Discord Bot Account -Step-by-step from [freecodecamp](https://www.freecodecamp.org/portuguese/news/tutorial-de-criacao-de-bot-para-o-discord-em-python/) +Step by step guide +from [freecodecamp](https://www.freecodecamp.org/portuguese/news/tutorial-de-criacao-de-bot-para-o-discord-em-python/) + +1. Be logged into the [platform](https://discord.com/); +2. Access the [developer page](https://discord.com/developers/applications); +3. Click on the "New Application" button in the top right corner:
+ ![img.png](../static/new_application_img.png) +4. Go to the "Bot" tab and click "Add Bot"; -1. Be logged into the [platform](https://discord.com/). -2. Access the [developer portal](https://discord.com/developers/applications). -3. Click on the "New Application" button in the upper right corner: -![img.png](../static/new_application_img.png) -4. Go to the "Bot" tab and click "Add Bot". > Keep the default settings for Public Bot (checked) and Require OAuth2 Code Grant (unchecked). -5. Copy the Token; it will be used for bot authentication. -## Generating NASA API Authentication Token +5. Copy the Token, it will be used for authenticating your bot.
+6. While you're at it, on the same page, click "OAuth2" and select "bot" + +> In this step, we're going to add the bot to your server. -This token is not mandatory; for testing, the DEMO_KEY is sufficient. -With authentication, the API rate limit increases significantly. +7. Then choose the permissions you want to give to your bot, for the default of this repository only text message + permissions are sufficient. +8. Click the 'copy' button above the permissions and paste it into your browser, select the server you want to add the + bot to and then click "Authorize" + +## Generate NASA API authentication token + +This token is not mandatory, for testing purposes only the DEMO_KEY is sufficient. +With authentication, the hit limit on the API increases dramatically + +1. The first thing to do is to request the [generation of your token](https://api.nasa.gov/) for access to the space + agency's API; +2. After filling in the form fields with your first name, last name, and email address, your token will be sent to the + provided email address; +3. Copy the Token, it will be used to authenticate the NASA API. -1. Request the [generation of your token](https://api.nasa.gov/) for access to the space agency's API. -2. After filling out the form fields with your name, last name, and email, your token will be sent to the provided email address. -3. Copy the Token; it will be used for NASA API authentication. > Your token is for personal use and should not be shared. # Setup & Launch -1. Clone this repository: +1. Clone this repository:
+ ```terminal git clone git@github.com:Robso-creator/discord_bot.git ``` -2. `cd` into the new repository: +2. `cd` into the new repository:
+ ```terminal cd discord_bot ``` -3. Create a new virtual environment: +3. Create a new virtual environment:
+ ```terminal python -m venv venv ``` -4. Activate the new virtual environment: +4. Activate the new virtual environment:
+ ```terminal .\venv\Scripts\Activate ``` -5. Install dependencies: +5. Install the dependencies:
+ ```terminal pip install -r requirements.txt ``` -6. Create a `.env` file in the root folder of the project: +6. Create a `.env` file in the root project folder:
+ ```terminal DISCORD_TOKEN= DISCORD_SERVER_ID= NASA_TOKEN=DEMO_KEY ``` -7. Run de .py file:
+ +7. Run the .py file:
+ ```terminal python -m main ``` diff --git a/docs/README.md b/docs/README.md index c135071..55492a9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,7 +3,9 @@ [![pytest](https://img.shields.io/badge/pytest-enabled-brightgreen?logo=pytest&logoColor=#0A9EDC)](https://docs.pytest.org/en/7.4.x/) # Bot do Discord -Don't speak portuguese? [Click here](https://github.com/Robso-creator/discord_bot/blob/main/README-en.md) to view this page in English + +Don't speak portuguese? [Click here](https://github.com/Robso-creator/discord_bot/blob/main/README-en.md) to view +this page in English Este é um projeto de bot para Discord desenvolvido em Python que oferece uma variedade de funcionalidades para @@ -16,8 +18,8 @@ Documentação dos comandos disponível [aqui](https://robso-creator.github.io/d # Sumário * [Criação de Tokens necessários](#criação-de-tokens-necessários) - * [Gerar conta de bot no discord](#gerar-conta-de-bot-no-discord) - * [Gerar token de autenticação API NASA](#gerar-token-de-autenticação-api-nasa) + * [Gerar conta de bot no discord](#gerar-conta-de-bot-no-discord) + * [Gerar token de autenticação API NASA](#gerar-token-de-autenticação-api-nasa) * [Setup & Launch](#setup-&-launch) # Criação de Tokens necessários @@ -26,58 +28,83 @@ Para que o bot funcione corretamente alguns tokens precisam ser fornecidos, a seguir poderá entender como gerá-los ## Gerar conta de bot no discord -Passo a passo de [freecodecamp](https://www.freecodecamp.org/portuguese/news/tutorial-de-criacao-de-bot-para-o-discord-em-python/) +Passo a passo +de [freecodecamp](https://www.freecodecamp.org/portuguese/news/tutorial-de-criacao-de-bot-para-o-discord-em-python/) 1. Esteja logado na [plataforma](https://discord.com/); 2. Acesse a [página de desenvolvedores](https://discord.com/developers/applications); 3. Clique no botão de "Nova Aplicação" no canto superior direito:
-![img.png](../static/new_application_img.png) -4. Vá até a aba “Bot” e clique em “Add Bot”; ->Mantenha as configurações padrão para Public Bot (marcado) e Require OAuth2 Code Grant (desmarcado). + ![img.png](../static/new_application_img.png) +4. Vá até a aba “Bot” e clique em “Add Bot”; + +> Mantenha as configurações padrão para Public Bot (marcado) e Require OAuth2 Code Grant (desmarcado). + 5. Copie o Token, ele será utilizado para a autenticação do seu bot.
+6. Aproveitando o embalo, na mesma página, clique em "OAuth2" e selecione "bot" + +> Nesse etapa vamos adicionar o bot ao seu servidor + +7. Em seguida escolha as permissões que deseja dar ao seu bot, para o padrão deste reposítório somente as permissões de + mensagem de texto bastam +8. Clique no botão 'copy' acima das permissões e cole no seu navegador, selecione o servidor que deseja adicionar o bot + e depois clique em "Authorize" ## Gerar token de autenticação API NASA Esse token não é obrigatório, para teste somente a DEMO_KEY já é suficiente. Com a autenticação, o limite de batida na API aumenta drasticamente -1. Primeira coisa a se fazer é solicitar a [geração do seu token](https://api.nasa.gov/) para acesso à API da agência espacial; -2. Após preencher os campos do formulário com seu nome, sobrenome e e-mail, seu token será encaminhado para o endereço de e-mail fornecido; +1. Primeira coisa a se fazer é solicitar a [geração do seu token](https://api.nasa.gov/) para acesso à API da agência + espacial; +2. Após preencher os campos do formulário com seu nome, sobrenome e e-mail, seu token será encaminhado para o endereço + de e-mail fornecido; 3. Copie o Token, ele será utilizado para autenticação da API da NASA + > Seu token é para uso pessoal e não deve ser compartilhado # Setup & Launch 1. Clone esse repositório:
+ ```terminal git clone git@github.com:Robso-creator/discord_bot.git ``` 2. `cd` para o novo repositório:
+ ```terminal cd discord_bot ``` 3. Crie um novo ambiente virtual:
+ ```terminal python -m venv venv ``` + 4. Ative o novo ambiente virtual:
+ ```terminal .\venv\Scripts\Activate ``` + 5. Instale as dependências:
+ ```terminal pip install -r requirements.txt ``` + 6. Crie um arquivo `.env` na sua pasta na pasta `root` do projeto:
+ ```terminal DISCORD_TOKEN= DISCORD_SERVER_ID= NASA_TOKEN=DEMO_KEY ``` + 7. Execute o arquivo .py:
+ ```terminal python -m main ```