BTU, CR and IAN passive updates

This commit is contained in:
_Lighty_ 2020-03-12 16:23:56 +01:00
parent 6b8dbc0529
commit e6b93a9de4
3 changed files with 235 additions and 242 deletions

View File

@ -1,4 +1,4 @@
//META{"name":"BetterTypingUsers","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterTypingUsers"}*// //META{"name":"BetterTypingUsers","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterTypingUsers","authorId":"239513071272329217","invite":"NYvWdN5","donate":"https://paypal.me/lighty13"}*//
/*@cc_on /*@cc_on
@if (@_jscript) @if (@_jscript)
@ -171,6 +171,11 @@ var BetterTypingUsers = (() => {
we can only hope the user doesn't rename the plugin.. we can only hope the user doesn't rename the plugin..
*/ */
return class BetterTypingUsers extends Plugin { return class BetterTypingUsers extends Plugin {
constructor() {
try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
} catch (e) {}
}
onStart() { onStart() {
this.promises = { state: { cancelled: false } }; this.promises = { state: { cancelled: false } };
this.patchAll(); this.patchAll();
@ -182,6 +187,8 @@ var BetterTypingUsers = (() => {
} }
` `
); );
DiscordConstants.MAX_TYPING_USERS = 99;
/* theoretical max is 5 users typing at once.. welp */
} }
onStop() { onStop() {
@ -227,25 +234,55 @@ var BetterTypingUsers = (() => {
/* modify BRCs behavior so it won't unexpectedly try to modify an entry that does not exist /* modify BRCs behavior so it won't unexpectedly try to modify an entry that does not exist
by simply limiting it to the max number of usernames visible in total by simply limiting it to the max number of usernames visible in total
*/ */
Patcher.after(BetterRoleColors, 'filterTypingUsers', (_, __, ret) => ret.slice(0, this.settings.maxVisible)); Patcher.after(BetterRoleColors, 'filterTypingUsers', (_this, __, ret) => ret.slice(0, this.settings.maxVisible));
} }
async patchTypingUsers(promiseState) { async patchTypingUsers(promiseState) {
const TypingUsers = await ReactComponents.getComponentByName('TypingUsers', DiscordSelectors.Typing.typing); const TypingUsers = await ReactComponents.getComponentByName('TypingUsers', DiscordSelectors.Typing.typing);
if (!TypingUsers.selector) TypingUsers.selector = DiscordSelectors.Typing.typing;
const TypingTextClassname = WebpackModules.getByProps('typing', 'text').text.split(' ')[0]; const TypingTextClassname = WebpackModules.getByProps('typing', 'text').text.split(' ')[0];
if (promiseState.cancelled) return; if (promiseState.cancelled) return;
if (!CTypingUsers) CTypingUsers = typingUsers.component; /* failsafe */ if (!CTypingUsers) CTypingUsers = typingUsers.component; /* failsafe */
/* use `instead` so that we modify the return before BetterRoleColors */ /* use `instead` so that we modify the return before BetterRoleColors */
/* Patcher.after(TypingUsers.component.prototype, 'componentDidUpdate', (_this, [props, state], ret) => {
const filtered1 = this.filterTypingUsers(_this.props.typingUsers);
const filtered2 = this.filterTypingUsers(props.typingUsers);
if (filtered1.length !== filtered2.length || _this.state.numLess === state.numLess) {
_this.state.numLess = 0;
_this.triedLess = false;
_this.triedMore = false;
}
}); */
Patcher.instead(TypingUsers.component.prototype, 'render', (_this, _, orig) => { Patcher.instead(TypingUsers.component.prototype, 'render', (_this, _, orig) => {
/* if (!_this.state) _this.state = { numLess: 0 }; */
const ret = orig(); const ret = orig();
if (!ret) {
/* _this.state.numLess = 0; */
return ret;
}
const filtered = this.filterTypingUsers(_this.props.typingUsers); const filtered = this.filterTypingUsers(_this.props.typingUsers);
if (filtered.length <= 3) return ret; if (filtered.length <= 3) return ret;
/* ret.ref = e => {
_this.__baseRef = e;
if (!e) return;
if (!_this.__textRef) return;
_this.maxWidth = parseInt(getComputedStyle(_this.__baseRef.parentElement).width) - (_this.__textRef.offsetLeft + parseInt(getComputedStyle(_this.__textRef)['margin-left']) - _this.__baseRef.offsetLeft);
if (_this.__textRef.scrollWidth > _this.maxWidth) {
if (_this.triedMore) return;
if (filtered.length - _this.state.numLess <= 3) return;
_this.setState({ numLess: _this.state.numLess + 1 });
}
}; */
const typingUsers = Utilities.findInReactTree(ret, e => e && e.props && typeof e.props.className === 'string' && e.props.className.indexOf(TypingTextClassname) !== -1); const typingUsers = Utilities.findInReactTree(ret, e => e && e.props && typeof e.props.className === 'string' && e.props.className.indexOf(TypingTextClassname) !== -1);
if (!typingUsers) return ret; if (!typingUsers) return ret;
/* if (typeof _this.state.numLess !== 'number') _this.state.numLess = 0;
typingUsers.ref = e => {
_this.__textRef = e;
}; */
typingUsers.props.children = []; typingUsers.props.children = [];
/* I don't think this method works for every language..? */ /* I don't think this method works for every language..? */
for (let i = 0; i < filtered.length; i++) { for (let i = 0; i < filtered.length; i++) {
if (this.settings.maxVisible === i) { if (this.settings.maxVisible /* filtered.length - _this.state.numLess */ === i) {
const others = filtered.length - i; const others = filtered.length - i;
if (others === 1) typingUsers.props.children.push(this.strings.AND_1_OTHER); if (others === 1) typingUsers.props.children.push(this.strings.AND_1_OTHER);
else typingUsers.props.children.push(Utilities.formatTString(this.strings.AND_X_OTHERS, { count: others })); else typingUsers.props.children.push(Utilities.formatTString(this.strings.AND_X_OTHERS, { count: others }));
@ -297,11 +334,10 @@ var BetterTypingUsers = (() => {
let ZeresPluginLibraryOutdated = false; let ZeresPluginLibraryOutdated = false;
try { try {
if (global.BdApi && typeof BdApi.getPlugin === 'function' /* you never know with those retarded client mods */) { if (global.BdApi && 'function' == typeof BdApi.getPlugin) {
const versionChecker = (a, b) => ((a = a.split('.').map(a => parseInt(a))), (b = b.split('.').map(a => parseInt(a))), !!(b[0] > a[0])) || !!(b[0] == a[0] && b[1] > a[1]) || !!(b[0] == a[0] && b[1] == a[1] && b[2] > a[2]); const a = (c, a) => ((c = c.split('.').map(b => parseInt(b))), (a = a.split('.').map(b => parseInt(b))), !!(a[0] > c[0])) || !!(a[0] == c[0] && a[1] > c[1]) || !!(a[0] == c[0] && a[1] == c[1] && a[2] > c[2]),
const isOutOfDate = (lib, minVersion) => lib && lib._config && lib._config.info && lib._config.info.version && versionChecker(lib._config.info.version, minVersion); b = BdApi.getPlugin('ZeresPluginLibrary');
const iZeresPluginLibrary = BdApi.getPlugin('ZeresPluginLibrary'); ((b, c) => b && b._config && b._config.info && b._config.info.version && a(b._config.info.version, c))(b, '1.2.11') && (ZeresPluginLibraryOutdated = !0);
if (isOutOfDate(iZeresPluginLibrary, '1.2.10')) ZeresPluginLibraryOutdated = true;
} }
} catch (e) { } catch (e) {
console.error('Error checking if ZeresPluginLibrary is out of date', e); console.error('Error checking if ZeresPluginLibrary is out of date', e);
@ -309,6 +345,9 @@ var BetterTypingUsers = (() => {
return !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated return !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
? class { ? class {
constructor() {
this._config = config;
}
getName() { getName() {
return this.name.replace(/\s+/g, ''); return this.name.replace(/\s+/g, '');
} }
@ -323,94 +362,68 @@ var BetterTypingUsers = (() => {
} }
stop() {} stop() {}
load() { load() {
const header = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library'; const a = BdApi.findModuleByProps('isModalOpen');
const content = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`; if (a && a.isModalOpen(`${this.name}_DEP_MODAL`)) return;
const ModalStack = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'); const b = !global.ZeresPluginLibrary,
const TextElement = BdApi.findModuleByProps('Sizes', 'Weights'); c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library',
const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal'); d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`,
const onFail = () => BdApi.getCore().alert(header, `${content}<br/>Due to a slight mishap however, you'll have to download the library yourself.<br/><br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>`); e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'),
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail(); f = BdApi.findModuleByProps('Sizes', 'Weights'),
class TempErrorBoundary extends BdApi.React.PureComponent { g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
constructor(props) { h = () => BdApi.getCore().alert(c, `${d}<br/>Due to a slight mishap however, you'll have to download the libraries yourself.<br/>${b || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : ''}`);
super(props); if (!e || !g || !f) return h();
this.state = { hasError: false }; class i extends BdApi.React.PureComponent {
constructor(a) {
super(a), (this.state = { hasError: !1 });
} }
componentDidCatch(err, inf) { componentDidCatch(a) {
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`); 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.setState({ hasError: true });
if (typeof this.props.onError === 'function') this.props.onError(err);
} }
render() { render() {
if (this.state.hasError) return null; return this.state.hasError ? null : this.props.children;
return this.props.children;
} }
} }
let modalId; class j extends g {
const onHeckWouldYouLookAtThat = (() => { submitModal() {
if (!global.pluginModule || !global.BDEvents) return () => {}; /* other client mods */ this.props.onConfirm();
const onLibLoaded = e => { }
if (e !== 'ZeresPluginLibrary') return; }
BDEvents.off('plugin-loaded', onLibLoaded); let k = !1;
BDEvents.off('plugin-reloaded', onLibLoaded); const l = e.push(
ModalStack.popWithKey(modalId); /* make it easier on the user */ a =>
pluginModule.reloadPlugin(this.getName());
};
BDEvents.on('plugin-loaded', onLibLoaded);
BDEvents.on('plugin-reloaded', onLibLoaded);
return () => (BDEvents.off('plugin-loaded', onLibLoaded), BDEvents.off('plugin-reloaded', onLibLoaded));
})();
modalId = ModalStack.push(props => {
return BdApi.React.createElement(
TempErrorBoundary,
{
label: 'missing/outdated dependency modal',
onError: () => {
ModalStack.popWithKey(modalId); /* smh... */
onFail();
}
},
BdApi.React.createElement( BdApi.React.createElement(
ConfirmationModal, i,
Object.assign( {
{ label: 'missing dependency modal',
header, onError: () => {
children: [ e.popWithKey(l), h();
BdApi.React.createElement(TextElement, { }
color: TextElement.Colors.PRIMARY, },
children: [`${content} Please click Download Now to download it.`] BdApi.React.createElement(
}) j,
], Object.assign(
red: false, {
confirmText: 'Download Now', header: c,
cancelText: 'Cancel', children: [BdApi.React.createElement(f, { color: f.Colors.PRIMARY, children: [`${d} Please click Download Now to download it.`] })],
onConfirm: () => { red: !1,
onHeckWouldYouLookAtThat(); confirmText: 'Download Now',
const request = require('request'); cancelText: 'Cancel',
const fs = require('fs'); onConfirm: () => {
const path = require('path'); if (k) return;
const onDone = () => { k = !0;
if (!global.pluginModule || !global.BDEvents) return; const a = require('request'),
const onLoaded = e => { b = require('fs'),
if (e !== 'ZeresPluginLibrary') return; c = require('path');
BDEvents.off('plugin-loaded', onLoaded); a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, d, e) => (a ? h() : void b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), e, () => {})));
BDEvents.off('plugin-reloaded', onLoaded); }
pluginModule.reloadPlugin(this.name); },
}; a
BDEvents.on('plugin-loaded', onLoaded); )
BDEvents.on('plugin-reloaded', onLoaded);
};
request('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (error, response, body) => {
if (error) return onFail();
onDone();
fs.writeFile(path.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), body, () => {});
});
}
},
props
) )
) ),
); void 0,
}); `${this.name}_DEP_MODAL`
);
} }
start() {} start() {}

View File

@ -1,4 +1,4 @@
//META{"name":"CrashRecovery","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/CrashRecovery/","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=CrashRecovery"}*// //META{"name":"CrashRecovery","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/CrashRecovery/","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=CrashRecovery","authorId":"239513071272329217","invite":"NYvWdN5","donate":"https://paypal.me/lighty13"}*//
/*@cc_on /*@cc_on
@if (@_jscript) @if (@_jscript)
@ -92,6 +92,9 @@ var CrashRecovery = (() => {
} catch (e) {} } catch (e) {}
} }
}; };
try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
} catch (e) {}
} }
onStart() { onStart() {
this.attempts = 0; this.attempts = 0;
@ -371,7 +374,7 @@ var CrashRecovery = (() => {
n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e),
e = BdApi.getPlugin('ZeresPluginLibrary'), e = BdApi.getPlugin('ZeresPluginLibrary'),
o = BdApi.getPlugin('XenoLib'); o = BdApi.getPlugin('XenoLib');
n(e, '1.2.10') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.11') && (XenoLibOutdated = !0); n(e, '1.2.11') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.14') && (XenoLibOutdated = !0);
} }
} catch (i) { } catch (i) {
console.error('Error checking if libraries are out of date', i); console.error('Error checking if libraries are out of date', i);
@ -379,6 +382,9 @@ var CrashRecovery = (() => {
return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated
? class { ? class {
constructor() {
this._XL_PLUGIN = true;
}
getName() { getName() {
return this.name.replace(/\s+/g, ''); return this.name.replace(/\s+/g, '');
} }
@ -393,96 +399,80 @@ var CrashRecovery = (() => {
} }
stop() {} stop() {}
load() { load() {
const a = !global.XenoLib, const a = BdApi.findModuleByProps('isModalOpen');
b = !global.ZeresPluginLibrary, if (a && a.isModalOpen(`${this.name}_DEP_MODAL`)) return;
c = (a && b) || ((a || b) && (XenoLibOutdated || ZeresPluginLibraryOutdated)) || XenoLibOutdated || ZeresPluginLibraryOutdated, const b = !global.XenoLib,
d = (() => { c = !global.ZeresPluginLibrary,
let d = ''; d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
return a || b ? (d += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (d += `Outdated `), (d += `${c ? 'Libraries' : 'Library'} `), d;
})(),
e = (() => { e = (() => {
let d = `The ${c ? 'libraries' : 'library'} `; let a = '';
return a || XenoLibOutdated ? ((d += 'XenoLib '), (b || ZeresPluginLibraryOutdated) && (d += 'and ZeresPluginLibrary ')) : (b || ZeresPluginLibraryOutdated) && (d += 'ZeresPluginLibrary '), (d += `required for ${this.name} ${c ? 'are' : 'is'} ${a || b ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (a || b ? ' and/or outdated' : 'outdated') : ''}.`), d; return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a;
})(), })(),
f = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), f = (() => {
g = BdApi.findModuleByProps('Sizes', 'Weights'), let a = `The ${d ? 'libraries' : 'library'} `;
h = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), 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;
i = () => BdApi.getCore().alert(d, `${e}<br/>Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.<br/>${b || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : ''}${a || XenoLibOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js"target="_blank">Click here to download XenoLib</a>' : ''}`); })(),
if (!f || !h || !g) return i(); g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'),
let j; h = BdApi.findModuleByProps('Sizes', 'Weights'),
const k = (() => { i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
if (!global.pluginModule || !global.BDEvents) return; j = () => BdApi.getCore().alert(e, `${f}<br/>Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.<br/>${c || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : ''}${b || XenoLibOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js"target="_blank">Click here to download XenoLib</a>' : ''}`);
if (a || XenoLibOutdated) { if (!g || !i || !h) return j();
const a = () => { class k extends BdApi.React.PureComponent {
BDEvents.off('xenolib-loaded', a), f.popWithKey(j), pluginModule.reloadPlugin(this.name);
};
return BDEvents.on('xenolib-loaded', a), () => BDEvents.off('xenolib-loaded', a);
}
const b = a => {
'ZeresPluginLibrary' !== a || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), f.popWithKey(j), pluginModule.reloadPlugin(this.name));
};
return BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b), () => (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b));
})();
class l extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 });
} }
componentDidCatch(a, b) { 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); 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() { render() {
return this.state.hasError ? null : this.props.children; return this.state.hasError ? null : this.props.children;
} }
} }
j = f.push(a => class l extends i {
BdApi.React.createElement( submitModal() {
l, this.props.onConfirm();
{ }
label: 'missing dependency modal', }
onError: () => { let m = !1;
f.popWithKey(j), i(); const n = g.push(
} a =>
},
BdApi.React.createElement( BdApi.React.createElement(
h, k,
Object.assign( {
{ label: 'missing dependency modal',
header: d, onError: () => {
children: [BdApi.React.createElement(g, { color: g.Colors.PRIMARY, children: [`${e} Please click Download Now to download ${c ? 'them' : 'it'}.`] })], g.popWithKey(n), j();
red: !1, }
confirmText: 'Download Now', },
cancelText: 'Cancel', BdApi.React.createElement(
onConfirm: () => { l,
k(); Object.assign(
const a = require('request'), {
b = require('fs'), header: e,
c = require('path'), children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })],
d = a => { red: !1,
if (!global.BDEvents) return a(); confirmText: 'Download Now',
const b = c => { cancelText: 'Cancel',
'ZeresPluginLibrary' !== c || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), a()); onConfirm: () => {
if (m) return;
m = !0;
const a = require('request'),
b = require('fs'),
c = require('path'),
d = () => {
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a ? j() : void b.writeFile(c.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), e, () => {})));
}; };
BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b); !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, e, f) => (a ? j() : void (b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d();
}, }
e = () => { },
if (!global.pluginModule || (!global.BDEvents && !global.XenoLib)) return; a
if ((global.XenoLib && !XenoLibOutdated) || !global.BDEvents) return pluginModule.reloadPlugin(this.name); )
const a = () => {
BDEvents.off('xenolib-loaded', a), pluginModule.reloadPlugin(this.name);
};
BDEvents.on('xenolib-loaded', a);
},
f = () => (global.XenoLib && !XenoLibOutdated ? e() : void a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, f) => (a ? i() : void (e(), b.writeFile(c.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), f, () => {})))));
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, e, g) => (a ? i() : void (d(f), b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), g, () => {})))) : f();
}
},
a
) )
) ),
) void 0,
`${this.name}_DEP_MODAL`
); );
} }
start() {} start() {}
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {
return 'Plugin'; return 'Plugin';

View File

@ -1,4 +1,4 @@
//META{"name":"InAppNotifications","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/InAppNotifications/InAppNotifications.plugin.js","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=InAppNotifications"}*// //META{"name":"InAppNotifications","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/InAppNotifications/InAppNotifications.plugin.js","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=InAppNotifications","authorId":"239513071272329217","invite":"NYvWdN5","donate":"https://paypal.me/lighty13"}*//
/*@cc_on /*@cc_on
@if (@_jscript) @if (@_jscript)
@ -111,6 +111,9 @@ var InAppNotifications = (() => {
} }
} }
}; };
try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
} catch (e) {}
} }
onStart() { onStart() {
this.errorCount = 0; this.errorCount = 0;
@ -332,8 +335,8 @@ var InAppNotifications = (() => {
const i = (i, n) => ((i = i.split('.').map(i => parseInt(i))), (n = n.split('.').map(i => parseInt(i))), !!(n[0] > i[0]) || !!(n[0] == i[0] && n[1] > i[1]) || !!(n[0] == i[0] && n[1] == i[1] && n[2] > i[2])), const i = (i, n) => ((i = i.split('.').map(i => parseInt(i))), (n = n.split('.').map(i => parseInt(i))), !!(n[0] > i[0]) || !!(n[0] == i[0] && n[1] > i[1]) || !!(n[0] == i[0] && n[1] == i[1] && n[2] > i[2])),
n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e),
e = BdApi.getPlugin('ZeresPluginLibrary'), e = BdApi.getPlugin('ZeresPluginLibrary'),
author = BdApi.getPlugin('XenoLib'); o = BdApi.getPlugin('XenoLib');
n(e, '1.2.10') && (ZeresPluginLibraryOutdated = !0), n(author, '1.3.11') && (XenoLibOutdated = !0); n(e, '1.2.11') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.14') && (XenoLibOutdated = !0);
} }
} catch (i) { } catch (i) {
console.error('Error checking if libraries are out of date', i); console.error('Error checking if libraries are out of date', i);
@ -341,6 +344,9 @@ var InAppNotifications = (() => {
return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated
? class { ? class {
constructor() {
this._XL_PLUGIN = true;
}
getName() { getName() {
return this.name.replace(/\s+/g, ''); return this.name.replace(/\s+/g, '');
} }
@ -355,96 +361,80 @@ var InAppNotifications = (() => {
} }
stop() {} stop() {}
load() { load() {
const a = !global.XenoLib, const a = BdApi.findModuleByProps('isModalOpen');
b = !global.ZeresPluginLibrary, if (a && a.isModalOpen(`${this.name}_DEP_MODAL`)) return;
c = (a && b) || ((a || b) && (XenoLibOutdated || ZeresPluginLibraryOutdated)) || XenoLibOutdated || ZeresPluginLibraryOutdated, const b = !global.XenoLib,
d = (() => { c = !global.ZeresPluginLibrary,
let d = ''; d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
return a || b ? (d += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (d += `Outdated `), (d += `${c ? 'Libraries' : 'Library'} `), d;
})(),
e = (() => { e = (() => {
let d = `The ${c ? 'libraries' : 'library'} `; let a = '';
return a || XenoLibOutdated ? ((d += 'XenoLib '), (b || ZeresPluginLibraryOutdated) && (d += 'and ZeresPluginLibrary ')) : (b || ZeresPluginLibraryOutdated) && (d += 'ZeresPluginLibrary '), (d += `required for ${this.name} ${c ? 'are' : 'is'} ${a || b ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (a || b ? ' and/or outdated' : 'outdated') : ''}.`), d; return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a;
})(), })(),
f = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), f = (() => {
g = BdApi.findModuleByProps('Sizes', 'Weights'), let a = `The ${d ? 'libraries' : 'library'} `;
h = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), 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;
i = () => BdApi.getCore().alert(d, `${e}<br/>Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.<br/>${b || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : ''}${a || XenoLibOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js"target="_blank">Click here to download XenoLib</a>' : ''}`); })(),
if (!f || !h || !g) return i(); g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'),
let j; h = BdApi.findModuleByProps('Sizes', 'Weights'),
const k = (() => { i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
if (!global.pluginModule || !global.BDEvents) return; j = () => BdApi.getCore().alert(e, `${f}<br/>Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.<br/>${c || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : ''}${b || XenoLibOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js"target="_blank">Click here to download XenoLib</a>' : ''}`);
if (a || XenoLibOutdated) { if (!g || !i || !h) return j();
const a = () => { class k extends BdApi.React.PureComponent {
BDEvents.off('xenolib-loaded', a), f.popWithKey(j), pluginModule.reloadPlugin(this.name);
};
return BDEvents.on('xenolib-loaded', a), () => BDEvents.off('xenolib-loaded', a);
}
const b = a => {
'ZeresPluginLibrary' !== a || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), f.popWithKey(j), pluginModule.reloadPlugin(this.name));
};
return BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b), () => (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b));
})();
class l extends BdApi.React.PureComponent {
constructor(a) { constructor(a) {
super(a), (this.state = { hasError: !1 }); super(a), (this.state = { hasError: !1 });
} }
componentDidCatch(a, b) { 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); 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() { render() {
return this.state.hasError ? null : this.props.children; return this.state.hasError ? null : this.props.children;
} }
} }
j = f.push(a => class l extends i {
BdApi.React.createElement( submitModal() {
l, this.props.onConfirm();
{ }
label: 'missing dependency modal', }
onError: () => { let m = !1;
f.popWithKey(j), i(); const n = g.push(
} a =>
},
BdApi.React.createElement( BdApi.React.createElement(
h, k,
Object.assign( {
{ label: 'missing dependency modal',
header: d, onError: () => {
children: [BdApi.React.createElement(g, { color: g.Colors.PRIMARY, children: [`${e} Please click Download Now to download ${c ? 'them' : 'it'}.`] })], g.popWithKey(n), j();
red: !1, }
confirmText: 'Download Now', },
cancelText: 'Cancel', BdApi.React.createElement(
onConfirm: () => { l,
k(); Object.assign(
const a = require('request'), {
b = require('fs'), header: e,
c = require('path'), children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })],
d = a => { red: !1,
if (!global.BDEvents) return a(); confirmText: 'Download Now',
const b = c => { cancelText: 'Cancel',
'ZeresPluginLibrary' !== c || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), a()); onConfirm: () => {
if (m) return;
m = !0;
const a = require('request'),
b = require('fs'),
c = require('path'),
d = () => {
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a ? j() : void b.writeFile(c.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), e, () => {})));
}; };
BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b); !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, e, f) => (a ? j() : void (b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d();
}, }
e = () => { },
if (!global.pluginModule || (!global.BDEvents && !global.XenoLib)) return; a
if ((global.XenoLib && !XenoLibOutdated) || !global.BDEvents) return pluginModule.reloadPlugin(this.name); )
const a = () => {
BDEvents.off('xenolib-loaded', a), pluginModule.reloadPlugin(this.name);
};
BDEvents.on('xenolib-loaded', a);
},
f = () => (global.XenoLib && !XenoLibOutdated ? e() : void a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, f) => (a ? i() : void (e(), b.writeFile(c.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), f, () => {})))));
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, e, g) => (a ? i() : void (d(f), b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), g, () => {})))) : f();
}
},
a
) )
) ),
) void 0,
`${this.name}_DEP_MODAL`
); );
} }
start() {} start() {}
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {
return 'Plugin'; return 'Plugin';