BUG v0.2.5
This commit is contained in:
parent
75440c87a4
commit
4acb339f0a
|
@ -1,4 +1,4 @@
|
||||||
//META{"name":"BetterUnavailableGuilds","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/BetterUnavailableGuilds/","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds"}*//
|
//META{"name":"BetterUnavailableGuilds","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/BetterUnavailableGuilds/","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds","authorId":"239513071272329217","invite":"NYvWdN5","donate":"https://paypal.me/lighty13"}*//
|
||||||
/*@cc_on
|
/*@cc_on
|
||||||
@if (@_jscript)
|
@if (@_jscript)
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@
|
||||||
// Put the user at ease by addressing them in the first person
|
// Put the user at ease by addressing them in the first person
|
||||||
shell.Popup('It looks like you\'ve mistakenly tried to run me directly. \n(Don\'t do that!)', 0, 'I\'m a plugin for BetterDiscord', 0x30);
|
shell.Popup('It looks like you\'ve mistakenly tried to run me directly. \n(Don\'t do that!)', 0, 'I\'m a plugin for BetterDiscord', 0x30);
|
||||||
if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) {
|
if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) {
|
||||||
shell.Popup('I\'m in the correct folder already.\nJust reload Discord with Ctrl+R.', 0, 'I\'m already installed', 0x40);
|
shell.Popup('I\'m in the correct folder already.\nJust go to settings, plugins and enable me.', 0, 'I\'m already installed', 0x40);
|
||||||
} else if (!fs.FolderExists(pathPlugins)) {
|
} else if (!fs.FolderExists(pathPlugins)) {
|
||||||
shell.Popup('I can\'t find the BetterDiscord plugins folder.\nAre you sure it\'s even installed?', 0, 'Can\'t install myself', 0x10);
|
shell.Popup('I can\'t find the BetterDiscord plugins folder.\nAre you sure it\'s even installed?', 0, 'Can\'t install myself', 0x10);
|
||||||
} else if (shell.Popup('Should I copy myself to BetterDiscord\'s plugins folder for you?', 0, 'Do you need some help?', 0x34) === 6) {
|
} else if (shell.Popup('Should I copy myself to BetterDiscord\'s plugins folder for you?', 0, 'Do you need some help?', 0x34) === 6) {
|
||||||
fs.CopyFile(pathSelf, fs.BuildPath(pathPlugins, fs.GetFileName(pathSelf)), true);
|
fs.CopyFile(pathSelf, fs.BuildPath(pathPlugins, fs.GetFileName(pathSelf)), true);
|
||||||
// Show the user where to put plugins in the future
|
// Show the user where to put plugins in the future
|
||||||
shell.Exec('explorer ' + pathPlugins);
|
shell.Exec('explorer ' + pathPlugins);
|
||||||
shell.Popup('I\'m installed!\nJust reload Discord with Ctrl+R.', 0, 'Successfully installed', 0x40);
|
shell.Popup('I\'m installed!\nJust go to settings, plugins and enable me!', 0, 'Successfully installed', 0x40);
|
||||||
}
|
}
|
||||||
WScript.Quit();
|
WScript.Quit();
|
||||||
|
|
||||||
|
@ -41,16 +41,16 @@ var BetterUnavailableGuilds = (() => {
|
||||||
twitter_username: ''
|
twitter_username: ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
version: '0.2.4',
|
version: '0.2.5',
|
||||||
description: 'Makes unavailable guilds (servers) still show in the list, and be able to drag it around.',
|
description: 'Show the icons of unavailable guilds (servers) normally. Enables interaction with unavailable/offline guilds (servers).',
|
||||||
github: 'https://github.com/1Lighty',
|
github: 'https://github.com/1Lighty',
|
||||||
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js'
|
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js'
|
||||||
},
|
},
|
||||||
changelog: [
|
changelog: [
|
||||||
{
|
{
|
||||||
title: 'sad',
|
title: 'fixes n stuff',
|
||||||
type: 'added',
|
type: 'added',
|
||||||
items: ['Fixed plugin failing to transfer data from canary to other release channels.']
|
items: ['Fixed settings menu not displaying an input', 'Removed unneeded Xenolib dependency']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
defaultConfig: [
|
defaultConfig: [
|
||||||
|
@ -78,15 +78,16 @@ var BetterUnavailableGuilds = (() => {
|
||||||
/* Build */
|
/* Build */
|
||||||
const buildPlugin = ([Plugin, Api]) => {
|
const buildPlugin = ([Plugin, Api]) => {
|
||||||
const { Utilities, WebpackModules, DiscordModules, Patcher, PluginUtilities, DiscordAPI, Settings, Toasts } = Api;
|
const { Utilities, WebpackModules, DiscordModules, Patcher, PluginUtilities, DiscordAPI, Settings, Toasts } = Api;
|
||||||
const { Dispatcher, GuildStore, React } = DiscordModules;
|
const { Dispatcher, GuildStore, React, ModalStack } = DiscordModules;
|
||||||
const GuildAvailabilityStore = WebpackModules.getByProps('unavailableGuilds');
|
const GuildAvailabilityStore = WebpackModules.getByProps('unavailableGuilds');
|
||||||
|
const _ = WebpackModules.getByProps('bindAll', 'debounce');
|
||||||
|
|
||||||
const FsModule = require('fs');
|
const FsModule = require('fs');
|
||||||
// fuck ED
|
// I would say "fuck ED", but it won't even compile on ED due to their piss poor BD/BBD support, lol
|
||||||
const pluginConfigFile = global.DataStore && !global.ED && DataStore.getPluginFile(config.info.name);
|
const pluginConfigFile = require('path').resolve(BdApi.Plugins.folder, config.info.name + '.config.json');
|
||||||
|
|
||||||
const loadData = (key, defaults) => {
|
const loadData = (key, defaults) => {
|
||||||
const cloned = XenoLib.DiscordUtils.cloneDeep(defaults);
|
const cloned = _.cloneDeep(defaults);
|
||||||
try {
|
try {
|
||||||
if (pluginConfigFile) {
|
if (pluginConfigFile) {
|
||||||
if (FsModule.existsSync(pluginConfigFile)) {
|
if (FsModule.existsSync(pluginConfigFile)) {
|
||||||
|
@ -102,33 +103,22 @@ var BetterUnavailableGuilds = (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyToClipboard = WebpackModules.getByProps('copy').copy;
|
const copyToClipboard = WebpackModules.getByProps('copy').copy; /* Possible error in future, TODO: safeguard */
|
||||||
const GuildIconWrapper = WebpackModules.getByDisplayName('GuildIconWrapper');
|
const GuildIconWrapper = WebpackModules.getByDisplayName('GuildIconWrapper');
|
||||||
const ListClassModule = WebpackModules.getByProps('listRowContent', 'listAvatar');
|
const ListClassModule = WebpackModules.getByProps('listRowContent', 'listAvatar');
|
||||||
const ListScrollerClassname = WebpackModules.getByProps('listScroller').listScroller;
|
const ListScrollerClassname = WebpackModules.getByProps('listScroller').listScroller; /* Possible error in future, TODO: safeguard */
|
||||||
const VerticalScroller = WebpackModules.getByDisplayName('VerticalScroller');
|
const VerticalScroller = WebpackModules.getByDisplayName('VerticalScroller');
|
||||||
const Clickable = WebpackModules.getByDisplayName('Clickable');
|
const Clickable = WebpackModules.getByDisplayName('Clickable');
|
||||||
|
|
||||||
|
/* TODO: proper name for the classes */
|
||||||
class GL extends React.PureComponent {
|
class GL extends React.PureComponent {
|
||||||
onClickGuild(checked, guild) {
|
|
||||||
const idx = this.state.checkedGuilds.indexOf(guild.id);
|
|
||||||
const isChecked = idx !== -1;
|
|
||||||
if (typeof checked !== 'undefined') {
|
|
||||||
if (checked && !isChecked) this.state.checkedGuilds.push(guild.id);
|
|
||||||
else if (!checked && isChecked) this.state.checkedGuilds.splice(idx, 1);
|
|
||||||
} else {
|
|
||||||
if (isChecked) this.state.checkedGuilds.splice(idx, 1);
|
|
||||||
else this.state.checkedGuilds.push(guild.id);
|
|
||||||
}
|
|
||||||
this.forceUpdate();
|
|
||||||
}
|
|
||||||
renderGuild(guild) {
|
renderGuild(guild) {
|
||||||
if (!guild) return null;
|
if (!guild) return null;
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
Clickable,
|
Clickable,
|
||||||
{
|
{
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
copyToClipboard(JSON.stringify({ id: guild.id, icon: guild.icon || undefined, name: guild.name, owner_id: guild.ownerId, joined_at: guild.joinedAt.valueOf(), default_message_notifications: guild.defaultMessageNotifications }));
|
copyToClipboard(JSON.stringify({ id: guild.id, icon: guild.icon || undefined, name: guild.name, owner_id: guild.ownerId, joined_at: guild.joinedAt.valueOf() }));
|
||||||
Toasts.success(`Copied ${guild.name}!`);
|
Toasts.success(`Copied ${guild.name}!`);
|
||||||
},
|
},
|
||||||
className: 'BUG-guild-icon'
|
className: 'BUG-guild-icon'
|
||||||
|
@ -161,7 +151,7 @@ var BetterUnavailableGuilds = (() => {
|
||||||
class TB extends DiscordModules.Textbox {
|
class TB extends DiscordModules.Textbox {
|
||||||
render() {
|
render() {
|
||||||
const ret = super.render();
|
const ret = super.render();
|
||||||
const props = ret.props.children[1].props;
|
const props = Utilities.findInReactTree(ret, e => e && e.onEnterPressed);
|
||||||
props.onKeyDown = e => {
|
props.onKeyDown = e => {
|
||||||
if (e.keyCode !== 13) return;
|
if (e.keyCode !== 13) return;
|
||||||
try {
|
try {
|
||||||
|
@ -203,10 +193,13 @@ var BetterUnavailableGuilds = (() => {
|
||||||
return class BetterUnavailableGuilds extends Plugin {
|
return class BetterUnavailableGuilds extends Plugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
XenoLib.changeName(__filename, 'BetterUnavailableGuilds');
|
try {
|
||||||
|
ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
|
||||||
|
} catch (e) {}
|
||||||
this._dispatches = ['CONNECTION_OPEN'];
|
this._dispatches = ['CONNECTION_OPEN'];
|
||||||
XenoLib.DiscordUtils.bindAll(this, ['handleGuildStoreChange', 'verifyAllServersCachedInClient', ...this._dispatches]);
|
_.bindAll(this, ['handleGuildStoreChange', 'verifyAllServersCachedInClient', ...this._dispatches]);
|
||||||
this.handleGuildStoreChange = XenoLib.DiscordUtils.throttle(this.handleGuildStoreChange, 15000 + (GLOBAL_ENV.RELEASE_CHANNEL === 'ptb' ? 2500 : GLOBAL_ENV.RELEASE_CHANNEL === 'canary' ? 5000 : 0));
|
// different timings for clients to avoid fighting over a damn config file
|
||||||
|
this.handleGuildStoreChange = _.throttle(this.handleGuildStoreChange, 15000 + (GLOBAL_ENV.RELEASE_CHANNEL === 'ptb' ? 2500 : GLOBAL_ENV.RELEASE_CHANNEL === 'canary' ? 5000 : 0));
|
||||||
}
|
}
|
||||||
onStart() {
|
onStart() {
|
||||||
this._guildRecord = loadData('data', { data: {} }).data;
|
this._guildRecord = loadData('data', { data: {} }).data;
|
||||||
|
@ -230,17 +223,14 @@ var BetterUnavailableGuilds = (() => {
|
||||||
onStop() {
|
onStop() {
|
||||||
GuildStore.removeChangeListener(this.handleGuildStoreChange);
|
GuildStore.removeChangeListener(this.handleGuildStoreChange);
|
||||||
Patcher.unpatchAll();
|
Patcher.unpatchAll();
|
||||||
|
Dispatcher._computeOrderedActionHandlers('GUILD_DELETE');
|
||||||
for (const dispatch of this._dispatches) Dispatcher.unsubscribe(dispatch, this[dispatch]);
|
for (const dispatch of this._dispatches) Dispatcher.unsubscribe(dispatch, this[dispatch]);
|
||||||
PluginUtilities.removeStyle(this.short + '-CSS');
|
PluginUtilities.removeStyle(this.short + '-CSS');
|
||||||
}
|
}
|
||||||
/* zlib uses reference to defaultSettings instead of a cloned object, which sets settings as default settings, messing everything up */
|
|
||||||
loadSettings(defaultSettings) {
|
|
||||||
return PluginUtilities.loadSettings(this.name, Utilities.deepclone(this.defaultSettings ? this.defaultSettings : defaultSettings));
|
|
||||||
}
|
|
||||||
|
|
||||||
buildSetting(data) {
|
buildSetting(data) {
|
||||||
if (data.type === 'textbox') {
|
if (data.type === 'textbox') {
|
||||||
const { name, note, type, value, onChange, id } = data;
|
const { name, note } = data;
|
||||||
const setting = new Textbox(
|
const setting = new Textbox(
|
||||||
name,
|
name,
|
||||||
note,
|
note,
|
||||||
|
@ -265,7 +255,7 @@ var BetterUnavailableGuilds = (() => {
|
||||||
Dispatcher.wait(() => {
|
Dispatcher.wait(() => {
|
||||||
this.ensureBDGuildsPreCached();
|
this.ensureBDGuildsPreCached();
|
||||||
this._verifying = true;
|
this._verifying = true;
|
||||||
const unavailable = XenoLib.DiscordUtils.cloneDeep(GuildAvailabilityStore.unavailableGuilds);
|
const unavailable = _.cloneDeep(GuildAvailabilityStore.unavailableGuilds);
|
||||||
unavailable.forEach(guildId => {
|
unavailable.forEach(guildId => {
|
||||||
if (!this.guildRecord[guildId] || GuildStore.getGuild(guildId)) return;
|
if (!this.guildRecord[guildId] || GuildStore.getGuild(guildId)) return;
|
||||||
Dispatcher.dispatch({
|
Dispatcher.dispatch({
|
||||||
|
@ -298,8 +288,8 @@ var BetterUnavailableGuilds = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureBDGuildsPreCached() {
|
ensureBDGuildsPreCached() {
|
||||||
this.guildRecord['86004744966914048'] = { id: '86004744966914048', icon: '292e7f6bfff2b71dfd13e508a859aedd', name: 'BetterDiscord', owner_id: '81388395867156480', joined_at: Date.now(), default_message_notifications: 1 };
|
this.guildRecord['86004744966914048'] = { id: '86004744966914048', icon: '292e7f6bfff2b71dfd13e508a859aedd', name: 'BetterDiscord', owner_id: '81388395867156480', joined_at: Date.now() };
|
||||||
this.guildRecord['280806472928198656'] = { id: '280806472928198656', icon: 'cbdda04c041699d80689b99c4e5e89dc', name: 'BetterDiscord2', owner_id: '81388395867156480', joined_at: Date.now(), default_message_notifications: 1 };
|
this.guildRecord['280806472928198656'] = { id: '280806472928198656', icon: 'cbdda04c041699d80689b99c4e5e89dc', name: 'BetterDiscord2', owner_id: '81388395867156480', joined_at: Date.now() };
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureDataSettable() {
|
ensureDataSettable() {
|
||||||
|
@ -307,9 +297,9 @@ var BetterUnavailableGuilds = (() => {
|
||||||
if (!this._guildRecord[DiscordAPI.currentUser.id][GLOBAL_ENV.RELEASE_CHANNEL]) {
|
if (!this._guildRecord[DiscordAPI.currentUser.id][GLOBAL_ENV.RELEASE_CHANNEL]) {
|
||||||
const curUserShit = this._guildRecord[DiscordAPI.currentUser.id];
|
const curUserShit = this._guildRecord[DiscordAPI.currentUser.id];
|
||||||
/* transfer the data */
|
/* transfer the data */
|
||||||
if (curUserShit['stable']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = XenoLib.DiscordUtils.cloneDeep(curUserShit['stable']);
|
if (curUserShit['stable']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = _.cloneDeep(curUserShit['stable']);
|
||||||
else if (curUserShit['ptb']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = XenoLib.DiscordUtils.cloneDeep(curUserShit['ptb']);
|
else if (curUserShit['ptb']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = _.cloneDeep(curUserShit['ptb']);
|
||||||
else if (curUserShit['canary']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = XenoLib.DiscordUtils.cloneDeep(curUserShit['canary']);
|
else if (curUserShit['canary']) curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = _.cloneDeep(curUserShit['canary']);
|
||||||
else curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = {};
|
else curUserShit[GLOBAL_ENV.RELEASE_CHANNEL] = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,15 +323,13 @@ var BetterUnavailableGuilds = (() => {
|
||||||
icon: guild.icon || undefined,
|
icon: guild.icon || undefined,
|
||||||
name: guild.name,
|
name: guild.name,
|
||||||
owner_id: guild.ownerId,
|
owner_id: guild.ownerId,
|
||||||
joined_at: guild.joinedAt.valueOf() /* int value is fine too */,
|
joined_at: guild.joinedAt.valueOf() /* int value is fine too */
|
||||||
/* useless info? */
|
|
||||||
default_message_notifications: guild.defaultMessageNotifications
|
|
||||||
}));
|
}));
|
||||||
let guilds = {};
|
let guilds = {};
|
||||||
GuildAvailabilityStore.unavailableGuilds.forEach(id => this.guildRecord[id] && (guilds[id] = this.guildRecord[id]));
|
GuildAvailabilityStore.unavailableGuilds.forEach(id => this.guildRecord[id] && (guilds[id] = this.guildRecord[id]));
|
||||||
availableGuilds.forEach(guild => (guilds[guild.id] = guild));
|
availableGuilds.forEach(guild => (guilds[guild.id] = guild));
|
||||||
for (const guildId in guilds) guilds[guildId] = XenoLib.DiscordUtils.pickBy(guilds[guildId], e => !XenoLib.DiscordUtils.isUndefined(e));
|
for (const guildId in guilds) guilds[guildId] = _.pickBy(guilds[guildId], e => !_.isUndefined(e));
|
||||||
if (!XenoLib.DiscordUtils.isEqual(this.guildRecord, guilds)) {
|
if (!_.isEqual(this.guildRecord, guilds)) {
|
||||||
this.guildRecord = guilds;
|
this.guildRecord = guilds;
|
||||||
PluginUtilities.saveData(this.name, 'data', { data: this._guildRecord });
|
PluginUtilities.saveData(this.name, 'data', { data: this._guildRecord });
|
||||||
}
|
}
|
||||||
|
@ -353,40 +341,42 @@ var BetterUnavailableGuilds = (() => {
|
||||||
Utilities.suppressErrors(this.patchGuildDelete.bind(this), 'GUILD_DELETE dispatch patch')();
|
Utilities.suppressErrors(this.patchGuildDelete.bind(this), 'GUILD_DELETE dispatch patch')();
|
||||||
}
|
}
|
||||||
|
|
||||||
async patchGuildDelete() {
|
patchGuildDelete() {
|
||||||
const GUILD_DELETE = Dispatcher._computeOrderedActionHandlers('GUILD_DELETE');
|
// super sekret (not really) V3/rewrite patch code
|
||||||
GUILD_DELETE.forEach(handler => {
|
for (const id in Dispatcher._dependencyGraph.nodes) {
|
||||||
Patcher.instead(handler, 'actionHandler', (_, [dispatch], orig) => {
|
const node = Dispatcher._dependencyGraph.nodes[id];
|
||||||
if (!dispatch.guild.unavailable) return orig(dispatch);
|
if (typeof node.actionHandler !== 'function' && !node.actionHandler['GUILD_DELETE']) continue;
|
||||||
});
|
if (typeof node.actionHandler === 'function') {
|
||||||
});
|
Patcher.instead(node, 'actionHandler', (_, [dispatch], orig) => {
|
||||||
|
if (!dispatch.guild.unavailable) return orig(dispatch);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Patcher.instead(node.actionHandler, 'GUILD_DELETE', (_, [dispatch], orig) => {
|
||||||
|
if (!dispatch.guild.unavailable) return orig(dispatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Dispatcher._computeOrderedActionHandlers('GUILD_DELETE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PATCHES */
|
/* PATCHES */
|
||||||
|
|
||||||
getSettingsPanel() {
|
getSettingsPanel() {
|
||||||
const panel = this.buildSettingsPanel();
|
return this.buildSettingsPanel().getElement();
|
||||||
panel.addListener(() => ReactTools.getOwnerInstance(document.getElementById('TooltipPreview')).forceUpdate());
|
|
||||||
return panel.getElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get [Symbol.toStringTag]() {
|
get [Symbol.toStringTag]() {
|
||||||
return 'Plugin';
|
return 'Plugin';
|
||||||
}
|
}
|
||||||
get css() {
|
|
||||||
return this._css;
|
|
||||||
}
|
|
||||||
get name() {
|
get name() {
|
||||||
return config.info.name;
|
return config.info.name;
|
||||||
}
|
}
|
||||||
get short() {
|
get short() {
|
||||||
let string = '';
|
let string = '';
|
||||||
|
|
||||||
for (let i = 0, len = config.info.name.length; i < len; i++) {
|
for (let i = 0, len = config.info.name.length; i < len; i++) {
|
||||||
const char = config.info.name[i];
|
const char = config.info.name[i];
|
||||||
if (char === char.toUpperCase()) string += char;
|
if (char === char.toUpperCase()) string += char;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
get author() {
|
get author() {
|
||||||
|
@ -404,23 +394,20 @@ var BetterUnavailableGuilds = (() => {
|
||||||
/* Finalize */
|
/* Finalize */
|
||||||
|
|
||||||
let ZeresPluginLibraryOutdated = false;
|
let ZeresPluginLibraryOutdated = false;
|
||||||
let XenoLibOutdated = false;
|
|
||||||
try {
|
try {
|
||||||
if (global.BdApi && 'function' == typeof BdApi.getPlugin) {
|
if (global.BdApi && 'function' == typeof BdApi.getPlugin) {
|
||||||
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 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]),
|
||||||
n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e),
|
b = BdApi.getPlugin('ZeresPluginLibrary');
|
||||||
e = BdApi.getPlugin('ZeresPluginLibrary'),
|
((b, c) => b && b._config && b._config.info && b._config.info.version && a(b._config.info.version, c))(b, '1.2.15') && (ZeresPluginLibraryOutdated = !0);
|
||||||
o = BdApi.getPlugin('XenoLib');
|
|
||||||
n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.17') && (XenoLibOutdated = !0);
|
|
||||||
}
|
}
|
||||||
} catch (i) {
|
} catch (e) {
|
||||||
console.error('Error checking if libraries are out of date', i);
|
console.error('Error checking if ZeresPluginLibrary is out of date', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated
|
return !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
|
||||||
? class {
|
? class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._XL_PLUGIN = true;
|
this._config = config;
|
||||||
this.start = this.load = this.handleMissingLib;
|
this.start = this.load = this.handleMissingLib;
|
||||||
}
|
}
|
||||||
getName() {
|
getName() {
|
||||||
|
@ -433,29 +420,21 @@ var BetterUnavailableGuilds = (() => {
|
||||||
return this.version;
|
return this.version;
|
||||||
}
|
}
|
||||||
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 ZeresPluginLibrary for this plugin, please enable the plugin and click Download Now.';
|
||||||
}
|
}
|
||||||
stop() {}
|
stop() {}
|
||||||
handleMissingLib() {
|
handleMissingLib() {
|
||||||
const a = BdApi.findModuleByProps('isModalOpenWithKey');
|
const a = BdApi.findModuleByProps('isModalOpenWithKey');
|
||||||
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return;
|
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return;
|
||||||
const b = !global.XenoLib,
|
const b = !global.ZeresPluginLibrary,
|
||||||
c = !global.ZeresPluginLibrary,
|
c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library',
|
||||||
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
|
d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`,
|
||||||
e = (() => {
|
e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'),
|
||||||
let a = '';
|
f = BdApi.findModuleByDisplayName('Text'),
|
||||||
return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a;
|
g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
|
||||||
})(),
|
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));
|
||||||
f = (() => {
|
if (!e || !g || !f) return h();
|
||||||
let a = `The ${d ? 'libraries' : 'library'} `;
|
class i extends BdApi.React.PureComponent {
|
||||||
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'),
|
|
||||||
h = BdApi.findModuleByDisplayName('Text'),
|
|
||||||
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
|
|
||||||
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 (!g || !i || !h) return j();
|
|
||||||
class k extends BdApi.React.PureComponent {
|
|
||||||
constructor(a) {
|
constructor(a) {
|
||||||
super(a), (this.state = { hasError: !1 });
|
super(a), (this.state = { hasError: !1 });
|
||||||
}
|
}
|
||||||
|
@ -466,41 +445,38 @@ var BetterUnavailableGuilds = (() => {
|
||||||
return this.state.hasError ? null : this.props.children;
|
return this.state.hasError ? null : this.props.children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class l extends i {
|
class j extends g {
|
||||||
submitModal() {
|
submitModal() {
|
||||||
this.props.onConfirm();
|
this.props.onConfirm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let m = !1;
|
let k = !1;
|
||||||
const n = g.push(
|
const l = e.push(
|
||||||
a =>
|
a =>
|
||||||
BdApi.React.createElement(
|
BdApi.React.createElement(
|
||||||
k,
|
i,
|
||||||
{
|
{
|
||||||
label: 'missing dependency modal',
|
label: 'missing dependency modal',
|
||||||
onError: () => {
|
onError: () => {
|
||||||
g.popWithKey(n), j();
|
e.popWithKey(l), h();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BdApi.React.createElement(
|
BdApi.React.createElement(
|
||||||
l,
|
j,
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{
|
{
|
||||||
header: e,
|
header: c,
|
||||||
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })],
|
children: [BdApi.React.createElement(f, { size: f.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',
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
if (m) return;
|
if (k) return;
|
||||||
m = !0;
|
k = !0;
|
||||||
const a = require('request'),
|
const a = require('request'),
|
||||||
b = require('fs'),
|
b = require('fs'),
|
||||||
c = require('path'),
|
c = require('path');
|
||||||
d = () => {
|
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, () => {})));
|
||||||
(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, () => {})));
|
|
||||||
};
|
|
||||||
!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
|
a
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
# [BetterUnavailableGuilds](https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds "BetterUnavailableGuilds") Changelog
|
# [BetterUnavailableGuilds](https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds "BetterUnavailableGuilds") Changelog
|
||||||
|
### 0.2.5
|
||||||
|
- Fixed settings menu not displaying an input
|
||||||
|
- Removed unneeded Xenolib dependency
|
||||||
|
|
||||||
### 0.2.4
|
### 0.2.4
|
||||||
- Fixed plugin failing to transfer data from canary to other release channels
|
- Fixed plugin failing to transfer data from canary to other release channels
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# BetterUnavailableGuilds [![download](https://i.imgur.com/OAHgjZu.png)](https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds&dl=1 "BetterUnavailableGuilds")
|
# BetterUnavailableGuilds [![download](https://i.imgur.com/OAHgjZu.png)](https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterUnavailableGuilds&dl=1 "BetterUnavailableGuilds")
|
||||||
Makes unavailable guilds (servers) still show in the list, and be able to drag it around/interact with it.
|
Show the icons of unavailable guilds (servers) normally. Enables interaction with unavailable/offline guilds (servers).
|
||||||
### Features
|
### Features
|
||||||
Whenever BetterDiscord, BetterDiscord2 and some other servers go unavailable, they are removed from your sidebar, even your folder, and shown as ! all the way at the bottom, which is annoying.
|
Whenever BetterDiscord, BetterDiscord2 and some other servers go unavailable, they are removed from your sidebar, even your folder, and shown as ! all the way at the bottom, which is annoying.
|
||||||
This plugin simply fixes that, so the server stays in the sidebar and you can move it around/interact with it, you just can't view anything inside it.
|
This plugin simply fixes that, so the server stays in the sidebar and you can move it around/interact with it, you just can't view anything inside it.
|
||||||
|
|
|
@ -15,7 +15,7 @@ Move between images in the entire channel with arrow keys, image zoom enabled by
|
||||||
Replaces "Several people are typing" with who is actually typing, plus "x others" if it can't fit. Number of shown people typing can be changed.
|
Replaces "Several people are typing" with who is actually typing, plus "x others" if it can't fit. Number of shown people typing can be changed.
|
||||||
|
|
||||||
## [BetterUnavailableGuilds](https://github.com/1Lighty/BetterDiscordPlugins/tree/master/Plugins/BetterUnavailableGuilds "BetterUnavailableGuilds")
|
## [BetterUnavailableGuilds](https://github.com/1Lighty/BetterDiscordPlugins/tree/master/Plugins/BetterUnavailableGuilds "BetterUnavailableGuilds")
|
||||||
Makes unavailable guilds (servers) still show in the list, and be able to drag it around/interact with it.
|
Show the icons of unavailable guilds (servers) normally. Enables interaction with unavailable/offline guilds (servers).
|
||||||
|
|
||||||
## [CrashRecovery](https://github.com/1Lighty/BetterDiscordPlugins/tree/master/Plugins/CrashRecovery "CrashRecovery")
|
## [CrashRecovery](https://github.com/1Lighty/BetterDiscordPlugins/tree/master/Plugins/CrashRecovery "CrashRecovery")
|
||||||
In the event that your Discord crashes, the plugin enables you to get Discord back to a working state, without needing to reload at all.
|
In the event that your Discord crashes, the plugin enables you to get Discord back to a working state, without needing to reload at all.
|
||||||
|
|
Loading…
Reference in New Issue