Skip to content

Commit

Permalink
📝 add discordjs essentials and project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Jun 5, 2023
1 parent 5468a48 commit 4da9ec6
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"index": "",
"installation": ""
"installation": "",
"project-structure": "",
"discordjs-essentials": "Discord.js Essentials"
}
55 changes: 55 additions & 0 deletions docs/pages/discordjs-essentials.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: "discord.js Essentials"
description: "An overview of essential discord.js features for building bot"
---

import { Tab, Tabs } from "nextra-theme-docs";

# Discord.js Essentials

To build bot with dixt, it helps to be familiar with discord.js features such as client or shards. This page will give you a brief overview of these features.

If you"re new to discord.js, we also recommend reffering to the [discord.js Documentation](https://discord.js.org/#/docs/main/stable/general/welcome). Here are some great resources for learning:
- [discord.js Guide](https://discordjs.guide)
- [discord.js Rapid Tutorial](https://ravbug.com/tutorials/discordjs)
- [discord.js freeCodeCamp Tutorial](https://www.freecodecamp.org/news/create-a-discord-bot-with-javascript-nodejs)

## Client

The client is the main interface for interacting with the Discord API, and the starting point for any bot. It is the main class in discord.js.

<Tabs items={["without dixt", "with dixt"]}>
<Tab>
```js
const { Client } = require("discord.js");

const client = new Client();

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.login("your_bot_token");
```
</Tab>
<Tab>
```js
const { default: dixt } = require("dixt");

const instance = new dixt({
application: {
id: "your_application_id",
bot: {
token: "your_bot_token",
}
}
});

instance.client.on("ready", () => {
console.log(`Logged in as ${instance.client.user.tag}!`);
});

instance.start();
```
</Tab>
</Tabs>
29 changes: 29 additions & 0 deletions docs/pages/project-structure.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Project Structure"
description: "A list of folders and files conventions in a dixt project"
---

# Project Structure

This page provides an overview of the file and folder structure of a dixt project.

## Top-level files

| | |
|-|-|
| **dixt** | |
| [`.env`](/installation#environment-variables) | Environment variables |
| [`.env.local`](/installation#environment-variables) | Local environment variables |
| [`.env.production`](/installation#environment-variables) | Production environment variables |
| [`.env.development`](/installation#environment-variables) | Development environment variables |
| **Ecosystem** | |
| [`package.json`](/installation#manual-installation) | Project dependencies and scripts |
| `.gitignore` | Git files and folders to ignore |
| `tsconfig.json` | Configuration file for TypeScript |
| `.eslintrc.json` | Configuration file for ESLint |

## Top-level folders

| | |
|-|-|
| `src` | Optional application source folder |

0 comments on commit 4da9ec6

Please sign in to comment.