@open-discord-bots/framework 0.2.10 → 0.2.12
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/dist/api/main.js +1 -1
- package/dist/api/modules/action.d.ts +9 -9
- package/dist/api/modules/action.js +3 -3
- package/dist/api/modules/base.d.ts +5 -3
- package/dist/api/modules/base.js +8 -4
- package/dist/api/modules/builder.d.ts +41 -41
- package/dist/api/modules/builder.js +20 -20
- package/dist/api/modules/checker.d.ts +3 -3
- package/dist/api/modules/client.js +2 -2
- package/dist/api/modules/console.d.ts +15 -15
- package/dist/api/modules/console.js +31 -31
- package/dist/api/modules/event.js +2 -2
- package/dist/api/modules/helpmenu.js +1 -1
- package/dist/api/modules/progressbar.js +1 -0
- package/dist/api/modules/responder.d.ts +37 -37
- package/dist/api/modules/responder.js +13 -13
- package/dist/api/modules/statistic.js +0 -2
- package/dist/api/modules/worker.d.ts +14 -14
- package/dist/api/modules/worker.js +9 -9
- package/dist/cli/editConfig.js +6 -20
- package/dist/startup/pluginLauncher.js +6 -4
- package/dist/utilities/index.d.ts +2 -2
- package/package.json +4 -4
- package/src/api/main.ts +1 -1
- package/src/api/modules/action.ts +10 -10
- package/src/api/modules/base.ts +12 -8
- package/src/api/modules/builder.ts +53 -53
- package/src/api/modules/checker.ts +3 -3
- package/src/api/modules/client.ts +15 -15
- package/src/api/modules/component.txt +350 -0
- package/src/api/modules/config.ts +1 -1
- package/src/api/modules/console.ts +26 -26
- package/src/api/modules/database.ts +1 -1
- package/src/api/modules/event.ts +5 -5
- package/src/api/modules/helpmenu.ts +3 -3
- package/src/api/modules/language.ts +1 -1
- package/src/api/modules/plugin.ts +1 -1
- package/src/api/modules/progressbar.ts +3 -1
- package/src/api/modules/responder.ts +43 -43
- package/src/api/modules/statistic.ts +0 -1
- package/src/api/modules/worker.ts +25 -25
- package/src/cli/editConfig.ts +20 -34
- package/src/startup/compilation.ts +2 -2
- package/src/startup/pluginLauncher.ts +9 -6
- package/src/utilities/index.ts +3 -3
- package/tsconfig.json +1 -0
|
@@ -17,16 +17,19 @@ export const loadAllPlugins = async (opendiscord:api.ODMain) => {
|
|
|
17
17
|
//check & validate
|
|
18
18
|
for (const p of plugins){
|
|
19
19
|
//prechecks
|
|
20
|
-
if (p === ".DS_Store")
|
|
21
|
-
if (!fs.statSync("./plugins/"+p).isDirectory())
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if (p === ".DS_Store") continue //ignore MacOS DS_Store file
|
|
21
|
+
if (!fs.statSync("./plugins/"+p).isDirectory()){
|
|
22
|
+
opendiscord.log("Plugin is not a directory, canceling plugin execution...","plugin",[
|
|
23
|
+
{key:"plugin",value:"./plugins/"+p}
|
|
24
|
+
])
|
|
25
|
+
continue
|
|
26
|
+
}
|
|
24
27
|
if (!fs.existsSync("./plugins/"+p+"/plugin.json")){
|
|
25
28
|
initPluginError = true
|
|
26
29
|
opendiscord.log("Plugin doesn't have a plugin.json, canceling plugin execution...","plugin",[
|
|
27
30
|
{key:"plugin",value:"./plugins/"+p}
|
|
28
31
|
])
|
|
29
|
-
|
|
32
|
+
continue
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
//plugin loading
|
|
@@ -81,7 +84,7 @@ export const loadAllPlugins = async (opendiscord:api.ODMain) => {
|
|
|
81
84
|
const plugin = new api.ODPlugin(p,rawplugindata)
|
|
82
85
|
opendiscord.plugins.add(plugin)
|
|
83
86
|
|
|
84
|
-
}catch(e){
|
|
87
|
+
}catch(e:any){
|
|
85
88
|
//when any of the above errors happen, crash the bot when soft mode isn't enabled
|
|
86
89
|
initPluginError = true
|
|
87
90
|
opendiscord.log(e.message+", canceling plugin execution...","plugin",[
|
package/src/utilities/index.ts
CHANGED
|
@@ -107,7 +107,7 @@ export function timedAwait<ReturnValue>(promise:ReturnValue,timeout:number,onErr
|
|
|
107
107
|
try{
|
|
108
108
|
const res = await promise
|
|
109
109
|
if (allowResolve) resolve(res)
|
|
110
|
-
}catch(err){
|
|
110
|
+
}catch(err:any){
|
|
111
111
|
onError(err)
|
|
112
112
|
}
|
|
113
113
|
return promise
|
|
@@ -117,7 +117,7 @@ export function timedAwait<ReturnValue>(promise:ReturnValue,timeout:number,onErr
|
|
|
117
117
|
/**## dateString `utility function`
|
|
118
118
|
* Use this function to create a short date string in the following format: `DD/MM/YYYY HH:MM:SS`
|
|
119
119
|
*/
|
|
120
|
-
export function dateString(date): string {
|
|
120
|
+
export function dateString(date:Date): string {
|
|
121
121
|
return `${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -162,7 +162,7 @@ export function ordinalNumber(num:number){
|
|
|
162
162
|
/**## trimEmojis `utility function`
|
|
163
163
|
* Trim/remove all emoji's from a Javascript string.
|
|
164
164
|
*/
|
|
165
|
-
export function trimEmojis(text){
|
|
165
|
+
export function trimEmojis(text:string){
|
|
166
166
|
return text.replace(/(\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*)/gu,"")
|
|
167
167
|
}
|
|
168
168
|
|