This commit is contained in:
Mirco Wittrien 2020-10-29 17:51:46 +01:00
parent 90b3c4dcdc
commit 41ba12d900
2 changed files with 28 additions and 9 deletions

View File

@ -13,15 +13,16 @@ module.exports = (_ => {
"info": { "info": {
"name": "EditServers", "name": "EditServers",
"author": "DevilBro", "author": "DevilBro",
"version": "2.2.4", "version": "2.2.5",
"description": "Allow you to change the icon, name and color of servers" "description": "Allow you to change the icon, name and color of servers"
}, },
"changeLog": { "changeLog": {
"fixed": { "improved": {
"Server Invites": "No longer breaks server invites of non-joined servers" "Welcome Message": "Now also changes the server name in the welcome message"
} }
} }
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} getName () {return config.info.name;}
getAuthor () {return config.info.author;} getAuthor () {return config.info.author;}
@ -60,6 +61,7 @@ module.exports = (_ => {
changeInGuildList: {value:true, inner:true, description:"Server List"}, changeInGuildList: {value:true, inner:true, description:"Server List"},
changeInGuildHeader: {value:true, inner:true, description:"Server Header"}, changeInGuildHeader: {value:true, inner:true, description:"Server Header"},
changeInGuildInvites: {value:true, inner:true, description:"Server Invites"}, changeInGuildInvites: {value:true, inner:true, description:"Server Invites"},
changeInChat: {value:true, inner:true, description:"Chat (Welcome Message, etc.)"},
changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"}, changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"},
changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"}, changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"},
changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"} changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"}
@ -83,7 +85,8 @@ module.exports = (_ => {
BlobMask: "render", BlobMask: "render",
GuildIconWrapper: "render", GuildIconWrapper: "render",
GuildIcon: "render", GuildIcon: "render",
GuildHeader: "render" GuildHeader: "render",
WelcomeArea: "default"
} }
}; };
@ -249,16 +252,16 @@ module.exports = (_ => {
let renderChildren = e.returnvalue.props.children; let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => { e.returnvalue.props.children = (...args) => {
let renderedChildren = renderChildren(...args); let renderedChildren = renderChildren(...args);
let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]}); let guildAcronym = BDFDB.ReactUtils.findChild(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]});
if (index > -1) { if (guildAcronym) {
let fontGradient = BDFDB.ObjectUtils.is(data.color2); let fontGradient = BDFDB.ObjectUtils.is(data.color2);
children[index].props.style = Object.assign({}, children[index].props.style, { guildAcronym.props.style = Object.assign({}, guildAcronym.props.style, {
background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"), background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA") color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
}); });
if (fontGradient) children[index].props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, { if (fontGradient) guildAcronym.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
gradient: BDFDB.ColorUtils.createGradient(data.color2), gradient: BDFDB.ColorUtils.createGradient(data.color2),
children: children[index].props.children children: guildAcronym.props.children
}); });
} }
return renderedChildren; return renderedChildren;
@ -345,6 +348,19 @@ module.exports = (_ => {
} }
} }
processWelcomeArea (e) {
if (e.instance.props.channel && settings.changeInChat) {
let name = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.channel.guild_id) || {}).name;
let guildName = name && BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", "titleName-3-Lp3Z"]]});
if (guildName && guildName.props && BDFDB.ArrayUtils.is(guildName.props.children)) {
for (let child of guildName.props.children) if (child && child.props && BDFDB.ArrayUtils.is(child.props.children) && child.props.children[0] == name) {
child.props.children = [(this.getGuildData(e.instance.props.channel.guild_id) || {}).name || name];
break;
}
}
}
}
getGuildData (guildId, change = true) { getGuildData (guildId, change = true) {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId); let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
if (!guild) return new BDFDB.DiscordObjects.Guild({}); if (!guild) return new BDFDB.DiscordObjects.Guild({});

View File

@ -1962,6 +1962,9 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *::before {
.bd-modal-wrapper .footer button:active { .bd-modal-wrapper .footer button:active {
background: var(--vaccentcolor-active); background: var(--vaccentcolor-active);
} }
.bd-modal-wrapper .error-link {
color: var(--bd-blue);
}
.bd-pfbtn { .bd-pfbtn {
background: var(--bd-blue); background: var(--bd-blue);