Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2023-08-11 11:54:00 +02:00
parent 7c10f4a0c0
commit ffecc4ae6b
1 changed files with 134 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 3.3.2
* @version 3.3.3
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -4178,12 +4178,144 @@ module.exports = (_ => {
};
BDFDB.DiscordUtils = {};
var getFileData = (...args) => {
var p = function (e, t, n, r, i, o, a) {
try {
var s = e[o](a),
u = s.value;
} catch (e) {
n(e);
return;
}
s.done ? t(u) : Promise.resolve(u).then(r, i);
};
var E = function (e) {
return function () {
var t = this,
n = arguments;
return new Promise((function (r, i) {
var o = e.apply(t, n);
function a(e) {
p(o, r, i, a, s, "next", e);
}
function s(e) {
p(o, r, i, a, s, "throw", e);
}
a(void 0);
}));
};
};
return E(function (e) {
const v = function (e, t) {
var s = function (o) {
return function (s) {
return function (o) {
if (n) throw new TypeError("Generator is already executing.");
for (; a; ) try {
if (n = 1, r && (i = 2 & o[0] ? r.return : o[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
(r = 0, i) && (o = [2 & o[0], i.value]);
switch (o[0]) {
case 0:
case 1:
i = o;
break;
case 4:
a.label++;
return {
value: o[1],
done: !1
};
case 5:
a.label++;
r = o[1];
o = [0];
continue;
case 7:
o = a.ops.pop();
a.trys.pop();
continue;
default:
if (!(i = a.trys, i = i.length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) {
a = 0;
continue;
}
if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
a.label = o[1];
break;
}
if (6 === o[0] && a.label < i[1]) {
a.label = i[1];
i = o;
break;
}
if (i && a.label < i[2]) {
a.label = i[2];
a.ops.push(o);
break;
}
i[2] && a.ops.pop();
a.trys.pop();
continue;
}
o = t.call(e, a);
} catch (e) {
o = [6, e];
r = 0;
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return {
value: o[0] ? o[1] : void 0,
done: !0
}
}([o, s])
}
}
var n, r, i, o;
var a = {
label: 0,
sent: function () {
if (1 & i[0])
throw i[1];
return i[1]
},
trys: [],
ops: []
};
return o = {
next: s(0),
throw : s(1),
return : s(2)
}, "function" == typeof Symbol && (o[Symbol.iterator] = function () {
return this
}), o;
};
return v(this, (function (r) {
var t, n;
switch (r.label) {
case 0:
return [4, fetch(new Request(e, {
method: "GET",
mode: "cors"
}))];
case 1:
t = r.sent();
return [4, t.arrayBuffer()];
case 2:
n = r.sent();
return [2, n]
}
}));
}).apply(this, args);
};
BDFDB.DiscordUtils.requestFileData = function (...args) {
let {url, uIndex} = args[0] && typeof args[0] == "string" ? {url: args[0], uIndex: 0} : (args[1] && typeof args[1] == "object" && typeof args[1].url == "string" ? {url: args[1], uIndex: 1} : {url: null, uIndex: -1});
if (!url || typeof url != "string") return;
let {callback, cIndex} = args[1] && typeof args[1] == "function" ? {callback: args[1], cIndex: 1} : (args[2] && typeof args[2] == "function" ? {callback: args[2], cIndex: 2} : {callback: null, cIndex: -1});
if (typeof callback != "function") return;
Internal.LibraryModules.FileRequestUtils.getFileData(url).then(buffer => callback(null, buffer)).catch(error => callback(error, null));
getFileData(url).then(buffer => callback(null, buffer)).catch(error => callback(error, null));
};
BDFDB.DiscordUtils.getSetting = function (category, key) {
if (!category || !key) return;