This commit is contained in:
Mirco Wittrien 2022-07-08 17:04:44 +02:00
parent 3976f2a40e
commit 86cf08fb29
3 changed files with 40 additions and 56 deletions

View File

@ -187,12 +187,13 @@
"Channel"
],
"ContextMenuTypesMap": {
"GroupDMUserContextMenu": "UserContextMenu"
"GroupDMUserContextMenu": "UserContextMenu",
"GroupDMContextMenu": "ChannelContextMenu"
},
"ContextMenuSubItemsMap": {
"ChannelContextMenu": {
"keys": ["channel"],
"items": ["useChannelFavoriteSetNickname", "useChannelGoToOriginalGuildItem", "useChannelCloneItem", "useChannelCopyLinkItem", "useChannelEditItem", "useChannelMarkAsReadItem"]
"items": ["useChannelLeaveItem", "useChannelDeleteItem", "useChannelFavoriteSetNickname", "useChannelGoToOriginalGuildItem", "useChannelCloneItem", "useChannelCopyLinkItem", "useChannelEditItem", "useChannelMarkAsReadItem"]
},
"UserContextMenu": {
"keys": ["user", "channel"],
@ -224,7 +225,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"]},
"useInviteItem": {"strings": ["CREATE_INSTANT_INVITE", "invite-people"], "lazyLoaded": true},
"Account": {"class": "accountinfo"},
"App": {"class": "app"},
"AppSkeleton": {"class": "app"},

View File

@ -2,7 +2,7 @@
* @name EditChannels
* @author DevilBro
* @authorId 278543574059057154
* @version 4.3.8
* @version 4.3.9
* @description Allows you to locally edit Channels
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "EditChannels",
"author": "DevilBro",
"version": "4.3.8",
"version": "4.3.9",
"description": "Allows you to locally edit Channels"
}
};
@ -222,45 +222,33 @@ module.exports = (_ => {
}
onChannelContextMenu (e) {
this.injectItem(e);
}
onGroupDMContextMenu (e) {
this.injectItem(e);
}
injectItem (e) {
if (e.instance.props.channel) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localchannelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_channelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => {
this.openChannelSettingsModal(e.instance.props.channel);
}
}),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
disabled: !changedChannels[e.instance.props.channel.id],
action: event => {
let remove = _ => {
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(true);
};
if (event.shiftKey) remove();
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
}
})
]
})
if (e.instance.props.channel && (e.subType == "useChannelDeleteItem" || e.subType == "useChannelLeaveItem")) {
if (e.returnvalue.length > 0) e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localchannelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_channelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => this.openChannelSettingsModal(e.instance.props.channel)
}),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
disabled: !changedChannels[e.instance.props.channel.id],
action: event => {
let remove = _ => {
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(true);
};
if (event.shiftKey) remove();
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
}
})
]
})
}));
}

View File

@ -2,7 +2,7 @@
* @name PinDMs
* @author DevilBro
* @authorId 278543574059057154
* @version 1.9.1
* @version 1.9.2
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "PinDMs",
"author": "DevilBro",
"version": "1.9.1",
"version": "1.9.2",
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
},
"changeLog": {
"added": {
"Predefined Group for Bots": ""
}
}
};
@ -259,13 +254,13 @@ module.exports = (_ => {
}
onUserContextMenu (e) {
if (e.instance.props.channel && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
}
onGroupDMContextMenu (e) {
if (e.instance.props.channel) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
if (index > -1) children.splice(index + 1, 0, this.createItem(e.instance.props.channel.id));
onChannelContextMenu (e) {
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.instance.props.channel.isGroupDM() && e.subType == "useChannelMarkAsReadItem") {
if (e.returnvalue.length > 0) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(this.createItem(e.instance.props.channel.id));
}
}