@fjrodafo/discord-app 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +274 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# DiscordAPP
|
|
2
|
+
|
|
3
|
+
[](https://fjrodafo.github.io/DiscordAPP/)
|
|
4
|
+
[](https://github.com/FJrodafo/DiscordAPP/stargazers)
|
|
5
|
+
|
|
6
|
+
[](https://github.com/FJrodafo/DiscordAPP/pkgs/container/discord-app)
|
|
7
|
+
[](https://hub.docker.com/r/fjrodafo/discord-app)
|
|
8
|
+
[](https://hub.docker.com/r/fjrodafo/discord-app)
|
|
9
|
+
|
|
10
|
+
[](https://discord.com/oauth2/authorize?client_id=1260588948544290927)
|
|
11
|
+
|
|
12
|
+
## Index
|
|
13
|
+
|
|
14
|
+
1. [Introduction](#introduction)
|
|
15
|
+
2. [Project structure](#project-structure)
|
|
16
|
+
3. [Clone the repository](#clone-the-repository)
|
|
17
|
+
4. [Set up the project](#set-up-the-project)
|
|
18
|
+
5. [Install dependencies](#install-dependencies)
|
|
19
|
+
6. [Final steps](#final-steps)
|
|
20
|
+
7. [Using Docker](#using-docker)
|
|
21
|
+
8. [Available Scripts](#available-scripts)
|
|
22
|
+
9. [Additional information](#additional-information)
|
|
23
|
+
10. [Credits](#credits)
|
|
24
|
+
|
|
25
|
+
## Introduction
|
|
26
|
+
|
|
27
|
+
A simple Discord Application made in JavaScript!
|
|
28
|
+
|
|
29
|
+
This project has been developed on a [Linux](https://github.com/torvalds/linux) system. To learn more about the system, visit the [Dotfiles](https://github.com/FJrodafo/Dotfiles) repository.
|
|
30
|
+
|
|
31
|
+
This project was built by following the [Discordjs guide](https://discordjs.guide/). I have modified small details of the code. This is just an example of what the final project would look like.
|
|
32
|
+
|
|
33
|
+
## Project structure
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
/
|
|
37
|
+
├── dashboard/
|
|
38
|
+
│ ├── public/
|
|
39
|
+
│ │ ├── index.html
|
|
40
|
+
│ │ ├── script.js
|
|
41
|
+
│ │ └── style.css
|
|
42
|
+
│ ├── routes/
|
|
43
|
+
│ │ ├── api.js
|
|
44
|
+
│ │ ├── logs.js
|
|
45
|
+
│ │ └── metrics.js
|
|
46
|
+
│ ├── utils/
|
|
47
|
+
│ │ ├── format.js
|
|
48
|
+
│ │ └── logs.js
|
|
49
|
+
│ └── index.js
|
|
50
|
+
├── docs/
|
|
51
|
+
| └── *.md
|
|
52
|
+
├── src/
|
|
53
|
+
│ ├── commands/
|
|
54
|
+
│ │ ├── admin/
|
|
55
|
+
│ │ │ ├── ping.js
|
|
56
|
+
│ │ │ ├── prune.js
|
|
57
|
+
│ │ │ └── reload.js
|
|
58
|
+
│ │ ├── context-menu/
|
|
59
|
+
│ │ │ ├── avatar.js
|
|
60
|
+
│ │ │ └── user.js
|
|
61
|
+
│ │ ├── help/
|
|
62
|
+
│ │ │ └── help.js
|
|
63
|
+
│ │ ├── moderation/
|
|
64
|
+
│ │ │ └── kick.js
|
|
65
|
+
│ │ └── utility/
|
|
66
|
+
│ │ └── *.js
|
|
67
|
+
│ ├── events/
|
|
68
|
+
│ │ ├── interactionCreate.js
|
|
69
|
+
│ │ ├── messageCreate.js
|
|
70
|
+
│ │ └── ready.js
|
|
71
|
+
│ ├── utils/
|
|
72
|
+
│ │ └── emoji.js
|
|
73
|
+
│ ├── config.json
|
|
74
|
+
│ ├── deploy-commands.js
|
|
75
|
+
│ └── index.js
|
|
76
|
+
├── CONTRIBUTING
|
|
77
|
+
├── LICENSE
|
|
78
|
+
├── .dockerignore
|
|
79
|
+
├── .npmignore
|
|
80
|
+
├── docker-compose.yaml
|
|
81
|
+
├── Dockerfile
|
|
82
|
+
├── eslint.config.js
|
|
83
|
+
├── package-lock.json
|
|
84
|
+
└── package.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Clone the repository
|
|
88
|
+
|
|
89
|
+
Open a terminal in the directory where you store your repositories and clone it with the following command:
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
# HTTPS
|
|
93
|
+
git clone https://github.com/FJrodafo/DiscordAPP.git
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
# SSH
|
|
98
|
+
git clone git@github.com:FJrodafo/DiscordAPP.git
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Set up the project
|
|
102
|
+
|
|
103
|
+
This project needs a `config.json` into the `src/` directory with some data related to your Discord server and your APP token (Make sure you have an APP created in the [Discord Developer Portal](https://discord.com/developers/applications)):
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
cp src/config.example.json src/config.json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Install dependencies
|
|
110
|
+
|
|
111
|
+
This project must be initialized and the necessary dependencies installed with the following command:
|
|
112
|
+
|
|
113
|
+
```shell
|
|
114
|
+
npm i
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Final steps
|
|
118
|
+
|
|
119
|
+
If you have the `config.json` file into the `src/` directory correctly configured and Node v24.x installed on your machine, then you are good to go!
|
|
120
|
+
|
|
121
|
+
To check if you already have Node installed on your machine, run `node -v` in your terminal. Otherwise, you will need to install Node v24.x or higher or, as a last option, check out the [Docker](#using-docker) alternative.
|
|
122
|
+
|
|
123
|
+
Finally, if you have Node installed, run the following command to activate your Discord APP:
|
|
124
|
+
|
|
125
|
+
```shell
|
|
126
|
+
npm start
|
|
127
|
+
# Press 'Ctrl + C' to exit
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Open Discord and access the server where your Discord APP is located to see the result.
|
|
131
|
+
|
|
132
|
+
## Using Docker
|
|
133
|
+
|
|
134
|
+
You can find a Docker image of this project ready to be pulled on [GitHub Packages](https://github.com/FJrodafo/DiscordAPP/pkgs/container/discord-app) or [Docker Hub](https://hub.docker.com/r/fjrodafo/discord-app) official website!
|
|
135
|
+
|
|
136
|
+
Pull the latest image with the following commands:
|
|
137
|
+
|
|
138
|
+
```shell
|
|
139
|
+
# GitHub Packages
|
|
140
|
+
docker pull ghcr.io/fjrodafo/discord-app:latest
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```shell
|
|
144
|
+
# Docker Hub
|
|
145
|
+
docker pull fjrodafo/discord-app:latest
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> [!IMPORTANT]
|
|
149
|
+
>
|
|
150
|
+
> Please note that when using Docker, port 3000 on localhost will be occupied by the Discord application for its proper functioning.
|
|
151
|
+
>
|
|
152
|
+
> If you already have applications that use port 3000, don't worry, the dashboard uses the [@fjrodafo/port-finder](https://github.com/FJrodafo/PortFinder) library, which will always search for a free port to run the application without any problems.
|
|
153
|
+
|
|
154
|
+
### Run with Docker Compose (Recommended)
|
|
155
|
+
|
|
156
|
+
Make sure to create the `config.json` file into the `src/` directory before continuing (This file is used only at runtime, is ignored by Git and Docker, and is not included in the image).
|
|
157
|
+
|
|
158
|
+
Build the container:
|
|
159
|
+
|
|
160
|
+
```shell
|
|
161
|
+
docker compose build
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
> [!NOTE]
|
|
165
|
+
>
|
|
166
|
+
> If you want to build the image locally, uncomment the `build` section in `docker-compose.yaml` and run `docker compose build`. Otherwise, skip directly to the next step.
|
|
167
|
+
|
|
168
|
+
Run the container:
|
|
169
|
+
|
|
170
|
+
```shell
|
|
171
|
+
docker compose up -d
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Check the container logs:
|
|
175
|
+
|
|
176
|
+
```shell
|
|
177
|
+
docker logs -f discord-app
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Stop the Container:
|
|
181
|
+
|
|
182
|
+
```shell
|
|
183
|
+
docker compose down
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Build Docker image manually
|
|
187
|
+
|
|
188
|
+
If you prefer not to use Docker Compose, you can build and run the image manually.
|
|
189
|
+
|
|
190
|
+
If you don't have Node v24.x or higher installed on your machine, you can build a Docker image by running the [Dockerfile](https://github.com/FJrodafo/DiscordAPP/blob/main/Dockerfile) (Make sure to create and configure the `config.json` file correctly into the `src/` directory before building the docker image).
|
|
191
|
+
|
|
192
|
+
Open a terminal and run the following command:
|
|
193
|
+
|
|
194
|
+
```shell
|
|
195
|
+
docker build -t discord-app:latest .
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
After the build completes, run the image inside a container with the following command:
|
|
199
|
+
|
|
200
|
+
```shell
|
|
201
|
+
docker run -dp 127.0.0.1:3000:3000 \
|
|
202
|
+
-v $(pwd)/src/config.json:/app/src/config.json:ro \
|
|
203
|
+
discord-app:latest
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Check the container logs:
|
|
207
|
+
|
|
208
|
+
```shell
|
|
209
|
+
docker ps -a
|
|
210
|
+
docker logs -f <container_id>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Stop and remove the Container:
|
|
214
|
+
|
|
215
|
+
```shell
|
|
216
|
+
docker stop <container_id>
|
|
217
|
+
docker rm <container_id>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Build & Push (Ignore this subsection)
|
|
221
|
+
|
|
222
|
+
```shell
|
|
223
|
+
docker build \
|
|
224
|
+
-t ghcr.io/fjrodafo/discord-app:1 \
|
|
225
|
+
-t ghcr.io/fjrodafo/discord-app:1.0 \
|
|
226
|
+
-t ghcr.io/fjrodafo/discord-app:1.0.1 \
|
|
227
|
+
-t ghcr.io/fjrodafo/discord-app:latest \
|
|
228
|
+
-t fjrodafo/discord-app:1.0.1 \
|
|
229
|
+
-t fjrodafo/discord-app:latest \
|
|
230
|
+
.
|
|
231
|
+
|
|
232
|
+
docker push ghcr.io/fjrodafo/discord-app:1
|
|
233
|
+
docker push ghcr.io/fjrodafo/discord-app:1.0
|
|
234
|
+
docker push ghcr.io/fjrodafo/discord-app:1.0.1
|
|
235
|
+
docker push ghcr.io/fjrodafo/discord-app:latest
|
|
236
|
+
docker push fjrodafo/discord-app:1.0.1
|
|
237
|
+
docker push fjrodafo/discord-app:latest
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Available Scripts
|
|
241
|
+
|
|
242
|
+
In the project directory, you can run:
|
|
243
|
+
|
|
244
|
+
### `npm start`
|
|
245
|
+
|
|
246
|
+
Once configured, run the APP. It first deploy the commands, updating both on the guild server and globally (You can edit the commented lines of code in the [deploy-commands.js](./src/deploy-commands.js) file to customize the deploy of the APP commands).
|
|
247
|
+
|
|
248
|
+
### `npm run canary`
|
|
249
|
+
|
|
250
|
+
Once configured, run a Canary version of the APP. It works exactly the same as the main APP. This version is intended to test new commands and experimental implementations to ensure they work before publishing changes, preventing any bugs that may cause malfunctions.
|
|
251
|
+
|
|
252
|
+
### `npm run eslint`
|
|
253
|
+
|
|
254
|
+
Runs the eslint to find possible formatting errors in the code.
|
|
255
|
+
|
|
256
|
+
### `npm run eslintfix`
|
|
257
|
+
|
|
258
|
+
Automatically fixes all errors caught by eslint.
|
|
259
|
+
|
|
260
|
+
### `npm test`
|
|
261
|
+
|
|
262
|
+
There are currently no tests configured.
|
|
263
|
+
|
|
264
|
+
### `npm run tarball`
|
|
265
|
+
|
|
266
|
+
Simulates packaging a project into a `.tgz` archive (as if preparing it for distribution) without actually generating the file.
|
|
267
|
+
|
|
268
|
+
## Additional information
|
|
269
|
+
|
|
270
|
+
Do you want to try a sample of the APP yourself? Add it to any server! [[link](https://discord.com/oauth2/authorize?client_id=1260588948544290927)]
|
|
271
|
+
|
|
272
|
+
## Credits
|
|
273
|
+
|
|
274
|
+
Thanks to the [Discordjs](https://discord.js.org/) team for creating an amazing library and making Discord APP development easier!
|