xernerx 2.7.0 → 2.7.2

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.
@@ -49,7 +49,7 @@ class InteractionCommand {
49
49
  }
50
50
 
51
51
  else if (options?.groups?.length > 0) {
52
- this.addSubcommandGroups(options.groups)
52
+ this.addSubcommandGroups(options.groups);
53
53
  }
54
54
 
55
55
  this.id = id;
@@ -116,9 +116,9 @@ module.exports = new class Functions {
116
116
  for (const commands of Object.values(interaction.client.commands)) {
117
117
  let commandInfo = {};
118
118
 
119
- if (commands.has(cmd)) {
120
- const command = commands.get(cmd);
119
+ const command = commands.find(command => command?.data?.name === cmd.toLowerCase() || command?.name === cmd.toLowerCase() || command?.id == cmd.toLowerCase());
121
120
 
121
+ if (command) {
122
122
  if (command?.data?.options?.length > 0) {
123
123
  command?.data?.options?.map(option => {
124
124
  if (!option?.type) {
@@ -130,6 +130,8 @@ module.exports = new class Functions {
130
130
  description: opt.description,
131
131
  category: command.category
132
132
  }
133
+
134
+ if (!cmds.find(c => c.name === commandInfo.name)) cmds.push(commandInfo);
133
135
  }
134
136
 
135
137
  else {
@@ -138,6 +140,8 @@ module.exports = new class Functions {
138
140
  description: option?.description,
139
141
  category: command.category
140
142
  }
143
+
144
+ if (!cmds.find(c => c.name === commandInfo.name)) cmds.push(commandInfo);
141
145
  }
142
146
  })
143
147
  }
@@ -148,6 +152,8 @@ module.exports = new class Functions {
148
152
  description: option?.description,
149
153
  category: command.category
150
154
  }
155
+
156
+ if (!cmds.find(c => c.name === commandInfo.name)) cmds.push(commandInfo);
151
157
  }
152
158
  }
153
159
 
@@ -157,6 +163,8 @@ module.exports = new class Functions {
157
163
  description: command?.data?.description || command?.description,
158
164
  category: command.category
159
165
  }
166
+
167
+ if (!cmds.find(c => c.name === commandInfo.name)) cmds.push(commandInfo);
160
168
  }
161
169
  })
162
170
  }
@@ -167,11 +175,10 @@ module.exports = new class Functions {
167
175
  description: command?.data?.description || command?.description,
168
176
  category: command.category
169
177
  }
170
- }
171
178
 
172
- cmds.push(commandInfo);
179
+ if (!cmds.find(c => c.name === commandInfo.name)) cmds.push(commandInfo);
180
+ }
173
181
  }
174
-
175
182
  }
176
183
  return cmds;
177
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "A bot framework for discord.js. [BETA]",
5
5
  "main": "main.js",
