This commit is contained in:
Mirco Wittrien 2021-04-09 18:13:38 +02:00
parent a55dfd87e0
commit a005a0811c
6 changed files with 23 additions and 21 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 1.5.3
* @version 1.5.4
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -22,7 +22,7 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "1.5.3",
"version": "1.5.4",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`
@ -2043,7 +2043,8 @@ module.exports = (_ => {
const pluginName = typeof plugin === "string" ? plugin : plugin.name;
const pluginVersion = typeof plugin === "string" ? "" : plugin.version;
const pluginId = pluginName.toLowerCase();
const patchPriority = BDFDB.ObjectUtils.is(plugin) && !isNaN(plugin.patchPriority) ? (plugin.patchPriority < 0 ? 0 : (plugin.patchPriority > 10 ? 10 : Math.round(plugin.patchPriority))) : 5;
let patchPriority = !isNaN(config.priority) ? config.priority : (BDFDB.ObjectUtils.is(plugin) && !isNaN(plugin.patchPriority) ? plugin.patchPriority : 5);
patchPriority = patchPriority < 1 ? (plugin == InternalBDFDB ? 0 : 1) : (patchPriority > 9 ? (plugin == InternalBDFDB ? 10 : 9) : Math.round(patchPriority));
if (!BDFDB.ObjectUtils.is(module.BDFDB_patches)) module.BDFDB_patches = {};
methodNames = [methodNames].flat(10).filter(n => n);
let cancel = _ => {BDFDB.PatchUtils.unpatch(plugin, module, methodNames);};
@ -7868,6 +7869,13 @@ module.exports = (_ => {
}}, {noCache: true});
}});
BDFDB.PatchUtils.patch(BDFDB, (BDFDB.ModuleUtils.findByName("useCopyIdItem", false) || {}).exports, "default", {after: e => {
if (!e.returnValue) e.returnValue = false;
}}, {priority: 10});
BDFDB.PatchUtils.patch(BDFDB, (BDFDB.ModuleUtils.findByName("DeveloperContextMenu", false) || {}).exports, "default", {after: e => {
if (!e.returnValue.props.children) LibraryModules.ContextMenuUtils.closeContextMenu();
}}, {priority: 10});
InternalBDFDB.onSettingsClosed = function () {
if (InternalBDFDB.SettingsUpdated) {
delete InternalBDFDB.SettingsUpdated;

View File

@ -74,7 +74,7 @@ module.exports = (_ => {
}
};
this.patchPriority = 10;
this.patchPriority = 9;
this.patchedModules = {
after: {

View File

@ -2,7 +2,7 @@
* @name EditRoles
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.1
* @version 1.0.2
* @description Allows you to locally edit Roles
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "EditRoles",
"author": "DevilBro",
"version": "1.0.1",
"version": "1.0.2",
"description": "Allows you to locally edit Roles"
}
};
@ -60,13 +60,12 @@ module.exports = (_ => {
return template.content.firstElementChild;
}
} : (([Plugin, BDFDB]) => {
var changedRoles = {}, cachedDevMode;
var changedRoles = {};
return class EditRoles extends Plugin {
onLoad () {
this.patchedModules = {
before: {
DeveloperContextMenu: "default",
MemberListItem: "render",
UserPopout: "render",
ChannelMembers: "render"
@ -141,7 +140,7 @@ module.exports = (_ => {
}
onDeveloperContextMenu (e) {
let guild = BDFDB.LibraryModules.FolderStore.getFlattenedGuilds().find(g => g.roles[e.instance.props.id]);
let guild = this.getGuildFromRoleId(e.instance.props.id);
if (guild) e.returnvalue.props.children = [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
@ -153,8 +152,6 @@ module.exports = (_ => {
label: this.labels.submenu_rolesettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => {
BDFDB.LibraryModules.SettingsUtils.updateLocalSettings({"developerMode": cachedDevMode})
cachedDevMode = null;
this.openRoleSettingsModal(guild.roles[e.instance.props.id]);
}
}),
@ -164,8 +161,6 @@ module.exports = (_ => {
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
disabled: !changedRoles[e.instance.props.id],
action: event => {
BDFDB.LibraryModules.SettingsUtils.updateLocalSettings({"developerMode": cachedDevMode})
cachedDevMode = null;
let remove = _ => {
BDFDB.DataUtils.remove(this, "roles", e.instance.props.id);
this.forceUpdateAll(true);
@ -182,11 +177,6 @@ module.exports = (_ => {
].flat(10).filter(n => n);
}
processDeveloperContextMenu (e) {
cachedDevMode = BDFDB.LibraryModules.SettingsStore.developerMode;
BDFDB.LibraryModules.SettingsUtils.updateLocalSettings({"developerMode": true})
}
processMemberListItem (e) {
if (e.instance.props.user) {
let member = BDFDB.LibraryModules.MemberStore.getMember(e.instance.props.guildId, e.instance.props.user.id);
@ -211,6 +201,10 @@ module.exports = (_ => {
}
}
getGuildFromRoleId (roleId) {
return BDFDB.LibraryModules.FolderStore.getFlattenedGuilds().find(g => g.roles[roleId]);
}
changeRolesInGuild (guild) {
let changed = false, roles = Object.assign({}, guild.roles);
for (let id in guild.roles) {

View File

@ -76,7 +76,7 @@ module.exports = (_ => {
}
};
this.patchPriority = 10;
this.patchPriority = 9;
}
onStart () {

View File

@ -197,7 +197,7 @@ module.exports = (_ => {
}
};
this.patchPriority = 10;
this.patchPriority = 9;
}
onStart () {

View File

@ -190,7 +190,7 @@ module.exports = (_ => {
}
};
this.patchPriority = 10;
this.patchPriority = 9;
this.css = `
${BDFDB.dotCNS._serverdetailstooltip + BDFDB.dotCN.tooltipcontent} {