stuff
This commit is contained in:
parent
2636a7d7bb
commit
037269e600
|
@ -65,25 +65,28 @@ module.exports = (_ => {
|
|||
return template.content.firstElementChild;
|
||||
}
|
||||
} : (([Plugin, BDFDB]) => {
|
||||
var changedChannels = {}, settings = {};
|
||||
var changedChannels = {};
|
||||
|
||||
return class EditChannels extends Plugin {
|
||||
onLoad () {
|
||||
this.defaults = {
|
||||
settings: {
|
||||
changeChannelIcon: {value: true, inner: false, description: "Change color of Channel Icon"},
|
||||
changeInChatTextarea: {value: true, inner: true, description: "Chat Textarea"},
|
||||
changeInMentions: {value: true, inner: true, description: "Mentions"},
|
||||
changeInChannelList: {value: true, inner: true, description: "Channel/Group List"},
|
||||
changeInChannelHeader: {value: true, inner: true, description: "Channel/Group Header"},
|
||||
changeInRecentDms: {value: true, inner: true, description: "Group Notifications"},
|
||||
changeInRecentMentions: {value: true, inner: true, description: "Recent Mentions Popout"},
|
||||
changeInAutoComplete: {value: true, inner: true, description: "Autocomplete Menu"},
|
||||
changeInAuditLog: {value: true, inner: true, description: "Audit Log"},
|
||||
changeInInviteLog: {value: true, inner: true, description: "Invite Log"},
|
||||
changeInQuickSwitcher: {value: true, inner: true, description: "Quick Switcher"},
|
||||
changeInSearchResults: {value: true, inner: true, description: "Search Results"},
|
||||
changeInSearchPopout: {value: true, inner: true, description: "Search Popout"}
|
||||
general: {
|
||||
changeChannelIcon: {value: true, description: "Change Color of Channel Icon"}
|
||||
},
|
||||
places: {
|
||||
chatTextarea: {value: true, description: "Chat Textarea"},
|
||||
mentions: {value: true, description: "Mentions"},
|
||||
channelList: {value: true, description: "Channel/Group List"},
|
||||
channelHeader: {value: true, description: "Channel/Group Header"},
|
||||
recentDms: {value: true, description: "Group Notifications"},
|
||||
recentMentions: {value: true, description: "Recent Mentions Popout"},
|
||||
autocompletes: {value: true, description: "Autocomplete Menu"},
|
||||
auditLog: {value: true, description: "Audit Log"},
|
||||
inviteLog: {value: true, description: "Invite Log"},
|
||||
quickSwitcher: {value: true, description: "Quick Switcher"},
|
||||
searchResults: {value: true, description: "Search Results"},
|
||||
searchPopout: {value: true, description: "Search Popout"},
|
||||
appTitle: {value: true, description: "Discord App Title (Channels)"}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -125,6 +128,20 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
// REMOVE 16.05.2021
|
||||
let oldData = BDFDB.DataUtils.load(this);
|
||||
if (oldData.settings) {
|
||||
this.settings.general = BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == -1, true);
|
||||
this.settings.places = Object.entries(BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == 0, true)).reduce((n, p) => {
|
||||
let k = p[0].replace("changeIn", "");
|
||||
n[k[0].toLowerCase() + k.slice(1)] = p[1];
|
||||
return n;
|
||||
}, {});
|
||||
BDFDB.DataUtils.save(this.settings.general, this, "general");
|
||||
BDFDB.DataUtils.save(this.settings.places, this, "places");
|
||||
BDFDB.DataUtils.remove(this, "settings");
|
||||
}
|
||||
|
||||
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
||||
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
|
||||
|
||||
|
@ -154,39 +171,45 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getSettingsPanel (collapseStates = {}) {
|
||||
let settingsPanel, settingsItems = [];
|
||||
|
||||
for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Change Channels in:",
|
||||
children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}))
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
||||
type: "Button",
|
||||
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
||||
label: "Reset all Channels",
|
||||
onClick: _ => {
|
||||
BDFDB.ModalUtils.confirm(this, this.labels.confirm_resetall, _ => {
|
||||
BDFDB.DataUtils.remove(this, "channels");
|
||||
this.forceUpdateAll();
|
||||
});
|
||||
},
|
||||
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
||||
}));
|
||||
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
||||
let settingsPanel;
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
|
||||
collapseStates: collapseStates,
|
||||
children: _ => {
|
||||
let settingsItems = [];
|
||||
|
||||
settingsItems.push(Object.keys(this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["general", key],
|
||||
label: this.defaults.general[key].description,
|
||||
value: this.settings.general[key]
|
||||
})));
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Change Channels in:",
|
||||
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["places", key],
|
||||
label: this.defaults.places[key].description,
|
||||
value: this.settings.places[key]
|
||||
}))
|
||||
}));
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
||||
type: "Button",
|
||||
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
||||
label: "Reset all Channels",
|
||||
onClick: _ => BDFDB.ModalUtils.confirm(this, this.labels.confirm_resetall, _ => {
|
||||
BDFDB.DataUtils.remove(this, "channels");
|
||||
this.forceUpdateAll();;
|
||||
}),
|
||||
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
||||
}));
|
||||
|
||||
return settingsItems;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onSettingsClosed () {
|
||||
|
@ -198,7 +221,6 @@ module.exports = (_ => {
|
|||
|
||||
forceUpdateAll (instant = false) {
|
||||
changedChannels = BDFDB.DataUtils.load(this, "channels");
|
||||
settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
||||
this.changeAppTitle();
|
||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||
|
@ -252,14 +274,14 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && settings.changeInChatTextarea) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && this.settings.places.chatTextarea) {
|
||||
let data = changedChannels[e.instance.props.channel.id];
|
||||
e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${data && data.name || e.instance.props.channel.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
processAutocompleteChannelResult (e) {
|
||||
if (e.instance.props.channel && settings.changeInAutoComplete) {
|
||||
if (e.instance.props.channel && this.settings.places.autocompletes) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
||||
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
|
||||
|
@ -279,7 +301,7 @@ module.exports = (_ => {
|
|||
|
||||
processAuditLog (e) {
|
||||
let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
|
||||
if (channel && settings.changeInAuditLog) {
|
||||
if (channel && this.settings.places.auditLog) {
|
||||
if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
|
||||
else {
|
||||
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["children", [["#" + channel.name]]]]});
|
||||
|
@ -289,7 +311,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processSettingsInvites (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && settings.changeInInviteLog) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && this.settings.places.inviteLog) {
|
||||
e.instance.props.invites = Object.assign({}, e.instance.props.invites);
|
||||
for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)}));
|
||||
}
|
||||
|
@ -297,7 +319,7 @@ module.exports = (_ => {
|
|||
|
||||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && (BDFDB.ChannelUtils.isTextChannel(channel) || channel.isGroupDM()) && settings.changeInChannelHeader) {
|
||||
if (channel && (BDFDB.ChannelUtils.isTextChannel(channel) || channel.isGroupDM()) && this.settings.places.channelHeader) {
|
||||
if (!e.returnvalue) {
|
||||
let channelName = BDFDB.ReactUtils.findChild(e.instance, {name: ["Title", "ChannelName"]});
|
||||
if (channelName) {
|
||||
|
@ -327,14 +349,14 @@ module.exports = (_ => {
|
|||
processFocusRing (e) {
|
||||
if (e.returnvalue && e.returnvalue.props.className) {
|
||||
let change, channelId, nameClass, categoyClass, iconClass, modify = {};
|
||||
if (settings.changeInChannelList && 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;
|
||||
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("_").pop();
|
||||
nameClass = BDFDB.disCN.categoryname;
|
||||
iconClass = BDFDB.disCN.categoryicon;
|
||||
modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
||||
}
|
||||
else if (settings.changeInSearchPopout && e.returnvalue.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
|
||||
else if (this.settings.places.searchPopout && e.returnvalue.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
|
||||
change = true;
|
||||
let channel = (BDFDB.ReactUtils.findValue(e.returnvalue._owner, "result", {up: true}) || {}).channel;
|
||||
channelId = channel && channel.id;
|
||||
|
@ -365,17 +387,17 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelCategoryItem (e) {
|
||||
if (e.instance.props.channel && settings.changeInChannelList) 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);
|
||||
}
|
||||
|
||||
processChannelItem (e) {
|
||||
if (e.instance.props.channel && settings.changeInChannelList) {
|
||||
if (e.instance.props.channel && this.settings.places.channelList) {
|
||||
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
||||
else {
|
||||
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]]});
|
||||
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
|
||||
let channelIcon = settings.changeChannelIcon && BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelItemIcon"});
|
||||
let channelIcon = this.settings.general.changeChannelIcon && BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelItemIcon"});
|
||||
if (channelIcon && typeof channelIcon.type == "function") {
|
||||
let type = channelIcon.type;
|
||||
channelIcon.type = (...args) => {
|
||||
|
@ -396,7 +418,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processDirectMessage (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && settings.changeInRecentDms) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.recentDms) {
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
|
||||
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
|
||||
|
@ -412,7 +434,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPrivateChannel (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && settings.changeInChannelList) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.channelList) {
|
||||
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
|
||||
this.changeChannelColor(e.returnvalue.props.name, e.instance.props.channel.id, {modify: BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected", "hasUnreadMessages", "muted")});
|
||||
e.returnvalue.props.name = [e.returnvalue.props.name];
|
||||
|
@ -421,7 +443,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processQuickSwitchChannelResult (e) {
|
||||
if (e.instance.props.channel && settings.changeInQuickSwitcher) {
|
||||
if (e.instance.props.channel && this.settings.places.quickSwitcher) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
||||
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
|
||||
|
@ -441,13 +463,13 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processSearchPopoutComponent (e) {
|
||||
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && settings.changeInSearchPopout) {
|
||||
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && this.settings.places.searchPopout) {
|
||||
for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.channel) result.channel = this.getChannelData(result.channel.id);
|
||||
}
|
||||
}
|
||||
|
||||
processSearchResultsInner (e) {
|
||||
if (settings.changeInSearchResults) {
|
||||
if (this.settings.places.searchResults) {
|
||||
let results = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["id", "search-results"]]});
|
||||
if (results && BDFDB.ArrayUtils.is(results.props.children)) for (let group of results.props.children) {
|
||||
let channelId = (BDFDB.ObjectUtils.get(group, "props.children.key") || "").split("-")[0];
|
||||
|
@ -461,7 +483,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processRecentsChannelHeader (e) {
|
||||
if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
|
||||
if (this.settings.places.recentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
|
||||
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
|
||||
child.props.channel = this.getChannelData(child.props.channel.id);
|
||||
let oldType = child.type;
|
||||
|
@ -477,7 +499,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMessageContent (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.content) && this.settings.places.mentions) for (let ele of e.instance.props.content) {
|
||||
if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.displayName == "Tooltip" && typeof ele.props.children == "function") {
|
||||
let children = ele.props.children({});
|
||||
if (children && children.type.displayName == "Mention" && children.props.children && typeof children.props.children[0] == "string" && children.props.children[0][0] == "#") {
|
||||
|
@ -512,7 +534,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processRichChannelMention (e) {
|
||||
if (e.instance.props.id && settings.changeInMentions) {
|
||||
if (e.instance.props.id && this.settings.places.mentions) {
|
||||
let name = (changedChannels[e.instance.props.id] || {}).name;
|
||||
let color = this.getChannelDataColor(e.instance.props.id);
|
||||
if (name || color) {
|
||||
|
@ -567,8 +589,8 @@ module.exports = (_ => {
|
|||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title) {
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "#" + this.getChannelData(channel.id, settings.changeAppTitle).name);
|
||||
else if (channel && channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id, settings.changeAppTitle));
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "#" + this.getChannelData(channel.id, this.settings.places.appTitle).name);
|
||||
else if (channel && channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id, this.settings.places.appTitle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +615,7 @@ module.exports = (_ => {
|
|||
|
||||
changeChannelIconColor (child, channelId, modify) {
|
||||
let color = child && this.getChannelDataColor(channelId);
|
||||
if (color && settings.changeChannelIcon) {
|
||||
if (color && this.settings.general.changeChannelIcon) {
|
||||
color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
|
||||
child.props.color = color || "currentColor";
|
||||
if (color) child.props.foreground = null;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name EditUsers
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.2.1
|
||||
* @version 4.2.2
|
||||
* @description Allows you to locally edit Users
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,12 +17,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditUsers",
|
||||
"author": "DevilBro",
|
||||
"version": "4.2.1",
|
||||
"version": "4.2.2",
|
||||
"description": "Allows you to locally edit Users"
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Failed Messages": "No longer overwrites the red color indicating a message that failed to send"
|
||||
"Mentions": ""
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -65,42 +65,39 @@ module.exports = (_ => {
|
|||
return template.content.firstElementChild;
|
||||
}
|
||||
} : (([Plugin, BDFDB]) => {
|
||||
var changedUsers = {}, settings = {};
|
||||
|
||||
const settingsHeaders = {
|
||||
sub: "Change Users in:",
|
||||
main: "Change Users in the Chat Window (Messages, Reactions, Mentions, etc.) in:"
|
||||
};
|
||||
var changedUsers = {};
|
||||
|
||||
return class EditUsers extends Plugin {
|
||||
onLoad () {
|
||||
this.defaults = {
|
||||
settings: {
|
||||
changeInServers: {value: true, category: "main", description: "Servers"},
|
||||
changeInDms: {value: true, category: "main", description: "Direct Messages"},
|
||||
changeInContextMenu: {value: true, category: "sub", description: "User ContextMenu"},
|
||||
changeInChatTextarea: {value: true, category: "sub", description: "Chat Textarea"},
|
||||
changeInChatWindow: {value: true, category: "sub", description: "Messages"},
|
||||
changeInReactions: {value: true, category: "sub", description: "Reactions"},
|
||||
changeInMentions: {value: true, category: "sub", description: "Mentions"},
|
||||
changeInMemberList: {value: true, category: "sub", description: "Member List"},
|
||||
changeInVoiceChat: {value: true, category: "sub", description: "Voice Channels"},
|
||||
changeInRecentDms: {value: true, category: "sub", description: "Direct Message Notifications"},
|
||||
changeInDmsList: {value: true, category: "sub", description: "Direct Message List"},
|
||||
changeInDmHeader: {value: true, category: "sub", description: "Direct Message Header"},
|
||||
changeInDmCalls: {value: true, category: "sub", description: "Calls/ScreenShares"},
|
||||
changeInTyping: {value: true, category: "sub", description: "Typing List"},
|
||||
changeInFriendList: {value: true, category: "sub", description: "Friend List"},
|
||||
changeInInviteList: {value: true, category: "sub", description: "Invite List"},
|
||||
changeInActivity: {value: true, category: "sub", description: "Activity Page"},
|
||||
changeInUserPopout: {value: true, category: "sub", description: "User Popouts"},
|
||||
changeInUserProfile: {value: true, category: "sub", description: "User Profile Modal"},
|
||||
changeInAutoComplete: {value: true, category: "sub", description: "Autocomplete Menu"},
|
||||
changeInGuildSettings: {value: true, category: "sub", description: "Server Settings"},
|
||||
changeInQuickSwitcher: {value: true, category: "sub", description: "Quick Switcher"},
|
||||
changeInSearchPopout: {value: true, category: "sub", description: "Search Popout"},
|
||||
changeInUserAccount: {value: true, category: "sub", description: "Your Account Information"},
|
||||
changeInAppTitle: {value: true, category: "sub", description: "Discord App Title (DMs)"}
|
||||
types: {
|
||||
servers: {value: true, description: "Servers"},
|
||||
dms: {value: true, description: "Direct Messages"},
|
||||
},
|
||||
places: {
|
||||
contextMenu: {value: true, description: "User ContextMenu"},
|
||||
chatTextarea: {value: true, description: "Chat Textarea"},
|
||||
chatWindow: {value: true, description: "Messages"},
|
||||
reactions: {value: true, description: "Reactions"},
|
||||
mentions: {value: true, description: "Mentions"},
|
||||
memberList: {value: true, description: "Member List"},
|
||||
voiceChat: {value: true, description: "Voice Channels"},
|
||||
recentDms: {value: true, description: "Direct Message Notifications"},
|
||||
dmsList: {value: true, description: "Direct Message List"},
|
||||
dmHeader: {value: true, description: "Direct Message Header"},
|
||||
dmCalls: {value: true, description: "Calls/ScreenShares"},
|
||||
typing: {value: true, description: "Typing List"},
|
||||
friendList: {value: true, description: "Friend List"},
|
||||
inviteList: {value: true, description: "Invite List"},
|
||||
activity: {value: true, description: "Activity Page"},
|
||||
userPopout: {value: true, description: "User Popouts"},
|
||||
userProfile: {value: true, description: "User Profile Modal"},
|
||||
autcocompletes: {value: true, description: "Autocomplete Menu"},
|
||||
guildSettings: {value: true, description: "Server Settings"},
|
||||
quickSwitcher: {value: true, description: "Quick Switcher"},
|
||||
searchPopout: {value: true, description: "Search Popout"},
|
||||
userAccount: {value: true, description: "Your Account Information"},
|
||||
appTitle: {value: true, description: "Discord App Title (DMs)"}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -198,11 +195,25 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
// REMOVE 16.05.2021
|
||||
let oldData = BDFDB.DataUtils.load(this);
|
||||
if (oldData.settings) {
|
||||
this.settings.general = BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == -1, true);
|
||||
this.settings.places = Object.entries(BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == 0, true)).reduce((n, p) => {
|
||||
let k = p[0].replace("changeIn", "");
|
||||
n[k[0].toLowerCase() + k.slice(1)] = p[1];
|
||||
return n;
|
||||
}, {});
|
||||
BDFDB.DataUtils.save(this.settings.general, this, "general");
|
||||
BDFDB.DataUtils.save(this.settings.places, this, "places");
|
||||
BDFDB.DataUtils.remove(this, "settings");
|
||||
}
|
||||
|
||||
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
||||
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MessageAuthorUtils, ["default", "getMessageAuthor"], {after: e => {
|
||||
if (settings.changeInChatWindow && e.methodArguments[0] && e.methodArguments[0].author && changedUsers[e.methodArguments[0].author.id] && this.shouldChangeInChat(e.methodArguments[0].channel_id)) {
|
||||
if (this.settings.places.chatWindow && e.methodArguments[0] && e.methodArguments[0].author && changedUsers[e.methodArguments[0].author.id] && this.shouldchat(e.methodArguments[0].channel_id)) {
|
||||
let data = changedUsers[e.methodArguments[0].author.id];
|
||||
if (data.name || data.color1) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(e.methodArguments[0].channel_id) || {}).guild_id, e.methodArguments[0].author.id);
|
||||
|
@ -262,18 +273,29 @@ module.exports = (_ => {
|
|||
collapseStates: collapseStates,
|
||||
children: _ => {
|
||||
let settingsItems = [];
|
||||
|
||||
for (let cat in settingsHeaders) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: settingsHeaders[cat],
|
||||
dividerBottom: true,
|
||||
children: Object.keys(settings).filter(key => this.defaults.settings[key].category == cat).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Change Users in:",
|
||||
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
keys: ["places", key],
|
||||
label: this.defaults.places[key].description,
|
||||
value: this.settings.places[key]
|
||||
}))
|
||||
}));
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Change Users in the Chat Window (Messages, Reactions, Mentions, etc.) in:",
|
||||
children: Object.keys(this.defaults.types).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["types", key],
|
||||
label: this.defaults.types[key].description,
|
||||
value: this.settings.types[key]
|
||||
}))
|
||||
}));
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, {
|
||||
label: "Changed Users:"
|
||||
}));
|
||||
|
@ -315,7 +337,6 @@ module.exports = (_ => {
|
|||
|
||||
forceUpdateAll () {
|
||||
changedUsers = BDFDB.DataUtils.load(this, "users");
|
||||
settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
||||
this.changeAppTitle();
|
||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||
|
@ -325,7 +346,7 @@ module.exports = (_ => {
|
|||
onUserContextMenu (e) {
|
||||
if (e.instance.props.user) {
|
||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||
if (userName != e.instance.props.user.username && settings.changeInContextMenu) {
|
||||
if (userName != e.instance.props.user.username && this.settings.places.contextMenu) {
|
||||
let [kickChilden, kickIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "kick"});
|
||||
if (kickIndex > -1) kickChilden[kickIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("KICK_USER", userName);
|
||||
let [banChilden, banIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "ban"});
|
||||
|
@ -371,14 +392,14 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && e.instance.props.channel.isDM() && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && settings.changeInChatTextarea) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && e.instance.props.channel.isDM() && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && this.settings.places.chatTextarea) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.recipients[0]);
|
||||
if (user) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `@${changedUsers[user.id] && changedUsers[user.id].name || user.username}`);
|
||||
}
|
||||
}
|
||||
|
||||
processAutocompleteUserResult (e) {
|
||||
if (e.instance.props.user && settings.changeInAutoComplete) {
|
||||
if (e.instance.props.user && this.settings.places.autocompletes) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
|
@ -393,7 +414,7 @@ module.exports = (_ => {
|
|||
|
||||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && channel.isDM() && settings.changeInDmHeader) {
|
||||
if (channel && channel.isDM() && this.settings.places.dmHeader) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.instance, {name: "Title"});
|
||||
if (userName) {
|
||||
let recipientId = channel.getRecipientId();
|
||||
|
@ -404,7 +425,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelCallHeader (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && settings.changeInDmHeader) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.dmHeader) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Title"});
|
||||
if (userName) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
|
@ -425,28 +446,28 @@ module.exports = (_ => {
|
|||
let tagClass = "";
|
||||
switch (e.instance.props.className) {
|
||||
case BDFDB.disCN.userpopoutheadertagnonickname:
|
||||
change = settings.changeInUserPopout;
|
||||
change = this.settings.places.userPopout;
|
||||
guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
changeBackground = true;
|
||||
tagClass = BDFDB.disCN.bottagnametag;
|
||||
break;
|
||||
case BDFDB.disCN.userprofilenametag:
|
||||
change = settings.changeInUserProfile;
|
||||
change = this.settings.places.userProfile;
|
||||
guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
changeBackground = true;
|
||||
tagClass = BDFDB.disCNS.userprofilebottag + BDFDB.disCN.bottagnametag;
|
||||
break;
|
||||
case BDFDB.disCN.guildsettingsinviteusername:
|
||||
change = settings.changeInGuildSettings;
|
||||
change = this.settings.places.guildSettings;
|
||||
break;
|
||||
case BDFDB.disCN.userinfodiscordtag:
|
||||
change = settings.changeInFriendList;
|
||||
change = this.settings.places.friendList;
|
||||
tagClass = BDFDB.disCN.bottagnametag;
|
||||
break;
|
||||
}
|
||||
switch (e.instance.props.usernameClass) {
|
||||
case BDFDB.disCN.messagereactionsmodalusername:
|
||||
change = settings.changeInReactions && !BDFDB.LibraryModules.MemberStore.getNick(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
change = this.settings.places.reactions && !BDFDB.LibraryModules.MemberStore.getNick(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
break;
|
||||
}
|
||||
if (change) {
|
||||
|
@ -464,7 +485,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserPopout (e) {
|
||||
if (e.instance.props.user && settings.changeInUserPopout) {
|
||||
if (e.instance.props.user && this.settings.places.userPopout) {
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id, true, true);
|
||||
|
@ -492,7 +513,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserProfile (e) {
|
||||
if (e.instance.props.user && settings.changeInUserProfile) {
|
||||
if (e.instance.props.user && this.settings.places.userProfile) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
if (data && (data.removeStatus || data.status || data.statusEmoji)) e.instance.props.customStatusActivity = this.createCustomStatus(data);
|
||||
|
@ -500,7 +521,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserInfo (e) {
|
||||
if (e.instance.props.user && settings.changeInFriendList) {
|
||||
if (e.instance.props.user && this.settings.places.friendList) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
if (BDFDB.ReactUtils.isValidElement(e.instance.props.subText)) {
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
|
@ -514,7 +535,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processNowPlayingHeader (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.priorityUser) && e.instance.props.priorityUser.user && settings.changeInFriendList) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.priorityUser) && e.instance.props.priorityUser.user && this.settings.places.friendList) {
|
||||
if (!e.returnvalue) {
|
||||
let titleIsName = e.instance.props.priorityUser.user.username == e.instance.props.title;
|
||||
e.instance.props.priorityUser.user = this.getUserData(e.instance.props.priorityUser.user.id);
|
||||
|
@ -528,7 +549,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processVoiceUser (e) {
|
||||
if (e.instance.props.user && settings.changeInVoiceChat) {
|
||||
if (e.instance.props.user && this.settings.places.voiceChat) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
|
@ -545,7 +566,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processAccount (e) {
|
||||
if (e.instance.props.currentUser && settings.changeInUserAccount) {
|
||||
if (e.instance.props.currentUser && this.settings.places.userAccount) {
|
||||
let data = changedUsers[e.instance.props.currentUser.id];
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.currentUser = this.getUserData(e.instance.props.currentUser.id);
|
||||
|
@ -569,7 +590,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPrivateChannelEmptyMessage (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && settings.changeInChatWindow) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.chatWindow) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
let name = this.getUserData(recipientId).username;
|
||||
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue.props.children, {props: "src"});
|
||||
|
@ -588,9 +609,9 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMessage (e) {
|
||||
if (settings.changeInChatWindow) {
|
||||
if (this.settings.places.chatWindow) {
|
||||
let header = e.instance.props.childrenHeader;
|
||||
if (header && header.props && header.props.message && this.shouldChangeInChat(header.props.message.channel_id)) {
|
||||
if (header && header.props && header.props.message && this.shouldchat(header.props.message.channel_id)) {
|
||||
let data = changedUsers[header.props.message.author.id];
|
||||
if (data) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(header.props.message.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
|
@ -600,7 +621,7 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
let content = e.instance.props.childrenMessageContent;
|
||||
if (content && content.type && content.type.type && content.props.message && this.shouldChangeInChat(content.props.message.channel_id)) {
|
||||
if (content && content.type && content.type.type && content.props.message && this.shouldchat(content.props.message.channel_id)) {
|
||||
let data = changedUsers[content.props.message.author.id];
|
||||
if (data) {
|
||||
let messageColor = data.color5 || (BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.coloredText) && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(content.props.message.channel_id) || {}).guild_id, content.props.message.author.id) || {}).colorString || data.color1));
|
||||
|
@ -612,7 +633,7 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
let repliedMessage = e.instance.props.childrenRepliedMessage;
|
||||
if (repliedMessage && repliedMessage.props && repliedMessage.props.children && repliedMessage.props.children.props && repliedMessage.props.children.props.referencedMessage && repliedMessage.props.children.props.referencedMessage.message && this.shouldChangeInChat(repliedMessage.props.children.props.referencedMessage.message.channel_id)) {
|
||||
if (repliedMessage && repliedMessage.props && repliedMessage.props.children && repliedMessage.props.children.props && repliedMessage.props.children.props.referencedMessage && repliedMessage.props.children.props.referencedMessage.message && this.shouldchat(repliedMessage.props.children.props.referencedMessage.message.channel_id)) {
|
||||
let referenceMessage = repliedMessage.props.children.props.referencedMessage.message;
|
||||
let data = changedUsers[referenceMessage.author.id];
|
||||
if (data) {
|
||||
|
@ -626,7 +647,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMessageUsername (e) {
|
||||
if (e.instance.props.message && settings.changeInChatWindow && this.shouldChangeInChat(e.instance.props.message.channel_id)) {
|
||||
if (e.instance.props.message && this.settings.places.chatWindow && this.shouldchat(e.instance.props.message.channel_id)) {
|
||||
let data = changedUsers[e.instance.props.message.author.id];
|
||||
if (!e.returnvalue) {
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {author: this.getUserData(e.instance.props.message.author.id, true, false, e.instance.props.message.author)}));
|
||||
|
@ -660,7 +681,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMessageContent (e) {
|
||||
if (e.instance.props.message && settings.changeInChatWindow && this.shouldChangeInChat(e.instance.props.message.channel_id)) {
|
||||
if (e.instance.props.message && this.settings.places.chatWindow && this.shouldchat(e.instance.props.message.channel_id)) {
|
||||
if (!e.returnvalue) {
|
||||
if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.REPLY) {
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {author: this.getUserData(e.instance.props.message.author.id, true, false, e.instance.props.message.author)}));
|
||||
|
@ -691,7 +712,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processReaction (e) {
|
||||
if (!settings.changeInReactions || !e.returnvalue || !this.shouldChangeInChat(e.instance.props.message.channel_id)) return;
|
||||
if (!this.settings.places.reactions || !e.returnvalue || !this.shouldchat(e.instance.props.message.channel_id)) return;
|
||||
if (e.instance.props.reactions && e.instance.props.reactions.length) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id);
|
||||
let guildId = null == channel || channel.isPrivate() ? null : channel.getGuildId();
|
||||
|
@ -720,7 +741,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processReactorsComponent (e) {
|
||||
if (settings.changeInReactions && BDFDB.ArrayUtils.is(e.instance.props.reactors) && this.shouldChangeInChat(e.instance.props.channel.id)) {
|
||||
if (this.settings.places.reactions && BDFDB.ArrayUtils.is(e.instance.props.reactors) && this.shouldchat(e.instance.props.channel.id)) {
|
||||
if (!e.returnvalue) {
|
||||
for (let i in e.instance.props.reactors) if (!BDFDB.LibraryModules.MemberStore.getNick(e.instance.props.guildId, e.instance.props.reactors[i].id)) e.instance.props.reactors[i] = this.getUserData(e.instance.props.reactors[i].id, true, false, e.instance.props.reactors[i]);
|
||||
}
|
||||
|
@ -747,14 +768,21 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserMention (e) {
|
||||
if (e.instance.props.userId && settings.changeInMentions && changedUsers[e.instance.props.userId] && this.shouldChangeInChat()) {
|
||||
let mention = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"});
|
||||
if (mention) this.changeMention(mention, changedUsers[e.instance.props.userId]);
|
||||
if (e.instance.props.userId && this.settings.places.mentions && changedUsers[e.instance.props.userId] && this.shouldchat()) {
|
||||
if (typeof e.returnvalue.props.children == "function") {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
e.returnvalue.props.children = (...args) => {
|
||||
let children = renderChildren(...args);
|
||||
this.changeMention(BDFDB.ReactUtils.findChild(children, {name: "Mention"}), changedUsers[e.instance.props.userId]);
|
||||
return children;
|
||||
};
|
||||
}
|
||||
else this.changeMention(BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"}), changedUsers[e.instance.props.userId]);
|
||||
}
|
||||
}
|
||||
|
||||
processRichUserMention (e) {
|
||||
if (e.instance.props.id && settings.changeInMentions && changedUsers[e.instance.props.id] && this.shouldChangeInChat()) {
|
||||
if (e.instance.props.id && this.settings.places.mentions && changedUsers[e.instance.props.id] && this.shouldchat()) {
|
||||
let data = changedUsers[e.instance.props.id];
|
||||
let tooltipChildren = BDFDB.ObjectUtils.get(e, "returnvalue.props.text.props.children");
|
||||
if (tooltipChildren) {
|
||||
|
@ -776,6 +804,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
changeMention (mention, data) {
|
||||
if (!mention) return;
|
||||
if (data.name) {
|
||||
if (typeof mention.props.children == "string") mention.props.children = "@" + data.name;
|
||||
else if (BDFDB.ArrayUtils.is(mention.props.children)) {
|
||||
|
@ -810,7 +839,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelReply (e) {
|
||||
if (e.instance.props.reply && e.instance.props.reply.message && settings.changeInChatWindow && this.shouldChangeInChat(e.instance.props.reply.message.channel_id)) {
|
||||
if (e.instance.props.reply && e.instance.props.reply.message && this.settings.places.chatWindow && this.shouldchat(e.instance.props.reply.message.channel_id)) {
|
||||
if (!e.returnvalue) {
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.reply.message, {author: this.getUserData(e.instance.props.reply.message.author.id)}));
|
||||
let data = changedUsers[e.instance.props.reply.message.author.id];
|
||||
|
@ -828,7 +857,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMemberListItem (e) {
|
||||
if (e.instance.props.user && settings.changeInMemberList && this.shouldChangeInChat()) {
|
||||
if (e.instance.props.user && this.settings.places.memberList && this.shouldchat()) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
|
@ -854,7 +883,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processAuditLogs (e) {
|
||||
if (e.instance.props.logs && settings.changeInGuildSettings) {
|
||||
if (e.instance.props.logs && this.settings.places.guildSettings) {
|
||||
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "renderUserQuickSelectItem")) BDFDB.PatchUtils.patch(this, e.instance, "renderUserQuickSelectItem", {after: e2 => {if (e2.methodArguments[0] && e2.methodArguments[0].user && changedUsers[e2.methodArguments[0].user.id]) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e2.returnValue, {props: [["children", e2.methodArguments[0].label]]});
|
||||
if (userName) {
|
||||
|
@ -868,45 +897,45 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processAuditLog (e) {
|
||||
if (e.instance.props.log && settings.changeInGuildSettings) {
|
||||
if (e.instance.props.log && this.settings.places.guildSettings) {
|
||||
if (e.instance.props.log.user) e.instance.props.log.user = this.getUserData(e.instance.props.log.user.id);
|
||||
if (e.instance.props.log.target && e.instance.props.log.targetType == "USER") e.instance.props.log.target = this.getUserData(e.instance.props.log.target.id);
|
||||
}
|
||||
}
|
||||
|
||||
processUserHook (e) {
|
||||
if (e.instance.props.user && settings.changeInGuildSettings) {
|
||||
if (e.instance.props.user && this.settings.places.guildSettings) {
|
||||
this.changeUserColor(e.returnvalue.props.children[0], e.instance.props.user.id);
|
||||
}
|
||||
}
|
||||
|
||||
processGuildSettingsEmoji (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.emojis) && settings.changeInGuildSettings) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.emojis) && this.settings.places.guildSettings) {
|
||||
e.instance.props.emojis = [].concat(e.instance.props.emojis);
|
||||
for (let i in e.instance.props.emojis) e.instance.props.emojis[i] = Object.assign({}, e.instance.props.emojis[i], {user: this.getUserData(e.instance.props.emojis[i].user.id)});
|
||||
}
|
||||
}
|
||||
|
||||
processMemberCard (e) {
|
||||
if (e.instance.props.user && settings.changeInGuildSettings) e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
if (e.instance.props.user && this.settings.places.guildSettings) e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
}
|
||||
|
||||
processSettingsInvites (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && settings.changeInGuildSettings) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && this.settings.places.guildSettings) {
|
||||
e.instance.props.invites = Object.assign({}, e.instance.props.invites);
|
||||
for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {inviter: this.getUserData(e.instance.props.invites[id].inviter.id)}));
|
||||
}
|
||||
}
|
||||
|
||||
processGuildSettingsBans (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.bans) && settings.changeInGuildSettings) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.bans) && this.settings.places.guildSettings) {
|
||||
e.instance.props.bans = Object.assign({}, e.instance.props.bans);
|
||||
for (let id in e.instance.props.bans) e.instance.props.bans[id] = Object.assign({}, e.instance.props.bans[id], {user: this.getUserData(e.instance.props.bans[id].user.id)});
|
||||
}
|
||||
}
|
||||
|
||||
processInvitationCard (e) {
|
||||
if (e.instance.props.user && settings.changeInInviteList) {
|
||||
if (e.instance.props.user && this.settings.places.inviteList) {
|
||||
if (!e.returnvalue) e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
else {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.invitemodalinviterowname]]});
|
||||
|
@ -916,20 +945,20 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPrivateChannelRecipientsInvitePopout (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.results) && settings.changeInInviteList) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.results) && this.settings.places.inviteList) {
|
||||
for (let result of e.instance.props.results) result.user = this.getUserData(result.user.id);
|
||||
}
|
||||
}
|
||||
|
||||
processInviteModalUserRow (e) {
|
||||
if (e.instance.props.user && settings.changeInInviteList) {
|
||||
if (e.instance.props.user && this.settings.places.inviteList) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.searchpopoutddmaddnickname]]});
|
||||
if (userName) this.changeUserColor(userName, e.instance.props.user.id);
|
||||
}
|
||||
}
|
||||
|
||||
processTypingUsers (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && settings.changeInTyping) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && this.settings.places.typing) {
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
|
||||
if (users.length) {
|
||||
let typingText = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
|
||||
|
@ -946,7 +975,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processDirectMessage (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && settings.changeInRecentDms) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.recentDms) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getUserData(recipientId).username;
|
||||
|
@ -963,7 +992,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPrivateChannel (e) {
|
||||
if (e.instance.props.user && settings.changeInDmsList && changedUsers[e.instance.props.user.id]) {
|
||||
if (e.instance.props.user && this.settings.places.dmsList && changedUsers[e.instance.props.user.id]) {
|
||||
if (!e.returnvalue) {
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
if (data.removeStatus || data.status || data.statusEmoji) {
|
||||
|
@ -983,7 +1012,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processQuickSwitchUserResult (e) {
|
||||
if (e.instance.props.user && settings.changeInQuickSwitcher) {
|
||||
if (e.instance.props.user && this.settings.places.quickSwitcher) {
|
||||
if (!e.returnvalue) e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
else {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresultmatch]]});
|
||||
|
@ -997,13 +1026,13 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processSearchPopoutComponent (e) {
|
||||
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && settings.changeInSearchPopout) {
|
||||
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && this.settings.places.searchPopout) {
|
||||
for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.user) result.user = this.getUserData(result.user.id);
|
||||
}
|
||||
}
|
||||
|
||||
processSearchPopoutUserResult (e) {
|
||||
if (e.instance.props.result && e.instance.props.result.user && settings.changeInSearchPopout) {
|
||||
if (e.instance.props.result && e.instance.props.result.user && this.settings.places.searchPopout) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.searchpopoutdisplayednick]]});
|
||||
if (userName) {
|
||||
let data = changedUsers[e.instance.props.result.user.id];
|
||||
|
@ -1014,7 +1043,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processIncomingCallModal (e) {
|
||||
if (e.instance.props.channel && settings.changeInDmCalls) {
|
||||
if (e.instance.props.channel && this.settings.places.dmCalls) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.id);
|
||||
if (!user) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channel.id);
|
||||
|
@ -1034,7 +1063,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processRTCConnection (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && settings.changeInRecentDms && typeof e.returnvalue.props.children == "function") {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.recentDms && typeof e.returnvalue.props.children == "function") {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
e.returnvalue.props.children = (...args) => {
|
||||
|
@ -1050,13 +1079,13 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPrivateChannelCallParticipants (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && settings.changeInDmCalls) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) {
|
||||
for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
processChannelCall (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && settings.changeInDmCalls) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) {
|
||||
for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id);
|
||||
}
|
||||
}
|
||||
|
@ -1083,15 +1112,15 @@ module.exports = (_ => {
|
|||
let title = document.head.querySelector("title");
|
||||
if (title && channel && channel.isDM()) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
if (user) BDFDB.DOMUtils.setText(title, "@" + this.getUserData(user.id, settings.changeInAppTitle).username);
|
||||
if (user) BDFDB.DOMUtils.setText(title, "@" + this.getUserData(user.id, this.settings.places.appTitle).username);
|
||||
}
|
||||
}
|
||||
|
||||
shouldChangeInChat (channelId) {
|
||||
if (settings.changeInServers && settings.changeInDms) return true;
|
||||
shouldchat (channelId) {
|
||||
if (this.settings.types.servers && this.settings.types.dms) return true;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let isDm = channel && (channel.isDM() || channel.isGroupDM());
|
||||
if (channel && (settings.changeInServers && !isDm || settings.changeInDms && isDm)) return true;
|
||||
if (channel && (this.settings.types.servers && !isDm || this.settings.types.dms && isDm)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name RemoveNicknames
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 1.3.8
|
||||
* @version 1.3.9
|
||||
* @description Replaces Nicknames with Accountnames
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "RemoveNicknames",
|
||||
"author": "DevilBro",
|
||||
"version": "1.3.8",
|
||||
"version": "1.3.9",
|
||||
"description": "Replaces Nicknames with Accountnames"
|
||||
},
|
||||
"changeLog": {
|
||||
|
@ -64,24 +64,24 @@ module.exports = (_ => {
|
|||
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
|
||||
return template.content.firstElementChild;
|
||||
}
|
||||
} : (([Plugin, BDFDB]) => {
|
||||
var settings = {};
|
||||
|
||||
} : (([Plugin, BDFDB]) => {
|
||||
return class RemoveNicknames extends Plugin {
|
||||
onLoad () {
|
||||
this.defaults = {
|
||||
settings: {
|
||||
replaceOwn: {value: false, inner: false, description: "Replace your own Name"},
|
||||
replaceBots: {value: true, inner: false, description: "Replace the Nickname of Bots"},
|
||||
addNickname: {value: false, inner: false, description: "Add Nickname as Parentheses"},
|
||||
swapPositions: {value: false, inner: false, description: "Swap the Position of Username and Nickname"},
|
||||
changeInChatWindow: {value: true, inner: true, description: "Messages"},
|
||||
changeInReactions: {value: true, inner: true, description: "Reactions"},
|
||||
changeInMentions: {value: true, inner: true, description: "Mentions"},
|
||||
changeInVoiceChat: {value: true, inner: true, description: "Voice Channels"},
|
||||
changeInMemberList: {value: true, inner: true, description: "Member List"},
|
||||
changeInTyping: {value: true, inner: true, description: "Typing List"},
|
||||
changeInAutoComplete: {value: true, inner: true, description: "Autocomplete Menu"}
|
||||
general: {
|
||||
replaceOwn: {value: false, description: "Replace your own Name"},
|
||||
replaceBots: {value: true, description: "Replace the Nickname of Bots"},
|
||||
addNickname: {value: false, description: "Add Nickname as Parentheses"},
|
||||
swapPositions: {value: false, description: "Swap the Position of Username and Nickname"},
|
||||
},
|
||||
places: {
|
||||
chat: {value: true, description: "Messages"},
|
||||
reactions: {value: true, description: "Reactions"},
|
||||
mentions: {value: true, description: "Mentions"},
|
||||
voiceChat: {value: true, description: "Voice Channels"},
|
||||
memberList: {value: true, description: "Member List"},
|
||||
typing: {value: true, description: "Typing List"},
|
||||
autocompletes: {value: true, description: "Autocomplete Menu"}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -117,21 +117,34 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getSettingsPanel (collapseStates = {}) {
|
||||
let settingsPanel, settingsItems = [], innerItems = [];
|
||||
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Remove Nicknames in:",
|
||||
children: innerItems
|
||||
}));
|
||||
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
||||
let settingsPanel;
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
|
||||
collapseStates: collapseStates,
|
||||
children: _ => {
|
||||
let settingsItems = [];
|
||||
|
||||
settingsItems.push(Object.keys(this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["general", key],
|
||||
label: this.defaults.general[key].description,
|
||||
value: this.settings.general[key]
|
||||
})));
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||
title: "Remove Nicknames in:",
|
||||
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["places", key],
|
||||
label: this.defaults.places[key].description,
|
||||
value: this.settings.places[key]
|
||||
}))
|
||||
}));
|
||||
|
||||
return settingsItems;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onSettingsClosed (e) {
|
||||
|
@ -142,28 +155,26 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
forceUpdateAll () {
|
||||
settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||
BDFDB.MessageUtils.rerenderAll();
|
||||
}
|
||||
|
||||
processAutocompleteUserResult (e) {
|
||||
if (e.instance.props.user && e.instance.props.nick && settings.changeInAutoComplete) {
|
||||
if (e.instance.props.user && e.instance.props.nick && this.settings.places.autocompletes) {
|
||||
let newName = this.getNewName(e.instance.props.user);
|
||||
if (newName) e.instance.props.nick = newName;
|
||||
}
|
||||
}
|
||||
|
||||
processVoiceUser (e) {
|
||||
if (e.instance.props.user && e.instance.props.nick && settings.changeInVoiceChat) {
|
||||
if (e.instance.props.user && e.instance.props.nick && this.settings.places.voiceChat) {
|
||||
let newName = this.getNewName(e.instance.props.user);
|
||||
if (newName) e.instance.props.nick = newName;
|
||||
}
|
||||
}
|
||||
|
||||
processTypingUsers (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && settings.changeInTyping) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && this.settings.places.typing) {
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
|
||||
if (users.length) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
|
||||
|
@ -201,36 +212,49 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserMention (e) {
|
||||
if (e.instance.props.userId && settings.changeInMentions) {
|
||||
let mention = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"});
|
||||
let newName = mention && this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.userId));
|
||||
if (newName) mention.props.children = "@" + newName;
|
||||
if (e.instance.props.userId && this.settings.places.mentions) {
|
||||
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.userId));
|
||||
if (!newName) return;
|
||||
if (typeof e.returnvalue.props.children == "function") {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
e.returnvalue.props.children = (...args) => {
|
||||
let children = renderChildren(...args);
|
||||
this.changeMention(BDFDB.ReactUtils.findChild(children, {name: "Mention"}), newName);
|
||||
return children;
|
||||
};
|
||||
}
|
||||
else this.changeMention(BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"}), newName);
|
||||
}
|
||||
}
|
||||
|
||||
processRichUserMention (e) {
|
||||
if (e.instance.props.id && settings.changeInMentions && typeof e.returnvalue.props.children == "function") {
|
||||
if (e.instance.props.id && this.settings.places.mentions && typeof e.returnvalue.props.children == "function") {
|
||||
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id));
|
||||
if (newName) {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
e.returnvalue.props.children = (...args) => {
|
||||
let children = renderChildren(...args);
|
||||
children.props.children = "@" + newName;
|
||||
this.changeMention(children, newName);
|
||||
return children;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changeMention (mention, newName) {
|
||||
if (!mention) return;
|
||||
mention.props.children = "@" + newName;
|
||||
}
|
||||
|
||||
processChannelReply (e) {
|
||||
if (e.instance.props.reply && e.instance.props.reply.message && settings.changeInChatWindow) {
|
||||
if (e.instance.props.reply && e.instance.props.reply.message && this.settings.places.chat) {
|
||||
let newName = this.getNewName(e.instance.props.reply.message.author);
|
||||
if (newName) e.instance.props.reply.message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.reply.message, {nick: newName}));
|
||||
}
|
||||
}
|
||||
|
||||
processMemberListItem (e) {
|
||||
if (e.instance.props.user && e.instance.props.nick && settings.changeInMemberList) {
|
||||
if (e.instance.props.user && e.instance.props.nick && this.settings.places.memberList) {
|
||||
let newName = this.getNewName(e.instance.props.user);
|
||||
if (newName) e.instance.props.nick = newName;
|
||||
}
|
||||
|
@ -242,8 +266,8 @@ module.exports = (_ => {
|
|||
let origUser = BDFDB.LibraryModules.UserStore.getUser(user.id) || {};
|
||||
let EditUsers = BDFDB.BDUtils.getPlugin("EditUsers", true);
|
||||
let username = EditUsers && EditUsers.getUserData(user, true, false, origUser).username || user.username;
|
||||
if (!member.nick || user.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || user.bot && !settings.replaceBots) return username != origUser.username ? username : (member.nick || username);
|
||||
return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;
|
||||
if (!member.nick || user.id == BDFDB.UserUtils.me.id && !this.settings.general.replaceOwn || user.bot && !this.settings.general.replaceBots) return username != origUser.username ? username : (member.nick || username);
|
||||
return this.settings.general.addNickname ? (this.settings.general.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;
|
||||
}
|
||||
};
|
||||
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
||||
|
|
Loading…
Reference in New Issue