This commit is contained in:
Mirco Wittrien 2022-07-07 17:46:42 +02:00
parent b470b2fd9d
commit 7305675a31
2 changed files with 19 additions and 33 deletions

View File

@ -190,6 +190,10 @@
"GroupDMUserContextMenu": "UserContextMenu"
},
"ContextMenuSubItemsMap": {
"ChannelContextMenu": {
"keys": ["channel"],
"items": ["useChannelFavoriteSetNickname", "useChannelGoToOriginalGuildItem", "useChannelCloneItem", "useChannelCopyLinkItem", "useChannelEditItem", "useChannelMarkAsReadItem"]
},
"UserContextMenu": {
"keys": ["user", "channel"],
"items": ["useHideNoVideoParticipantsItem", "useHideSelfVideoItem", "usePreviewVideoItem", "useChangeIdentityItem", "useMoveToAudienceItem", "useAddFriendNicknameItem", "useAddNoteItem", "useBlockUserItem", "useUserRelationshipItems", "useUserManagementItems", "useMoveUserVoiceItems", "useCallUserItem", "useFocusVideoItem", "useInviteUserToGuildItems", "useMentionUserItem", "useMessageUserItem", "useUserProfileItem", "useUserRolesItems", "useUserVolumeItem", "useWatchStreamItem", "useCloseDMItem", "useMuteChannelItem"]
@ -220,6 +224,7 @@
"useMuteChannelItem": {"strings": ["DM", "MenuItem", "Messages.MUTE_CHANNEL"], "lazyLoaded": true},
"useUserManagementItems": {"strings": ["canManageUser", "MenuItem", "Messages.BAN_USER"], "lazyLoaded": true},
"useUserRelationshipItems": {"strings": ["ContextMenu", "isFriend", "addRelationship", "Messages.REMOVE_FRIEND"], "lazyLoaded": true},
"useInviteItem": {"strings": ["CREATE_INSTANT_INVITE", "invite-people"]},
"Account": {"class": "accountinfo"},
"App": {"class": "app"},
"AppSkeleton": {"class": "app"},

View File

@ -2,7 +2,7 @@
* @name ShowHiddenChannels
* @author DevilBro
* @authorId 278543574059057154
* @version 3.2.2
* @version 3.2.3
* @description Displays all hidden Channels, which can't be accessed due to Role Restrictions, this won't allow you to read them (impossible)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "ShowHiddenChannels",
"author": "DevilBro",
"version": "3.2.2",
"version": "3.2.3",
"description": "Displays all hidden Channels, which can't be accessed due to Role Restrictions, this won't allow you to read them (impossible)"
}
};
@ -202,6 +202,7 @@ module.exports = (_ => {
VoiceUsers: "render"
},
after: {
useInviteItem: "default",
ChannelItem: "default"
}
};
@ -330,41 +331,17 @@ module.exports = (_ => {
onChannelContextMenu (e) {
if (e.instance.props.channel) {
if (e.instance.props.channel.id.endsWith("hidden") && e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ChannelMuteItem"});
if (index > -1) children.splice(index, 1);
[children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-channel-read", group: true});
children.splice(index > -1 ? index + 1 : 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_changeorder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "change_order"),
children: Object.keys(sortOrders).filter(n => sortOrders[n].value != sortOrders.EXTRA.value).map(n => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels["context_changeorder_" + sortOrders[n].value],
id: BDFDB.ContextMenuUtils.createItemId(this.name, "change_order", sortOrders[n].value),
action: _ => {
this.settings.sortOrder.hidden = sortOrders[n].value;
BDFDB.DataUtils.save(this.settings.sortOrder, this, "sortOrder");
this.forceUpdateAll();
}
})
}))
})
}));
}
let isHidden = this.isChannelHidden(e.instance.props.channel.id);
if (isHidden) {
if (e.subType == "useChannelMarkAsReadItem" && (isHidden || this.settings.general.showForNormal)) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "invite-people"});
if (index > -1) children.splice(index, 1);
}
if (isHidden || this.settings.general.showForNormal) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-channel-read", group: true});
children.splice(index > -1 ? index + 1 : 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_channelaccess,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "permissions"),
action: _ => this.openAccessModal(e.instance.props.channel, !isHidden)
})
if (e.subType == "useChannelMarkAsReadItem" && (isHidden || this.settings.general.showForNormal)) {
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_channelaccess,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "permissions"),
action: _ => this.openAccessModal(e.instance.props.channel, !isHidden)
}));
}
}
@ -393,6 +370,10 @@ module.exports = (_ => {
this.onGuildContextMenu(e);
}
processUseInviteItem (e) {
if (e.instance.props.channel && this.isChannelHidden(e.instance.props.channel.id)) return null;
}
processChannels (e) {
if (!e.instance.props.guild || e.instance.props.guild.id.length < 16) return;
let show = !blackList.includes(e.instance.props.guild.id), sortAtBottom = this.settings.sortOrder.hidden == sortOrders.BOTTOM.value;