Update EditChannels.plugin.js
This commit is contained in:
parent
089d154efc
commit
2b206e5476
|
@ -2,7 +2,7 @@
|
||||||
* @name EditChannels
|
* @name EditChannels
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 4.2.9
|
* @version 4.3.0
|
||||||
* @description Allows you to locally edit Channels
|
* @description Allows you to locally edit Channels
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,12 +17,13 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "EditChannels",
|
"name": "EditChannels",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "4.2.9",
|
"version": "4.3.0",
|
||||||
"description": "Allows you to locally edit Channels"
|
"description": "Allows you to locally edit Channels"
|
||||||
},
|
},
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
"fixed": {
|
"fixed": {
|
||||||
"Group DMs": "Fixed some stuff in Group DMs"
|
"Group DMs": "Fixed some stuff in Group DMs",
|
||||||
|
"Show Hidden Channels": "Fixed some Issues with the fake category created by ShowHiddenChannels"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -338,7 +339,7 @@ module.exports = (_ => {
|
||||||
let change, channelId, nameClass, categoyClass, iconClass, modify = {};
|
let change, channelId, nameClass, categoyClass, iconClass, modify = {};
|
||||||
if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) {
|
if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) {
|
||||||
change = true;
|
change = true;
|
||||||
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("_").pop();
|
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("___").pop();
|
||||||
nameClass = BDFDB.disCN.categoryname;
|
nameClass = BDFDB.disCN.categoryname;
|
||||||
iconClass = BDFDB.disCN.categoryicon;
|
iconClass = BDFDB.disCN.categoryicon;
|
||||||
modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
||||||
|
@ -374,12 +375,12 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processChannelCategoryItem (e) {
|
processChannelCategoryItem (e) {
|
||||||
if (e.instance.props.channel && this.settings.places.channelList) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
if (e.instance.props.channel && this.settings.places.channelList) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id, true, e.instance.props.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
processChannelItem (e) {
|
processChannelItem (e) {
|
||||||
if (e.instance.props.channel && this.settings.places.channelList) {
|
if (e.instance.props.channel && this.settings.places.channelList) {
|
||||||
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id, true, e.instance.props.channel);
|
||||||
else {
|
else {
|
||||||
let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
|
let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
|
||||||
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelnameinner]]});
|
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelnameinner]]});
|
||||||
|
@ -624,20 +625,17 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
getChannelDataColor (channelId) {
|
getChannelDataColor (channelId) {
|
||||||
|
if (!changedChannels[channelId]) return null;
|
||||||
|
if (changedChannels[channelId].color) return changedChannels[channelId].color;
|
||||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||||
if (!channel) return null;
|
let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
||||||
let channelData = changedChannels[channel.id];
|
if (category && changedChannels[category.id] && changedChannels[category.id].inheritColor && changedChannels[category.id].color) return changedChannels[category.id].color;
|
||||||
if (channelData && channelData.color) return channelData.color;
|
|
||||||
let category = channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
|
||||||
if (category) {
|
|
||||||
let categoryData = changedChannels[category.id];
|
|
||||||
if (categoryData && categoryData.inheritColor && categoryData.color) return categoryData.color;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getChannelData (channelId, change = true) {
|
getChannelData (channelId, change = true, fallbackData) {
|
||||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||||
|
if (!channel && BDFDB.ObjectUtils.is(fallbackData) || channel && BDFDB.ObjectUtils.is(fallbackData) && channel.name != fallbackData.name) channel = fallbackData;
|
||||||
if (!channel) return new BDFDB.DiscordObjects.Channel({});
|
if (!channel) return new BDFDB.DiscordObjects.Channel({});
|
||||||
let data = change && changedChannels[channel.id];
|
let data = change && changedChannels[channel.id];
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
Loading…
Reference in New Issue