6
6
  "scripts": {
package/docs/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-dinky
package/docs/docs.md DELETED
@@ -1,108 +0,0 @@
1
- ![Xernerx](./styles/banner.png)
2
-
3
- # A lightweight class based Discord.js framework.
4
-
5
- > - [Client](#Client)
6
- > - [Handlers](#Handlers)
7
- > > - [Commands](#Commands)
8
- > > - [Events](#Events)
9
- > - [Arguments](#Arguments)
10
- > > - [Types](#Argument#Types)
11
-
12
- ## Client
13
-
14
- > An extended discord.js client.
15
- >
16
- > ```js
17
- > const { Client } require('xernerx');
18
- >
19
- > const client = new Client({intents:[0]});
20
- > ```
21
- >
22
- > | parameter | type | default | required | description |
23
- > | --------------- | -------- | ------- | -------- | --------------------------------------------------------------- |
24
- > | intents | Number[] | none | true | Discord#Intents |
25
- > | partials | [] | none | false | Discord#Partials |
26
- > | prefix | String[] | none | false | Prefix for message commands |
27
- > | ownerId | String[] | none | false | Id(s) of the bot developer(s) |
28
- > | guildId | String | none | true | local guild Id |
29
- > | global | Boolean | false | true | Whether the interaction commands are local or global |
30
- > | ignoreOwner | Boolean | false | false | Whether the bot should ignore execute validation or not |
31
- > | defaultCooldown | Number | 0 | false | The cooldown a user gets before executing another command |
32
- > | color | Object | FLAGS | false | This appends colors to the bot |
33
- > | config | Object | {} | false | Here you can save any info to the bot |
34
- > | logging | Boolean | false | false | Whether the bot should log any events on ready |
35
- > | cacheTime | Number | 300000 | false | The amount of time before a message gets deleted from the cache |
36
- > | messages | Object | {} | false | The location where commands get linked with their executions |
37
-
38
- ## Handlers
39
-
40
- > Below you can see all the different types of handlers. Each command handler needs it's own folder.
41
- >
42
- > ### Commands
43
- >
44
- > > ```js
45
- > > const { Client, CommandHandler } = require("xernerx");
46
- > >
47
- > > const client = new Client({ intents: [0] });
48
- > >
49
- > > const commandHandler = new CommandHandler({ client: client });
50
- > > ```
51
- > >
52
- > > methods
53
- > >
54
- > > - [.loadMessageCommands()](<#.loadMessageCommands()>)
55
- > > - [.loadInteractionCommands()](<#.loadInteractionCommands()>)
56
- > > - [.loadContextMenuCommands()](<#.loadContextMenuCommands()>)
57
- > >
58
- > > #### .loadMessageCommands()
59
- > >
60
- > > The message command handler.
61
- > >
62
- > > | parameter | type | default | required | description |
63
- > > | --------- | ------- | ------- | -------- | ---------------------------------------- |
64
- > > | path | String | none | true | The path of your message command folder. |
65
- > > | logging | Boolean | false | false | Whether the bot logs commands on start. |
66
- > >
67
- > > #### .loadInteractionCommands()
68
- > >
69
- > > The interaction command handler.
70
- > >
71
- > > | parameter | type | default | required | description |
72
- > > | --------- | ------- | ------- | -------- | -------------------------------------------- |
73
- > > | path | String | none | true | The path of your interaction command folder. |
74
- > > | logging | Boolean | false | false | Whether the bot logs commands on start. |
75
- > >
76
- > > #### .loadContextMenuCommands()
77
- > >
78
- > > The context menu command handler.
79
- > >
80
- > > | parameter | type | default | required | description |
81
- > > | --------- | ------- | ------- | -------- | --------------------------------------------- |
82
- > > | path | String | none | true | The path of your context menu command folder. |
83
- > > | logging | Boolean | false | false | Whether the bot logs commands on start. |
84
- >
85
- > ### Events
86
- >
87
- > > The event handler is much simpler than the command handler.
88
- > >
89
- > > ```js
90
- > > const { Client, EventHandler } = require("xernerx");
91
- > >
92
- > > const client = new Client({ intents: [0] });
93
- > >
94
- > > const eventHandler = new EventHandler({ client: client });
95
- > > ```
96
- > >
97
- > > methods
98
- > >
99
- > > - [.loadEvents()](<#.loadEvents()>)
100
- > >
101
- > > #### .loadEvents()
102
- > >
103
- > > The context menu command handler.
104
- > >
105
- > > | parameter | type | default | required | description |
106
- > > | --------- | ------- | ------- | -------- | ------------------------------------- |
107
- > > | path | String | none | true | The path of your events folder. |
108
- > > | logging | Boolean | false | false | Whether the bot logs events on start. |
@@ -1,243 +0,0 @@
1
- <html lang="en">
2
- <head>
3
- <meta charset="UTF-8" />
4
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Xernerx - Docs</title>
7
- <link rel="icon" type="image/x-icon" href="styles/icon.png" />
8
- <link rel="stylesheet" href="styles/styles.css" />
9
- <script src="scripts/script.js" defer></script>
10
- </head>
11
- <body>
12
- <div class="top-bar">
13
- <div class="dropdown" data-dropdown>
14
- <button class="link" data-dropdown-menu>Home</button>
15
- <div class="dropdown-menu">
16
- <div class="dropdown-links">
17
- <a href="home.html" class="link">Home</a>
18
- <a href="documentation.html" class="link">Documentation</a>
19
- <a href="#" class="link">Guide</a>
20
- <a href="#" class="link">Argument Types</a>
21
- </div>
22
- </div>
23
- </div>
24
- <a href="documentation.html" class="link">Documentation</a>
25
- <a href="#" class="link">Guide</a>
26
- <a href="https://github.com/TheDummi/xernerx" class="link">Github</a>
27
- <a href="https://github.com/TheDummi/xernerx/pulls" class="link"
28
- >Contribute</a
29
- >
30
- <a href="https://github.com/TheDummi/xernerx/issues" class="link"
31
- >Report a bug</a
32
- >
33
- <a href="#" class="link">Support</a>
34
- </div>
35
- <div class="side-bar">
36
- <div>
37
- <select name="versions" class="select">
38
- <option value="Stable">Stable</option>
39
- </select>
40
- </div>
41
-
42
- <div class="index">
43
- <h1>
44
- <li><a href="#client" class="link">Client</a></li>
45
- </h1>
46
- <li><a href="#client#intents" class="link">Intents</a></li>
47
- <li><a href="#client#global" class="link">Global</a></li>
48
- <li><a href="#client#guildId" class="link">guildId</a></li>
49
- <li><a href="#client#prefix" class="link">Prefix</a></li>
50
- <li><a href="#client#ownerId" class="link">OwnerId</a></li>
51
- <li><a href="#client#ignoreOwner" class="link">IgnoreOwner</a></li>
52
- <li>
53
- <a href="#client#defaultCooldown" class="link">DefaultCooldown</a>
54
- </li>
55
- <li><a href="#client#logging" class="link">Logging</a></li>
56
- <li><a href="#client#cacheTime" class="link">CacheTime</a></li>
57
- <li><a href="#client#messages" class="link">Messages</a></li>
58
- <li><a href="#client#color" class="link">Color</a></li>
59
- <li><a href="#client#config" class="link">Config</a></li>
60
- </div>
61
- <div class="index">
62
- <h1><a href="#handlers" class="link">Handlers</a></h1>
63
- <h2><a href="#handlers#commands" class="link">Commands</a></h2>
64
- <li><a href="#handlers#commands#client" class="link">Client</a></li>
65
- <h3>Message</h3>
66
- <li><a href="#handlers#commands#message#path" class="link">Path</a></li>
67
- <li>
68
- <a href="#handlers#commands#message#logging" class="link">Logging</a>
69
- </li>
70
- <h3>Interaction</h3>
71
- <li>
72
- <a href="#handlers#commands#interaction#path" class="link">Path</a>
73
- </li>
74
- <li>
75
- <a href="#handlers#commands#interaction#logging" class="link"
76
- >Logging</a
77
- >
78
- </li>
79
- <h3>Context Menu</h3>
80
- <li>
81
- <a href="#handlers#commands#contextMenu#path" class="link">Path</a>
82
- </li>
83
- <li>
84
- <a href="#handlers#commands#contextMenu#logging" class="link"
85
- >Logging</a
86
- >
87
- </li>
88
- <h2>Events</h2>
89
- <li><a href="#handlers#events#path" class="link">Path</a></li>
90
- <li><a href="#handlers#events#logging" class="link">Logging</a></li>
91
- <h2>i18next</h2>
92
- <li><a href="#handlers#i18next#client" class="link">Client</a></li>
93
- <li><a href="#handlers#i18next#lang" class="link">Lang</a></li>
94
- <li>
95
- <a href="#handlers#i18next#fallBackLang" class="link">FallBackLang</a>
96
- </li>
97
- <li><a href="#handlers#i18next#ns" class="link">NS</a></li>
98
- <h3>Language</h3>
99
- <li>
100
- <a href="#handlers#i18next#languages#path" class="link">Path</a>
101
- </li>
102
- <li>
103
- <a href="#handlers#i18next#languages#resources" class="link"
104
- >Resources</a
105
- >
106
- </li>
107
- <li>
108
- <a href="#handlers#i18next#languages#deep" class="link">Deep</a>
109
- </li>
110
- <li>
111
- <a href="#handlers#commands#languages#logging" class="link"
112
- >Logging</a
113
- >
114
- </li>
115
- </div>
116
- </div>
117
- <div class="page" id="page">
118
- <div id="client" class="component">
119
- <h1>Client</h1>
120
- <p>Client is an extension of the Discord Client.</p>
121
- <table class="table">
122
- <tr id="table-header">
123
- <td>Parameter</td>
124
- <td>Type</td>
125
- <td>Default</td>
126
- <td>Required</td>
127
- <td>Description</td>
128
- </tr>
129
- <tr>
130
- <td id="client#intents">Intents</td>
131
- <td>Number[]</td>
132
- <td>None</td>
133
- <td>true</td>
134
- <td>Array of an intent number or Discord FLAGS.</td>
135
- </tr>
136
- <tr>
137
- <td id="client#guildId">GuildId</td>
138
- <td>String</td>
139
- <td>None</td>
140
- <td>true</td>
141
- <td>
142
- Whether the bot should deploy it's Interaction commands globally
143
- or locally.
144
- </td>
145
- </tr>
146
- <tr>
147
- <td id="client#global">Global</td>
148
- <td>Boolean</td>
149
- <td>None</td>
150
- <td>false</td>
151
- <td>
152
- Whether the bot should deploy it's Interaction commands globally
153
- or locally.
154
- </td>
155
- </tr>
156
- <tr>
157
- <td id="client#prefix">Prefix</td>
158
- <td>String[]</td>
159
- <td>None</td>
160
- <td>false</td>
161
- <td>An array of prefixes that the bot should listen to.</td>
162
- </tr>
163
- <tr>
164
- <td id="client#ownerId">OwnerId</td>
165
- <td>String[]</td>
166
- <td>None</td>
167
- <td>false</td>
168
- <td>Array Owner Id's.</td>
169
- </tr>
170
- <tr>
171
- <td id="client#ignoreOwner">IgnoreOwner</td>
172
- <td>Boolean</td>
173
- <td>false</td>
174
- <td>false</td>
175
- <td>Whether the bot should ignore all preconditions on owners.</td>
176
- </tr>
177
- <tr>
178
- <td id="client#defaultCooldown">DefaultCooldown</td>
179
- <td>Number</td>
180
- <td>0</td>
181
- <td>false</td>
182
- <td>
183
- How long it takes before a user can run the command again. (in ms)
184
- </td>
185
- </tr>
186
- <tr>
187
- <td id="client#logging">Logging</td>
188
- <td>Boolean</td>
189
- <td>false</td>
190
- <td>false</td>
191
- <td>
192
- Whether the bot should log loading of items (enables globally)
193
- </td>
194
- </tr>
195
- <tr>
196
- <td id="client#cacheTime">CacheTime</td>
197
- <td>Number</td>
198
- <td>300000</td>
199
- <td>false</td>
200
- <td>
201
- How long it takes before messages become invalid to edit. (in ms)
202
- </td>
203
- </tr>
204
- <tr>
205
- <td id="client#messages">Messages</td>
206
- <td>Object</td>
207
- <td>Object</td>
208
- <td>false</td>
209
- <td>
210
- An array of cache messages and their command message ID (cannot be
211
- set)
212
- </td>
213
- </tr>
214
- <tr>
215
- <td id="client#color">Color</td>
216
- <td>Object</td>
217
- <td>FLAGS</td>
218
- <td>false</td>
219
- <td>Object of colors you want to use in your bot.</td>
220
- </tr>
221
- <tr>
222
- <td id="client#config">Config</td>
223
- <td>Config</td>
224
- <td>Object</td>
225
- <td>false</td>
226
- <td>Any additional info you want to save to the bot.</td>
227
- </tr>
228
- </table>
229
- </div>
230
- <div id="handlers" class="component">
231
- <h1>Handlers</h1>
232
- <p>Handlers execute files you specify</p>
233
- <div id="handlers#commands">
234
- <h2>Commands</h2>
235
- <div id="handlers#commands#message">
236
- <h3>Message</h3>
237
- <p>message handler</p>
238
- </div>
239
- </div>
240
- </div>
241
- </div>
242
- </body>
243
- </html>
package/docs/home.html DELETED
@@ -1,62 +0,0 @@
1
- <html lang="en">
2
- <head>
3
- <meta charset="UTF-8" />
4
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Xernerx - Home</title>
7
- <link rel="icon" type="image/x-icon" href="styles/icon.png" />
8
- <link rel="stylesheet" href="styles/styles.css" />
9
- <script src="scripts/script.js" defer></script>
10
- </head>
11
- <body>
12
- <div class="top-bar">
13
- <div class="dropdown" data-dropdown>
14
- <button class="link" data-dropdown-menu>Home</button>
15
- <div class="dropdown-menu">
16
- <div class="dropdown-links">
17
- <a href="home.html" class="link">Home</a>
18
- <a href="documentation.html" class="link">Documentation</a>
19
- <a href="#" class="link">Guide</a>
20
- <a href="#" class="link">Argument Types</a>
21
- </div>
22
- </div>
23
- </div>
24
- <a href="documentation.html" class="link">Documentation</a>
25
- <a href="#" class="link">Guide</a>
26
- <a href="https://github.com/TheDummi/xernerx" class="link">Github</a>
27
- <a href="https://github.com/TheDummi/xernerx/pulls" class="link">Contribute</a>
28
- <a href="https://github.com/TheDummi/xernerx/issues" class="link">Report a bug</a>
29
- <a href="#" class="link">Support</a>
30
- </div>
31
- <div class="page">
32
- <div class="component">
33
- <center>
34
- </br>
35
- <img
36
- alt="Xernerx Framework"
37
- width="900"
38
- height="350"
39
- src="styles/banner.png"
40
- />
41
-
42
- <h1>A lightweight class based Discord.js framework. [BETA]</h1>
43
- </center>
44
- </div>
45
-
46
- <div class="component">
47
- <h2>Support</h2>
48
- <p>
49
- <li>Slash command handler</li>
50
- <li>Message command handler</li>
51
- <li>Context menu command handler</li>
52
- <li>Event handler (with error, process, etc...)</li>
53
- <li>i18next language handler</li>
54
- </p>
55
- </div>
56
-
57
- <div class="component">
58
- <button class="button" href="#"> <a href="#" class="link">Get Started</a></button>
59
- </div>
60
- </div>
61
- </body>
62
- </html>
@@ -1,16 +0,0 @@
1
- document.addEventListener('click', e => {
2
- const isDropDown = e.target.matches("[data-dropdown-menu]")
3
- if (!isDropDown && e.target.closest("[data-dropdown]") != null) return;
4
-
5
- let curDropDown;
6
-
7
- if (isDropDown) {
8
- curDropDown = e.target.closest("[data-dropdown]");
9
- curDropDown.classList.toggle('active')
10
- }
11
-
12
- document.querySelectorAll("[data-dropdown].active").forEach(dropdown => {
13
- if (dropdown === curDropDown) return;
14
- dropdown.classList.remove(".active")
15
- })
16
- })
Binary file
Binary file
@@ -1,155 +0,0 @@
1
- body {
2
- font-family: "Cascadia Code";
3
- color: white;
4
- background: #424549;
5
- margin: 0;
6
- }
7
-
8
- .top-bar {
9
- background-color: rgba(0, 0, 0, 0.4);
10
- display: flex;
11
- align-items: baseline;
12
- border: 2px solid red;
13
- border-radius: 0.5rem;
14
- gap: 1rem;
15
- padding: 0.5rem;
16
- margin: 10;
17
- position: sticky;
18
- }
19
-
20
- .link {
21
- background: none;
22
- border: none;
23
- text-decoration: none;
24
- color: white;
25
- cursor: pointer;
26
- font-family: inherit;
27
- font-size: inherit;
28
- cursor: pointer;
29
- padding: 0;
30
- }
31
-
32
- .dropdown.active > .link,
33
- .link:hover {
34
- color: black;
35
- background: red;
36
- border-radius: 0.5rem;
37
- }
38
-
39
- .dropdown {
40
- position: relative;
41
- }
42
-
43
- .dropdown-menu {
44
- position: absolute;
45
- left: 0;
46
- top: calc(100% + 0.25rem);
47
- background-color: rgba(0, 0, 0, 0.4);
48
- padding: 0.75rem;
49
- border-radius: 0.5rem;
50
- box-shadow: 0 2px 5px, 0 rgba(0, 0, 0, 0.1);
51
- opacity: 0;
52
- pointer-events: none;
53
- transform: translateY(-10px);
54
- transition: opacity 150ms ease-in-out, transform 150ms ease-in-out;
55
- }
56
-
57
- .dropdown.active > .link + .dropdown-menu {
58
- opacity: 1;
59
- transform: translateY(0);
60
- pointer-events: auto;
61
- }
62
-
63
- .side-bar {
64
- list-style-type: none;
65
- border: 2px solid red;
66
- border-radius: 0.5rem;
67
- margin: 10px;
68
- padding: 10;
69
- width: 20%;
70
- overflow: auto;
71
- height: 85%;
72
- text-align: left;
73
- background-color: rgba(0, 0, 0, 0.4);
74
- top: 6.4%;
75
- position: fixed;
76
- }
77
-
78
- .page {
79
- margin: 0;
80
- right: 0;
81
- }
82
-
83
- #page {
84
- position: absolute;
85
- right: 0;
86
- width: 75vmax;
87
- }
88
-
89
- .component {
90
- border-radius: 0.5rem;
91
- border: 2px solid red;
92
- padding: 10;
93
- margin: 10px;
94
- background-color: #53565a;
95
- box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
96
- right: 0;
97
- }
98
-
99
- .index {
100
- align-items: left;
101
- }
102
-
103
- table {
104
- border-collapse: collapse;
105
- display: block;
106
- overflow-x: auto;
107
- white-space: nowrap;
108
- width: 100%;
109
- }
110
-
111
- tr,
112
- td {
113
- align-items: center;
114
- width: 100%;
115
- padding: 10;
116
- border: 2px solid red;
117
- }
118
-
119
- #table-header {
120
- background-color: rgba(0, 0, 0, 0.4);
121
- }
122
-
123
- .button {
124
- font-family: Arial;
125
- color: black;
126
- border-radius: 0.5rem;
127
- background-color: red; /* Green */
128
- border: none;
129
- padding: 15px 32px;
130
- text-align: center;
131
- text-decoration: none;
132
- display: inline-block;
133
- font-size: 20;
134
- }
135
-
136
- .select {
137
- background: none;
138
- border: none;
139
- text-decoration: none;
140
- color: white;
141
- cursor: pointer;
142
- font-family: inherit;
143
- font-size: inherit;
144
- cursor: pointer;
145
- padding: 0;
146
- border: 2px solid red;
147
- width: 100%;
148
- border-radius: 0.5rem;
149
- }
150
-
151
- .select:hover {
152
- background-color: none;
153
- background: none;
154
- text-decoration: none;
155
- }