IAN v1.0.8

This commit is contained in:
1Lighty 2020-10-08 20:37:28 +02:00
parent 1005f43dd7
commit 23f120d835
2 changed files with 156 additions and 150 deletions

View File

@ -1,4 +1,10 @@
# [InAppNotifications](https://1lighty.github.io/BetterDiscordStuff/?plugin=InAppNotifications "InAppNotifications") Changelog # [InAppNotifications](https://1lighty.github.io/BetterDiscordStuff/?plugin=InAppNotifications "InAppNotifications") Changelog
### 1.0.8
- Fixed error on canary.
### 1.0.7
- Fixed not working.
### 1.0.6 ### 1.0.6
- Changed to module.exports because useless backwards incompatbile changes are the motto for BBD apparently. - Changed to module.exports because useless backwards incompatbile changes are the motto for BBD apparently.

View File

@ -41,7 +41,7 @@ module.exports = (() => {
twitter_username: '' twitter_username: ''
} }
], ],
version: '1.0.7', version: '1.0.8',
description: 'Show a notification in Discord when someone sends a message, just like on mobile.', description: 'Show a notification in Discord when someone sends a message, just like on mobile.',
github: 'https://github.com/1Lighty', github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/InAppNotifications/InAppNotifications.plugin.js' github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/InAppNotifications/InAppNotifications.plugin.js'
@ -93,7 +93,7 @@ module.exports = (() => {
{ {
title: 'Fixed', title: 'Fixed',
type: 'fixed', type: 'fixed',
items: ['Fixed not working.'] items: ['Fixed error on canary.']
} }
] ]
}; };
@ -137,7 +137,7 @@ module.exports = (() => {
XenoLib.Notifications.error(`[**${this.name}**] Failed to start! Please update it, press CTRL + R, or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 }); XenoLib.Notifications.error(`[**${this.name}**] Failed to start! Please update it, press CTRL + R, or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 });
try { try {
this.onStop(); this.onStop();
} catch (e) {} } catch (e) { }
} }
}; };
const oMESSAGE_CREATE = this.MESSAGE_CREATE.bind(this); const oMESSAGE_CREATE = this.MESSAGE_CREATE.bind(this);
@ -152,18 +152,18 @@ module.exports = (() => {
XenoLib.Notifications.error(`[**${this.name}**] Plugin is throwing errors and is in a broken state, please update it or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 }); XenoLib.Notifications.error(`[**${this.name}**] Plugin is throwing errors and is in a broken state, please update it or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 });
try { try {
this.onStop(); this.onStop();
} catch (e) {} } catch (e) { }
} }
} }
}; };
try { try {
WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`); WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) { }
} }
onStart() { onStart() {
try { try {
/* do not, under any circumstances, let this kill the plugin */ /* do not, under any circumstances, let this kill the plugin */
const CUSTOM_RULES = XenoLib._.cloneDeep(WebpackModules.getByProps('RULES', 'ALLOW_LINKS_RULES').RULES); const CUSTOM_RULES = XenoLib._.cloneDeep(WebpackModules.getByProps('RULES').RULES);
for (let rule of Object.keys(CUSTOM_RULES)) CUSTOM_RULES[rule].raw = null; for (let rule of Object.keys(CUSTOM_RULES)) CUSTOM_RULES[rule].raw = null;
for (let rule of ['paragraph', 'text', 'codeBlock', 'emoji', 'inlineCode']) CUSTOM_RULES[rule].raw = e => e.content; for (let rule of ['paragraph', 'text', 'codeBlock', 'emoji', 'inlineCode']) CUSTOM_RULES[rule].raw = e => e.content;
for (let rule of ['autolink', 'br', 'link', 'newline', 'url']) delete CUSTOM_RULES[rule]; for (let rule of ['autolink', 'br', 'link', 'newline', 'url']) delete CUSTOM_RULES[rule];
@ -359,7 +359,7 @@ module.exports = (() => {
function ansiWordBound(c) { function ansiWordBound(c) {
return ' ' === c || '\n' === c || '\r' === c || '\t' === c; return ' ' === c || '\n' === c || '\r' === c || '\t' === c;
} }
for (var i = 0; i < text.length; ) { for (var i = 0; i < text.length;) {
for (; i < text.length && !ansiWordBound(text[i]); i++); for (; i < text.length && !ansiWordBound(text[i]); i++);
words++; words++;
for (; i < text.length && ansiWordBound(text[i]); i++); for (; i < text.length && ansiWordBound(text[i]); i++);
@ -480,8 +480,8 @@ module.exports = (() => {
getDescription() { getDescription() {
return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.'; return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.';
} }
start() {} start() { }
stop() {} stop() { }
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('openModal', 'hasModalOpen'); const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return; if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
@ -536,7 +536,7 @@ module.exports = (() => {
b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => { b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
try { try {
if (b || 200 !== f.statusCode) return a.closeModal(m), i(); if (b || 200 !== f.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {}); c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => { });
} catch (b) { } catch (b) {
console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i(); console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
} }
@ -546,7 +546,7 @@ module.exports = (() => {
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => { ? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
try { try {
if (b || 200 !== g.statusCode) return a.closeModal(m), i(); if (b || 200 !== g.statusCode) return a.closeModal(m), i();
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f(); c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => { }), f();
} catch (b) { } catch (b) {
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i(); console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
} }
@ -555,7 +555,7 @@ module.exports = (() => {
} }
}, },
b, b,
{ onClose: () => {} } { onClose: () => { } }
) )
) )
); );