seyfert 4.4.0 → 4.4.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.
@@ -80,7 +80,7 @@ class BaseCommand {
80
80
  return Promise.resolve({});
81
81
  }
82
82
  let index = 0;
83
- return new Promise(res => {
83
+ return new Promise((res, rej) => {
84
84
  let running = true;
85
85
  const pass = () => {
86
86
  if (!running) {
@@ -100,7 +100,7 @@ class BaseCommand {
100
100
  running = false;
101
101
  return res({});
102
102
  }
103
- context.client.middlewares[middlewares[index]]({ context, next, stop, pass });
103
+ void invoke(middlewares[index]);
104
104
  }
105
105
  const stop = err => {
106
106
  if (!running) {
@@ -109,7 +109,19 @@ class BaseCommand {
109
109
  running = false;
110
110
  return res({ error: err });
111
111
  };
112
- context.client.middlewares[middlewares[0]]({ context, next, stop, pass });
112
+ async function invoke(middleware) {
113
+ try {
114
+ await context.client.middlewares[middleware]({ context, next, stop, pass });
115
+ }
116
+ catch (err) {
117
+ if (!running) {
118
+ return;
119
+ }
120
+ running = false;
121
+ rej(err);
122
+ }
123
+ }
124
+ void invoke(middlewares[0]);
113
125
  });
114
126
  }
115
127
  /** @internal */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",