You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use the ModuleLoader, your bot has to use the following file structure:
50
54
51
55
```
@@ -58,49 +62,57 @@ To use the ModuleLoader, your bot has to use the following file structure:
58
62
```
59
63
60
64
#### `commands` folder
65
+
61
66
Inside of the `commands` folder you can put as many command files as you want!
62
67
We suggest you put the command name as the file name, but it is not required.
68
+
The commands folder also accepts sub-directories, meaning that in the commands folder you could put a folder named anything, and put commands inside of there.
In the `DiscordCommand` class you have to pass an object with the following arguments:
76
84
77
-
| Argument | Description | Required | Type |
78
-
|---|---|---|---|
79
-
|`name`| Name of the command | Yes |`string`|
80
-
|`description`| Description of the command | Yes |`string`|
81
-
|`defaultPermission`| Whether the command is enabled by default when the app is added to a guild | No |`boolean`|
82
-
|`options`| The options of the command | No |[`ApplicationCommandOptionData`](https://discord.js.org/#/docs/discord.js/stable/typedef/ApplicationCommandOptionData)`[]`|
83
-
|`cooldown`| The amount of time in seconds a user has to wait between command executions | No |`number`|
84
-
|`channelAllowlist`| Array of Discord channel ids where the command is allowed to be executed in | No |`string[]`|
85
-
|`channelDenylist`| Array of Discord channel ids where the command is not allowed to be executed in | No |`string[]`|
86
-
|`permissions`| Permission data of the command | No |[`ApplicationCommandPermissionData`](https://discord.js.org/#/docs/discord.js/stable/typedef/ApplicationCommandPermissionData)`[]`|
87
-
|`hasUserCommand`| Whether the command has a user context menu | No |`boolean`|
88
-
|`execute`| The function which will be run when the command is executed | Yes |`Function (interaction:`[`CommandInteraction`](https://discord.js.org/#/docs/discord.js/stable/class/CommandInteraction)`)`|
|`description`| Description of the command | Yes |`string`|
89
+
|`defaultPermission`| Whether the command is enabled by default when the app is added to a guild | No |`boolean`|
90
+
|`options`| The options of the command | No |[`ApplicationCommandOptionData`](https://discord.js.org/#/docs/discord.js/stable/typedef/ApplicationCommandOptionData)`[]`|
91
+
|`cooldown`| The amount of time in seconds a user has to wait between command executions | No |`number`|
92
+
|`channelAllowlist`| Array of Discord channel ids where the command is allowed to be executed in | No |`string[]`|
93
+
|`channelDenylist`| Array of Discord channel ids where the command is not allowed to be executed in | No |`string[]`|
94
+
|`permissions`| Permission data of the command | No|[`ApplicationCommandPermissionData`](https://discord.js.org/#/docs/discord.js/stable/typedef/ApplicationCommandPermissionData)`[]`|
95
+
|`hasUserCommand`| Whether the command has a user context menu | No |`boolean`|
96
+
|`execute`| The function which will be run when the command is executed | Yes |`Function (interaction:`[`CommandInteraction`](https://discord.js.org/#/docs/discord.js/stable/class/CommandInteraction)`)`|
89
97
90
98
#### `events` folder
99
+
91
100
Inside of the `events` folder you can put as many event files as you want!
92
101
We suggest you put the event name as the file name, but it is not required.
In the `ModuleLoader` class you can pass an object with the following arguments:
166
185
(All arguments are optional)
167
186
168
-
| Argument | Description | Type | Default Value |
169
-
|---|---|---|---|
170
-
|`unknownCommandMessage`| The message shown when a user executes an unknown command |`string`| Couldn't find executed command. Please try again later, or report the issue. |
171
-
|`disabledCommandMessage`| The message shown when a user executes a disabled command |`string`| This command is currently disabled. Please try again later. |
172
-
|`disallowedChannelMessage`| The message shown when a user executes a command in a disallowed channel |`string`| You're not allowed to execute this command in this channel! |
173
-
|`commandCooldownMessage`| The message shown when a user executes a command while on cooldown |`string`| Please wait % seconds before using this command again. |
|`unknownCommandMessage`| The message shown when a user executes an unknown command|`string`| Couldn't find executed command. Please try again later, or report the issue. |
190
+
|`disabledCommandMessage`| The message shown when a user executes a disabled command |`string`| This command is currently disabled. Please try again later.|
191
+
|`disallowedChannelMessage`| The message shown when a user executes a command in a disallowed channel |`string`| You're not allowed to execute this command in this channel! |
192
+
|`commandCooldownMessage`| The message shown when a user executes a command while on cooldown |`string`| Please wait % seconds before using this command again.|
174
193
175
194
## Contributing
176
195
177
196
Due to Discord and Discord.js always updating, it is possible some things might break. If you believe you have found and issue, feel free to [open a pull request](https://github.com/Recodive/Discord-Module-Loader/compare).
178
197
179
198
## Inspiration
180
199
181
-
Due to the amount of Discord bots our team makes it was always annoying to copy over our module loader and getting it working for that project, hence why we decided to just make one module loader which we can import into all of our Discord Bot projcets. We hope to keep this module updated and working whenever new features are added to Discord/Discord.js, but we may also add custom things to our likings. This package was created by [Bas950](https://github.com/Bas950) and [Timeraa](https://github.com/Timeraa) and is not officially endorsed by Discord nor affiliated with the company in any way.
200
+
Due to the amount of Discord bots our team makes it was always annoying to copy over our module loader and getting it working for that project, hence why we decided to just make one module loader which we can import into all of our Discord Bot projcets. We hope to keep this module updated and working whenever new features are added to Discord/Discord.js, but we may also add custom things to our likings. This package was created by [Bas950](https://github.com/Bas950) and [Timeraa](https://github.com/Timeraa) and is not officially endorsed by Discord nor affiliated with the company in any way.
0 commit comments