Fix missing lib check

This commit is contained in:
_Lighty_ 2020-07-17 15:39:31 +02:00
parent 2c0fcf8e07
commit 4034e36abe
8 changed files with 477 additions and 433 deletions

View File

@ -41,7 +41,7 @@ module.exports = (() => {
twitter_username: '' twitter_username: ''
} }
], ],
version: '1.3.24', version: '1.3.25',
description: 'Simple library to complement plugins with shared code without lowering performance. Also adds needed buttons to some plugins.', description: 'Simple library to complement plugins with shared code without lowering performance. Also adds needed buttons to some plugins.',
github: 'https://github.com/1Lighty', github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js' github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js'
@ -732,8 +732,8 @@ module.exports = (() => {
*/ */
const FormItem = WebpackModules.getByDisplayName('FormItem'); const FormItem = WebpackModules.getByDisplayName('FormItem');
const DeprecatedModal = WebpackModules.getByDisplayName('DeprecatedModal'); const DeprecatedModal = WebpackModules.getByDisplayName('DeprecatedModal');
const ModalContainerClassname = XenoLib.getClass('mobile container'); const ModalContainerClassname = /* XenoLib.getClass('mobile container') */'';
const ModalContentClassname = XenoLib.getClass('mobile container content'); const ModalContentClassname = /* XenoLib.getClass('mobile container content') */'';
const ColorPickerComponent = WebpackModules.getByDisplayName('ColorPicker'); const ColorPickerComponent = WebpackModules.getByDisplayName('ColorPicker');
@ -1014,7 +1014,7 @@ module.exports = (() => {
isFistType = false; isFistType = false;
} }
} }
const renderFooter = () => ['Need support? ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => (LayerManager.popLayer(), ModalStack.pop(), InviteActions.acceptInviteAndTransitionToInviteChannel('NYvWdN5')) }, 'Join my support server'), "! Or consider donating via ", React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => (window.open('https://paypal.me/lighty13')) }, 'Paypal'), ', ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => (window.open('https://ko-fi.com/lighty_')) }, 'Ko-fi'),', ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => (window.open('https://www.patreon.com/lightyp')) }, 'Patreon'), '!']; const renderFooter = () => ['Need support? ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => (LayerManager.popLayer(), ModalStack.pop(), InviteActions.acceptInviteAndTransitionToInviteChannel('NYvWdN5')) }, 'Join my support server'), '! Or consider donating via ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => window.open('https://paypal.me/lighty13') }, 'Paypal'), ', ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => window.open('https://ko-fi.com/lighty_') }, 'Ko-fi'), ', ', React.createElement('a', { className: XenoLib.joinClassNames(AnchorClasses.anchor, AnchorClasses.anchorUnderlineOnHover), onClick: () => window.open('https://www.patreon.com/lightyp') }, 'Patreon'), '!'];
ModalStack.push(props => React.createElement(XenoLib.ReactComponents.ErrorBoundary, { label: 'Changelog', onError: () => props.onClose() }, React.createElement(ChangelogModal, { className: ChangelogClasses.container, selectable: true, onScroll: _ => _, onClose: _ => _, renderHeader: () => React.createElement(FlexChild.Child, { grow: 1, shrink: 1 }, React.createElement(Titles.default, { tag: Titles.Tags.H4 }, title), React.createElement(TextElement, { size: TextElement.Sizes.SIZE_12, className: ChangelogClasses.date }, `Version ${version}`)), renderFooter: () => React.createElement(FlexChild.Child, { gro: 1, shrink: 1 }, React.createElement(TextElement, { size: TextElement.Sizes.SIZE_12 }, footer ? (typeof footer === 'string' ? FancyParser(footer) : footer) : renderFooter())), children: items, ...props }))); ModalStack.push(props => React.createElement(XenoLib.ReactComponents.ErrorBoundary, { label: 'Changelog', onError: () => props.onClose() }, React.createElement(ChangelogModal, { className: ChangelogClasses.container, selectable: true, onScroll: _ => _, onClose: _ => _, renderHeader: () => React.createElement(FlexChild.Child, { grow: 1, shrink: 1 }, React.createElement(Titles.default, { tag: Titles.Tags.H4 }, title), React.createElement(TextElement, { size: TextElement.Sizes.SIZE_12, className: ChangelogClasses.date }, `Version ${version}`)), renderFooter: () => React.createElement(FlexChild.Child, { gro: 1, shrink: 1 }, React.createElement(TextElement, { size: TextElement.Sizes.SIZE_12 }, footer ? (typeof footer === 'string' ? FancyParser(footer) : footer) : renderFooter())), children: items, ...props })));
}; };
@ -1651,7 +1651,7 @@ module.exports = (() => {
this.settings = LibrarySettings; this.settings = LibrarySettings;
XenoLib.changeName(__filename, '1XenoLib'); /* prevent user from changing libs filename */ XenoLib.changeName(__filename, '1XenoLib'); /* prevent user from changing libs filename */
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
} }
load() { load() {
@ -1773,17 +1773,16 @@ module.exports = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.ZeresPluginLibrary, const b = !global.ZeresPluginLibrary,
c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library', c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library',
d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`, d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`,
e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), e = BdApi.findModuleByDisplayName('Text'),
f = BdApi.findModuleByDisplayName('Text'), f = BdApi.findModuleByDisplayName('ConfirmModal'),
g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), g = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null));
h = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null)); if (!a || !f || !e) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (f ? '' : ' ConfirmationModalComponent') + (e ? '' : 'TextElement')}`), g();
if (!e || !g || !f) return console.error(`Missing components:${(e ? '' : ' ModalStack') + (g ? '' : ' ConfirmationModalComponent') + (f ? '' : 'TextElement')}`), h(); class h extends BdApi.React.PureComponent {
class i extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 });
} }
@ -1794,60 +1793,56 @@ module.exports = (() => {
return this.state.hasError ? null : this.props.children; return this.state.hasError ? null : this.props.children;
} }
} }
class j extends g { let i = !1,
submitModal() { j = !1;
this.props.onConfirm(); const k = a.openModal(
} b => {
} if (j) return null;
let k = !1,
l = !1;
const m = e.push(
a => {
if (l) return null;
try { try {
return BdApi.React.createElement( return BdApi.React.createElement(
i, h,
{ {
label: 'missing dependency modal', label: 'missing dependency modal',
onError: () => { onError: () => {
e.popWithKey(m), h(); a.closeModal(k), g();
} }
}, },
BdApi.React.createElement( BdApi.React.createElement(
j, f,
Object.assign( Object.assign(
{ {
header: c, header: c,
children: [BdApi.React.createElement(f, { size: f.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] })], children: BdApi.React.createElement(e, { size: e.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] }),
red: !1, red: !1,
confirmText: 'Download Now', confirmText: 'Download Now',
cancelText: 'Cancel', cancelText: 'Cancel',
onCancel: b.onClose,
onConfirm: () => { onConfirm: () => {
if (k) return; if (i) return;
k = !0; i = !0;
const a = require('request'), const b = require('request'),
b = require('fs'), c = require('fs'),
c = require('path'); d = require('path');
a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, d, f) => { b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, e, f) => {
try { try {
if (a || 200 !== d.statusCode) return e.popWithKey(m), h(); if (b || 200 !== e.statusCode) return a.closeModal(k), g();
b.writeFile(c.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {}); c.writeFile(d.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {});
} catch (a) { } catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', a), e.popWithKey(m), h(); console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(k), g();
} }
}); });
} }
}, },
a b,
{ onClose: () => {} }
) )
) )
); );
} catch (a) { } catch (b) {
return console.error('There has been an error constructing the modal', a), (l = !0), e.popWithKey(m), h(), null; return console.error('There has been an error constructing the modal', b), (j = !0), a.closeModal(k), g(), null;
} }
}, },
void 0, { modalKey: `${this.name}_DEP_MODAL` }
`${this.name}_DEP_MODAL`
); );
} }
get name() { get name() {

View File

@ -1314,7 +1314,7 @@ var BetterImageViewer = (() => {
} }
}; };
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
} }
onStart() { onStart() {
@ -1952,8 +1952,8 @@ var BetterImageViewer = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.XenoLib, const b = !global.XenoLib,
c = !global.ZeresPluginLibrary, c = !global.ZeresPluginLibrary,
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
@ -1965,65 +1965,74 @@ var BetterImageViewer = (() => {
let a = `The ${d ? 'libraries' : 'library'} `; let a = `The ${d ? 'libraries' : 'library'} `;
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
})(), })(),
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), g = BdApi.findModuleByDisplayName('Text'),
h = BdApi.findModuleByDisplayName('Text'), h = BdApi.findModuleByDisplayName('ConfirmModal'),
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
if (!g || !i || !h) return j(); class j extends BdApi.React.PureComponent {
class k extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
}
componentDidCatch(a) {
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a);
}
render() {
return this.state.hasError ? null : this.props.children;
} }
} }
class l extends i { let k = !1,
submitModal() { l = !1;
this.props.onConfirm(); const m = a.openModal(
} b => {
} if (l) return null;
let m = !1; try {
const n = g.push( return BdApi.React.createElement(
a => j,
BdApi.React.createElement( { label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
k, BdApi.React.createElement(
{ h,
label: 'missing dependency modal', Object.assign(
onError: () => { {
g.popWithKey(n), j(); header: e,
} children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
}, red: !1,
BdApi.React.createElement( confirmText: 'Download Now',
l, cancelText: 'Cancel',
Object.assign( onCancel: b.onClose,
{ onConfirm: () => {
header: e, if (k) return;
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], k = !0;
red: !1, const b = require('request'),
confirmText: 'Download Now', c = require('fs'),
cancelText: 'Cancel', d = require('path'),
onConfirm: () => { e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
if (m) return; f = () => {
m = !0; (global.XenoLib && !XenoLibOutdated) ||
const a = require('request'), b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
b = require('fs'), try {
c = require('path'), if (b || 200 !== f.statusCode) return a.closeModal(m), i();
d = () => { c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); } catch (b) {
}; console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); }
} });
}, };
a !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
try {
if (b || 200 !== g.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
} catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
}
})
: f();
}
},
b,
{ onClose: () => {} }
)
) )
) );
), } catch (b) {
void 0, return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
`${this.name}_DEP_MODAL` }
},
{ modalKey: `${this.name}_DEP_MODAL` }
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {

View File

@ -174,7 +174,7 @@ var BetterTypingUsers = (() => {
constructor() { constructor() {
super(); super();
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
} }
onStart() { onStart() {
@ -364,17 +364,16 @@ var BetterTypingUsers = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.ZeresPluginLibrary, const b = !global.ZeresPluginLibrary,
c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library', c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library',
d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`, d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`,
e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), e = BdApi.findModuleByDisplayName('Text'),
f = BdApi.findModuleByDisplayName('Text'), f = BdApi.findModuleByDisplayName('ConfirmModal'),
g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), g = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null));
h = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null)); if (!a || !f || !e) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (f ? '' : ' ConfirmationModalComponent') + (e ? '' : 'TextElement')}`), g();
if (!e || !g || !f) return h(); class h extends BdApi.React.PureComponent {
class i extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 });
} }
@ -385,46 +384,56 @@ var BetterTypingUsers = (() => {
return this.state.hasError ? null : this.props.children; return this.state.hasError ? null : this.props.children;
} }
} }
class j extends g { let i = !1,
submitModal() { j = !1;
this.props.onConfirm(); const k = a.openModal(
} b => {
} if (j) return null;
let k = !1; try {
const l = e.push( return BdApi.React.createElement(
a => h,
BdApi.React.createElement( {
i, label: 'missing dependency modal',
{ onError: () => {
label: 'missing dependency modal', a.closeModal(k), g();
onError: () => { }
e.popWithKey(l), h(); },
} BdApi.React.createElement(
}, f,
BdApi.React.createElement( Object.assign(
j, {
Object.assign( header: c,
{ children: BdApi.React.createElement(e, { size: e.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] }),
header: c, red: !1,
children: [BdApi.React.createElement(f, { size: f.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] })], confirmText: 'Download Now',
red: !1, cancelText: 'Cancel',
confirmText: 'Download Now', onCancel: b.onClose,
cancelText: 'Cancel', onConfirm: () => {
onConfirm: () => { if (i) return;
if (k) return; i = !0;
k = !0; const b = require('request'),
const a = require('request'), c = require('fs'),
b = require('fs'), d = require('path');
c = require('path'); b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, e, f) => {
a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, d, f) => (a || 200 !== d.statusCode ? (e.popWithKey(l), h()) : void b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}))); try {
} if (b || 200 !== e.statusCode) return a.closeModal(k), g();
}, c.writeFile(d.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {});
a } catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(k), g();
}
});
}
},
b,
{ onClose: () => {} }
)
) )
) );
), } catch (b) {
void 0, return console.error('There has been an error constructing the modal', b), (j = !0), a.closeModal(k), g(), null;
`${this.name}_DEP_MODAL` }
},
{ modalKey: `${this.name}_DEP_MODAL` }
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {

View File

@ -156,7 +156,7 @@ var BetterUnavailableGuilds = (() => {
if (e.keyCode !== 13) return; if (e.keyCode !== 13) return;
try { try {
const parsed = JSON.parse(this.props.value); const parsed = JSON.parse(this.props.value);
['id', 'name', 'owner_id', 'joined_at', 'default_message_notifications'].forEach(prop => { ['id', 'name', 'owner_id', 'joined_at'].forEach(prop => {
if (!parsed.hasOwnProperty(prop) || typeof parsed[prop] === 'undefined') throw `Malformed guild data (${prop})`; if (!parsed.hasOwnProperty(prop) || typeof parsed[prop] === 'undefined') throw `Malformed guild data (${prop})`;
}); });
if (typeof parsed.name !== 'string' || typeof parsed.owner_id !== 'string' || /\\d+$/.test(parsed.owner_id)) throw 'Malformed guild data'; if (typeof parsed.name !== 'string' || typeof parsed.owner_id !== 'string' || /\\d+$/.test(parsed.owner_id)) throw 'Malformed guild data';
@ -194,7 +194,7 @@ var BetterUnavailableGuilds = (() => {
constructor() { constructor() {
super(); super();
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
this._dispatches = ['CONNECTION_OPEN']; this._dispatches = ['CONNECTION_OPEN'];
_.bindAll(this, ['handleGuildStoreChange', 'verifyAllServersCachedInClient', ...this._dispatches]); _.bindAll(this, ['handleGuildStoreChange', 'verifyAllServersCachedInClient', ...this._dispatches]);
@ -418,17 +418,16 @@ var BetterUnavailableGuilds = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.ZeresPluginLibrary, const b = !global.ZeresPluginLibrary,
c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library', c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library',
d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`, d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`,
e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), e = BdApi.findModuleByDisplayName('Text'),
f = BdApi.findModuleByDisplayName('Text'), f = BdApi.findModuleByDisplayName('ConfirmModal'),
g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), g = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null));
h = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null)); if (!a || !f || !e) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (f ? '' : ' ConfirmationModalComponent') + (e ? '' : 'TextElement')}`), g();
if (!e || !g || !f) return console.error(`Missing components:${(e ? '' : ' ModalStack') + (g ? '' : ' ConfirmationModalComponent') + (f ? '' : 'TextElement')}`), h(); class h extends BdApi.React.PureComponent {
class i extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 });
} }
@ -439,60 +438,56 @@ var BetterUnavailableGuilds = (() => {
return this.state.hasError ? null : this.props.children; return this.state.hasError ? null : this.props.children;
} }
} }
class j extends g { let i = !1,
submitModal() { j = !1;
this.props.onConfirm(); const k = a.openModal(
} b => {
} if (j) return null;
let k = !1,
l = !1;
const m = e.push(
a => {
if (l) return null;
try { try {
return BdApi.React.createElement( return BdApi.React.createElement(
i, h,
{ {
label: 'missing dependency modal', label: 'missing dependency modal',
onError: () => { onError: () => {
e.popWithKey(m), h(); a.closeModal(k), g();
} }
}, },
BdApi.React.createElement( BdApi.React.createElement(
j, f,
Object.assign( Object.assign(
{ {
header: c, header: c,
children: [BdApi.React.createElement(f, { size: f.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] })], children: BdApi.React.createElement(e, { size: e.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] }),
red: !1, red: !1,
confirmText: 'Download Now', confirmText: 'Download Now',
cancelText: 'Cancel', cancelText: 'Cancel',
onCancel: b.onClose,
onConfirm: () => { onConfirm: () => {
if (k) return; if (i) return;
k = !0; i = !0;
const a = require('request'), const b = require('request'),
b = require('fs'), c = require('fs'),
c = require('path'); d = require('path');
a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, d, f) => { b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, e, f) => {
try { try {
if (a || 200 !== d.statusCode) return e.popWithKey(m), h(); if (b || 200 !== e.statusCode) return a.closeModal(k), g();
b.writeFile(c.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {}); c.writeFile(d.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {});
} catch (a) { } catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', a), e.popWithKey(m), h(); console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(k), g();
} }
}); });
} }
}, },
a b,
{ onClose: () => {} }
) )
) )
); );
} catch (a) { } catch (b) {
return console.error('There has been an error constructing the modal', a), (l = !0), e.popWithKey(m), h(), null; return console.error('There has been an error constructing the modal', b), (j = !0), a.closeModal(k), g(), null;
} }
}, },
void 0, { modalKey: `${this.name}_DEP_MODAL` }
`${this.name}_DEP_MODAL`
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {

View File

@ -93,7 +93,7 @@ var CrashRecovery = (() => {
} }
}; };
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
} }
onStart() { onStart() {
@ -378,8 +378,8 @@ var CrashRecovery = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.XenoLib, const b = !global.XenoLib,
c = !global.ZeresPluginLibrary, c = !global.ZeresPluginLibrary,
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
@ -391,65 +391,74 @@ var CrashRecovery = (() => {
let a = `The ${d ? 'libraries' : 'library'} `; let a = `The ${d ? 'libraries' : 'library'} `;
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
})(), })(),
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), g = BdApi.findModuleByDisplayName('Text'),
h = BdApi.findModuleByDisplayName('Text'), h = BdApi.findModuleByDisplayName('ConfirmModal'),
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
if (!g || !i || !h) return j(); class j extends BdApi.React.PureComponent {
class k extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
}
componentDidCatch(a) {
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a);
}
render() {
return this.state.hasError ? null : this.props.children;
} }
} }
class l extends i { let k = !1,
submitModal() { l = !1;
this.props.onConfirm(); const m = a.openModal(
} b => {
} if (l) return null;
let m = !1; try {
const n = g.push( return BdApi.React.createElement(
a => j,
BdApi.React.createElement( { label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
k, BdApi.React.createElement(
{ h,
label: 'missing dependency modal', Object.assign(
onError: () => { {
g.popWithKey(n), j(); header: e,
} children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
}, red: !1,
BdApi.React.createElement( confirmText: 'Download Now',
l, cancelText: 'Cancel',
Object.assign( onCancel: b.onClose,
{ onConfirm: () => {
header: e, if (k) return;
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], k = !0;
red: !1, const b = require('request'),
confirmText: 'Download Now', c = require('fs'),
cancelText: 'Cancel', d = require('path'),
onConfirm: () => { e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
if (m) return; f = () => {
m = !0; (global.XenoLib && !XenoLibOutdated) ||
const a = require('request'), b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
b = require('fs'), try {
c = require('path'), if (b || 200 !== f.statusCode) return a.closeModal(m), i();
d = () => { c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); } catch (b) {
}; console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); }
} });
}, };
a !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
try {
if (b || 200 !== g.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
} catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
}
})
: f();
}
},
b,
{ onClose: () => {} }
)
) )
) );
), } catch (b) {
void 0, return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
`${this.name}_DEP_MODAL` }
},
{ modalKey: `${this.name}_DEP_MODAL` }
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {

View File

@ -167,7 +167,7 @@ var InAppNotifications = (() => {
} }
}; };
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) {}
} }
onStart() { onStart() {
@ -492,8 +492,8 @@ var InAppNotifications = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.XenoLib, const b = !global.XenoLib,
c = !global.ZeresPluginLibrary, c = !global.ZeresPluginLibrary,
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
@ -505,65 +505,74 @@ var InAppNotifications = (() => {
let a = `The ${d ? 'libraries' : 'library'} `; let a = `The ${d ? 'libraries' : 'library'} `;
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
})(), })(),
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), g = BdApi.findModuleByDisplayName('Text'),
h = BdApi.findModuleByDisplayName('Text'), h = BdApi.findModuleByDisplayName('ConfirmModal'),
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
if (!g || !i || !h) return j(); class j extends BdApi.React.PureComponent {
class k extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
}
componentDidCatch(a) {
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a);
}
render() {
return this.state.hasError ? null : this.props.children;
} }
} }
class l extends i { let k = !1,
submitModal() { l = !1;
this.props.onConfirm(); const m = a.openModal(
} b => {
} if (l) return null;
let m = !1; try {
const n = g.push( return BdApi.React.createElement(
a => j,
BdApi.React.createElement( { label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
k, BdApi.React.createElement(
{ h,
label: 'missing dependency modal', Object.assign(
onError: () => { {
g.popWithKey(n), j(); header: e,
} children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
}, red: !1,
BdApi.React.createElement( confirmText: 'Download Now',
l, cancelText: 'Cancel',
Object.assign( onCancel: b.onClose,
{ onConfirm: () => {
header: e, if (k) return;
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], k = !0;
red: !1, const b = require('request'),
confirmText: 'Download Now', c = require('fs'),
cancelText: 'Cancel', d = require('path'),
onConfirm: () => { e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
if (m) return; f = () => {
m = !0; (global.XenoLib && !XenoLibOutdated) ||
const a = require('request'), b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
b = require('fs'), try {
c = require('path'), if (b || 200 !== f.statusCode) return a.closeModal(m), i();
d = () => { c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); } catch (b) {
}; console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); }
} });
}, };
a !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
try {
if (b || 200 !== g.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
} catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
}
})
: f();
}
},
b,
{ onClose: () => {} }
)
) )
) );
), } catch (b) {
void 0, return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
`${this.name}_DEP_MODAL` }
},
{ modalKey: `${this.name}_DEP_MODAL` }
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {

View File

@ -331,7 +331,7 @@ var SaveToRedux = (() => {
} }
}; };
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); ModalStack.closeModal(`${this.name}_DEP_MODAL`);
} catch (e) { } } catch (e) { }
} }
onStart() { onStart() {
@ -1298,79 +1298,88 @@ var SaveToRedux = (() => {
} }
stop() { } stop() { }
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.XenoLib, const b = !global.XenoLib,
c = !global.ZeresPluginLibrary, c = !global.ZeresPluginLibrary,
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
e = (() => { e = (() => {
let a = ''; let a = '';
return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a; return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a;
})(), })(),
f = (() => { f = (() => {
let a = `The ${d ? 'libraries' : 'library'} `; let a = `The ${d ? 'libraries' : 'library'} `;
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
})(), })(),
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), g = BdApi.findModuleByDisplayName('Text'),
h = BdApi.findModuleByProps('Sizes', 'Weights'), h = BdApi.findModuleByDisplayName('ConfirmModal'),
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
if (!g || !i || !h) return j(); class j extends BdApi.React.PureComponent {
class k extends BdApi.React.PureComponent { constructor(a) {
constructor(a) { super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
super(a), (this.state = { hasError: !1 }); }
} }
componentDidCatch(a) { let k = !1,
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a); l = !1;
} const m = a.openModal(
render() { b => {
return this.state.hasError ? null : this.props.children; if (l) return null;
} try {
} return BdApi.React.createElement(
class l extends i { j,
submitModal() { { label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
this.props.onConfirm(); BdApi.React.createElement(
} h,
} Object.assign(
let m = !1; {
const n = g.push( header: e,
a => children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
BdApi.React.createElement( red: !1,
k, confirmText: 'Download Now',
{ cancelText: 'Cancel',
label: 'missing dependency modal', onCancel: b.onClose,
onError: () => { onConfirm: () => {
g.popWithKey(n), j(); if (k) return;
} k = !0;
}, const b = require('request'),
BdApi.React.createElement( c = require('fs'),
l, d = require('path'),
Object.assign( e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
{ f = () => {
header: e, (global.XenoLib && !XenoLibOutdated) ||
children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
red: !1, try {
confirmText: 'Download Now', if (b || 200 !== f.statusCode) return a.closeModal(m), i();
cancelText: 'Cancel', c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
onConfirm: () => { } catch (b) {
if (m) return; console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
m = !0; }
const a = require('request'), });
b = require('fs'), };
c = require('path'), !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
d = () => { ? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => { }))); try {
}; if (b || 200 !== g.statusCode) return a.closeModal(m), i();
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => { }), d()))) : d(); c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
} } catch (b) {
}, console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
a }
) })
) : f();
), }
void 0, },
`${this.name}_DEP_MODAL` b,
); { onClose: () => {} }
)
)
);
} catch (b) {
return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
}
},
{ modalKey: `${this.name}_DEP_MODAL` }
);
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {
return 'Plugin'; return 'Plugin';

View File

@ -617,8 +617,8 @@ var UnreadBadgesRedux = (() => {
} }
stop() {} stop() {}
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
const b = !global.XenoLib, const b = !global.XenoLib,
c = !global.ZeresPluginLibrary, c = !global.ZeresPluginLibrary,
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
@ -630,65 +630,74 @@ var UnreadBadgesRedux = (() => {
let a = `The ${d ? 'libraries' : 'library'} `; let a = `The ${d ? 'libraries' : 'library'} `;
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
})(), })(),
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), g = BdApi.findModuleByDisplayName('Text'),
h = BdApi.findModuleByDisplayName('Text'), h = BdApi.findModuleByDisplayName('ConfirmModal'),
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
if (!g || !i || !h) return j(); class j extends BdApi.React.PureComponent {
class k extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
}
componentDidCatch(a) {
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a);
}
render() {
return this.state.hasError ? null : this.props.children;
} }
} }
class l extends i { let k = !1,
submitModal() { l = !1;
this.props.onConfirm(); const m = a.openModal(
} b => {
} if (l) return null;
let m = !1; try {
const n = g.push( return BdApi.React.createElement(
a => j,
BdApi.React.createElement( { label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
k, BdApi.React.createElement(
{ h,
label: 'missing dependency modal', Object.assign(
onError: () => { {
g.popWithKey(n), j(); header: e,
} children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
}, red: !1,
BdApi.React.createElement( confirmText: 'Download Now',
l, cancelText: 'Cancel',
Object.assign( onCancel: b.onClose,
{ onConfirm: () => {
header: e, if (k) return;
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], k = !0;
red: !1, const b = require('request'),
confirmText: 'Download Now', c = require('fs'),
cancelText: 'Cancel', d = require('path'),
onConfirm: () => { e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
if (m) return; f = () => {
m = !0; (global.XenoLib && !XenoLibOutdated) ||
const a = require('request'), b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
b = require('fs'), try {
c = require('path'), if (b || 200 !== f.statusCode) return a.closeModal(m), i();
d = () => { c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); } catch (b) {
}; console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); }
} });
}, };
a !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
try {
if (b || 200 !== g.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
} catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
}
})
: f();
}
},
b,
{ onClose: () => {} }
)
) )
) );
), } catch (b) {
void 0, return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
`${this.name}_DEP_MODAL` }
},
{ modalKey: `${this.name}_DEP_MODAL` }
); );
} }
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {