From 5172bd91a527a10e330885a2619cdad91c3897a4 Mon Sep 17 00:00:00 2001 From: Skillz Date: Wed, 19 Apr 2023 14:21:30 -0500 Subject: [PATCH] docs: more beginner guides --- website/docs/beginner/env.md | 56 ++++++++++++++++++++++++++ website/docs/beginner/github.md | 42 +++++++++++++++++++ website/docs/beginner/inviting.md | 30 ++++++++++++++ website/docs/examples/reactionroles.md | 8 ++-- 4 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 website/docs/beginner/env.md create mode 100644 website/docs/beginner/github.md create mode 100644 website/docs/beginner/inviting.md diff --git a/website/docs/beginner/env.md b/website/docs/beginner/env.md new file mode 100644 index 000000000..63eb29d8b --- /dev/null +++ b/website/docs/beginner/env.md @@ -0,0 +1,56 @@ +--- +sidebar_position: 4 +sidebar_label: Setup .env +--- + +# How to Set Up a .env File with TypeScript in Node.js + +## Step 1: Install Required Packages + +Before you can set up a `.env` file with TypeScript in Node.js, you need to install the required packages. Run the following command in your project's directory: + +`npm install dotenv @types/dotenv --save-dev` + + +## Step 2: Create a .env File + +1. Create a new file named `.env` in the root directory of your project. +2. Add your environment variables to the file in the following format: + +VAR_NAME=value + + +For example: + +```js +DB_HOST=localhost +DB_USER=admin +DB_PASS=password123 +``` + + +## Step 3: Load Environment Variables + +1. In your TypeScript file, import the `dotenv` package: + +```ts +import dotenv from 'dotenv'; +``` + +2. Call the config method of the dotenv package to load the environment variables from the .env file: + +```ts +dotenv.config(); +``` + +## Step 4: Access Environment Variables + +You can now access your environment variables using the process.env object. For example: + +```ts +const dbHost = process.env.DB_HOST; +const dbUser = process.env.DB_USER; +const dbPass = process.env.DB_PASS; +``` + +And that's it! You have now set up a .env file with TypeScript in Node.js and can access your environment variables in your code. diff --git a/website/docs/beginner/github.md b/website/docs/beginner/github.md new file mode 100644 index 000000000..65c1d9bde --- /dev/null +++ b/website/docs/beginner/github.md @@ -0,0 +1,42 @@ +--- +sidebar_position: 3 +sidebar_label: Setup Github Repo +--- + +# How to Set Up a GitHub Repository + +In order to set up a GitHub repository, you will need to follow these steps: + +## Step 1: Create a GitHub Account + +1. Go to the [GitHub website](https://github.com/) and sign up for an account if you don't already have one. +2. Verify your email address. + +## Step 2: Create a New Repository + +1. Once you are logged in to your GitHub account, click on the "+" icon in the top right corner of the page and select "New repository". +2. Give your repository a name and a short description. +3. Choose whether you want your repository to be public or private. +4. Select "Initialize this repository with a README" if you want to create a README file for your repository. + +## Step 3: Add Files to Your Repository + +1. Once you have created your repository, you can start adding files to it. +2. Click on the "Add file" button to create a new file or upload an existing file. +3. If you are uploading an existing file, you can drag and drop the file into the "Drag files here to add them to your repository" box. + +## Step 4: Commit Changes + +1. Once you have added or edited files in your repository, you will need to commit your changes. +2. Enter a brief description of your changes in the "Commit changes" box. +3. Click the "Commit changes" button. + +## Step 5: Push Changes to GitHub + +1. Once you have committed your changes, you will need to push them to GitHub. +2. Open the command line on your computer and navigate to the directory where your repository is stored. +3. Enter the following command to push your changes to GitHub: + +`git push origin main` + +And that's it! Your GitHub repository is now set up and ready to use. You can continue to add files and make changes to your repository as needed. diff --git a/website/docs/beginner/inviting.md b/website/docs/beginner/inviting.md new file mode 100644 index 000000000..3527093b1 --- /dev/null +++ b/website/docs/beginner/inviting.md @@ -0,0 +1,30 @@ +--- +sidebar_position: 2 +sidebar_label: Invite Bot To Server +--- + +# How to Invite a Discord Bot to a Discord Server + +In order to invite a Discord bot to your Discord server, you will need to follow these steps: + +## Step 1: Get Your Bot's ID + +1. Go to the [Discord Developer Portal](https://discord.com/developers/applications) and log in to your account. +2. Click on your application and go to the "General Information" tab. +3. Copy your bot's ID. It may be called Application ID. + +## Step 2: Generate an Invite Link for Your Bot + +1. Go to the [Discord Permissions Calculator](https://discordapi.com/permissions.html). +2. Enter your bot's client ID in the "Client ID" field. +3. Select the permissions you want your bot to have on your server. +4. Click the "Generate Link" button. +5. Copy the generated link. + +## Step 3: Invite Your Bot to Your Server + +1. Open the generated invite link in your web browser. +2. Select the server you want to invite the bot to. +3. Click "Authorize" to add the bot to your server. + +And that's it! Your bot should now be in your Discord server and ready to use. If you encounter any issues, be sure to check your bot's permissions and make sure it has the necessary permissions to perform its tasks. diff --git a/website/docs/examples/reactionroles.md b/website/docs/examples/reactionroles.md index 3e9dc7979..8c9ab8dc2 100644 --- a/website/docs/examples/reactionroles.md +++ b/website/docs/examples/reactionroles.md @@ -11,11 +11,11 @@ One of the most popular bot features is reaction roles. We are going to look int Before, going forward, please make sure to have finished everything on this list. -- [ ] Create an application and get the bot token. [Create Application Guide](https://discordeno.js.org) -- [ ] Add your bot to a server you own. [Invite Bot Guide](https://discordeno.js.org) -- [ ] Create a GitHub repo for this project. [Setup Repo Guide](https://discordeno.js.org) +- [ ] Create an application and get the bot token. [Create Application Guide](https://discordeno.js.org/docs/beginner/token) +- [ ] Add your bot to a server you own. [Invite Bot Guide](https://discordeno.js.org/docs/beginner/inviting) +- [ ] Create a GitHub repo for this project. [Setup Repo Guide](https://discordeno.js.org/docs/beginner/github) - [ ] Install Discordeno. [Installation Guide](https://discordeno.js.org) -- [ ] Setup environment variables. [Environment Variables Guide](https://discordeno.js.org) +- [ ] Setup environment variables. [Environment Variables Guide](https://discordeno.js.org/docs/beginner/env) ## Creating Our Bot