remove compat functions, add updated settingsapi
This commit is contained in:
parent
ae26be7772
commit
6ea8342f94
|
@ -150,13 +150,10 @@ function evaluate(str, exportsR) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// krequire is a reimplementation of require(), only intended for loading plugins
|
// krequire is a reimplementation of require(), only intended for loading plugins
|
||||||
/*window.krequire = function (p) {
|
window.krequire = function (p) {
|
||||||
var exports = {};
|
var exports = {};
|
||||||
evaluate(fs.readFileSync($api.data + '/plugins/' + p + (p.endsWith('.js') ? '' : '.js'), 'utf8').toString(), exports);
|
evaluate(fs.readFileSync($api.data + '/plugins/' + p + (p.endsWith('.js') ? '' : '.js'), 'utf8').toString(), exports);
|
||||||
return exports;
|
return exports;
|
||||||
}*/
|
|
||||||
window.krequire = function(p){
|
|
||||||
return require($api.data + '/plugins/' + p + (p.endsWith('.js') ? '' : '.js')); //200 IQ :bigthink:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -675,7 +672,8 @@ https://discord.gg/8k3gEeE`,
|
||||||
return callback(r);
|
return callback(r);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
internal.error(e, 'A function wrapper threw an exception');
|
let err = internal && internal.error ? internal.error : console.error;
|
||||||
|
err(e, 'A function wrapper threw an exception');
|
||||||
|
|
||||||
// again, dont fuck stuff up if there's a flaw in the wrapper
|
// again, dont fuck stuff up if there's a flaw in the wrapper
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -85,16 +85,16 @@ exports = {
|
||||||
|
|
||||||
if (x === undefined || x === null) return;
|
if (x === undefined || x === null) return;
|
||||||
|
|
||||||
if (endpwn.customizer.data.bots.contains(x.id)) x.bot = true;
|
if (endpwn.customizer.data.bots.includes(x.id)) x.bot = true;
|
||||||
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
|
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
|
||||||
if (endpwn.customizer.data.devs.contains(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
|
if (endpwn.customizer.data.devs.includes(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// make sure devs' badges actually render
|
// make sure devs' badges actually render
|
||||||
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (endpwn.customizer.data.devs.contains(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
|
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (endpwn.customizer.data.devs.includes(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
|
||||||
|
|
||||||
// hook getGuild() so we can verify servers
|
// hook getGuild() so we can verify servers
|
||||||
$api.util.wrapAfter(
|
$api.util.wrapAfter(
|
||||||
|
@ -104,7 +104,7 @@ exports = {
|
||||||
|
|
||||||
if (x === undefined || x === null) return;
|
if (x === undefined || x === null) return;
|
||||||
|
|
||||||
if (endpwn.customizer.data.guilds.contains(x.id)) x.features.add('VERIFIED');
|
if (endpwn.customizer.data.guilds.includes(x.id)) x.features.add('VERIFIED');
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ exports = {
|
||||||
ourSections: [],
|
ourSections: [],
|
||||||
_callbacks: {},
|
_callbacks: {},
|
||||||
_panels: {},
|
_panels: {},
|
||||||
addSection: function(name,label,color=null,callback){
|
addSection: function(name,label,color=null,callback,pos=null){
|
||||||
let data = {};
|
let data = {};
|
||||||
|
|
||||||
data.section = name || `SAPI_${Math.floor(Math.random()*10000)}`;
|
data.section = name || `SAPI_${Math.floor(Math.random()*10000)}`;
|
||||||
|
@ -60,7 +60,7 @@ exports = {
|
||||||
data.element = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
|
data.element = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
|
||||||
|
|
||||||
$settingsapi.ourSections.push(data);
|
$settingsapi.ourSections.push(data);
|
||||||
$settingsapi.sections.splice($settingsapi.sections.length-4,0,data);
|
$settingsapi.sections.splice(pos ? pos : $settingsapi.sections.length-4,0,data);
|
||||||
$settingsapi._callbacks[name] = callback;
|
$settingsapi._callbacks[name] = callback;
|
||||||
},
|
},
|
||||||
addDivider: function(){
|
addDivider: function(){
|
||||||
|
|
Loading…
Reference in New Issue