This commit is contained in:
Mirco Wittrien 2021-02-24 17:32:17 +01:00
parent ac0e2b39ee
commit 287e9495a9
5 changed files with 47 additions and 37 deletions

View File

@ -16,13 +16,13 @@ module.exports = (_ => {
"info": { "info": {
"name": "BDFDB", "name": "BDFDB",
"author": "DevilBro", "author": "DevilBro",
"version": "1.3.9", "version": "1.4.0",
"description": "Give other plugins utility functions" "description": "Give other plugins utility functions"
}, },
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", "rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js",
"changeLog": { "changeLog": {
"fixed": { "progress": {
"Color Picker": "Fixed Issue with Color Swatches Component" "New Meta Headers": "Adjusted Update Check for new Plugin Meta Headers"
} }
} }
}; };
@ -619,7 +619,7 @@ module.exports = (_ => {
LibraryRequires.request(url, (error, response, body) => { LibraryRequires.request(url, (error, response, body) => {
if (error || !PluginStores.updateData.plugins[url]) return callback(null); if (error || !PluginStores.updateData.plugins[url]) return callback(null);
let newName = (body.match(/"name"\s*:\s*"([^"]+)"/) || [])[1] || pluginName; let newName = (body.match(/"name"\s*:\s*"([^"]+)"/) || [])[1] || pluginName;
let newVersion = (body.match(/['"][0-9]+\.[0-9]+\.[0-9]+['"]/i) || "").toString().replace(/['"]/g, ""); let newVersion = (body.match(/@version ([0-9]+\.[0-9]+\.[0-9]+)|['"]([0-9]+\.[0-9]+\.[0-9]+)['"]/i) || []).filter(n => n)[1];
if (!newVersion) return callback(null); if (!newVersion) return callback(null);
if (pluginName == newName && BDFDB.NumberUtils.getVersionDifference(newVersion, PluginStores.updateData.plugins[url].version) > 0.2) { if (pluginName == newName && BDFDB.NumberUtils.getVersionDifference(newVersion, PluginStores.updateData.plugins[url].version) > 0.2) {
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_force_updated", pluginName), { BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_force_updated", pluginName), {
@ -773,7 +773,7 @@ module.exports = (_ => {
else { else {
let wasEnabled = BDFDB.BDUtils.isPluginEnabled(pluginName); let wasEnabled = BDFDB.BDUtils.isPluginEnabled(pluginName);
let newName = (body.match(/"name"\s*:\s*"([^"]+)"/) || [])[1] || pluginName; let newName = (body.match(/"name"\s*:\s*"([^"]+)"/) || [])[1] || pluginName;
let newVersion = body.match(/['"][0-9]+\.[0-9]+\.[0-9]+['"]/i).toString().replace(/['"]/g, ""); let newVersion = (body.match(/@version ([0-9]+\.[0-9]+\.[0-9]+)|['"]([0-9]+\.[0-9]+\.[0-9]+)['"]/i) || []).filter(n => n)[1];
let oldVersion = PluginStores.updateData.plugins[url].version; let oldVersion = PluginStores.updateData.plugins[url].version;
let fileName = pluginName == "BDFDB" ? "0BDFDB" : pluginName; let fileName = pluginName == "BDFDB" ? "0BDFDB" : pluginName;
let newFileName = newName == "BDFDB" ? "0BDFDB" : newName; let newFileName = newName == "BDFDB" ? "0BDFDB" : newName;

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "EditChannels", "name": "EditChannels",
"author": "DevilBro", "author": "DevilBro",
"version": "4.2.5", "version": "4.2.6",
"description": "Allow you to rename and recolor channelnames" "description": "Allow you to rename and recolor Channel Names"
}, },
"changeLog": { "changeLog": {
"improved": { "fixed": {
"Canary Changes": "Preparing Plugins for the changes that are already done on Discord Canary" "Mentions": ""
} }
} }
}; };
@ -108,7 +108,7 @@ module.exports = (_ => {
QuickSwitchChannelResult: "render", QuickSwitchChannelResult: "render",
SearchResultsInner: "default", SearchResultsInner: "default",
RecentsChannelHeader: "default", RecentsChannelHeader: "default",
ChannelMention: "ChannelMention" RichChannelMention: "ChannelMention"
} }
}; };
@ -508,7 +508,7 @@ module.exports = (_ => {
} }
} }
processChannelMention (e) { processRichChannelMention (e) {
if (e.instance.props.id && settings.changeInMentions) { if (e.instance.props.id && settings.changeInMentions) {
let name = (changedChannels[e.instance.props.id] || {}).name; let name = (changedChannels[e.instance.props.id] || {}).name;
let color = this.getChannelDataColor(e.instance.props.id); let color = this.getChannelDataColor(e.instance.props.id);

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "EditUsers", "name": "EditUsers",
"author": "DevilBro", "author": "DevilBro",
"version": "4.1.5", "version": "4.1.6",
"description": "Allow you to change the icon, name, tag and color of users" "description": "Allow you to change the icon, name, tag and color of users"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Incoming Call Popup": "" "Mentions": ""
} }
} }
}; };
@ -148,8 +148,8 @@ module.exports = (_ => {
MessageContent: "type", MessageContent: "type",
Reaction: "render", Reaction: "render",
ReactorsComponent: "render", ReactorsComponent: "render",
Mention: "default", UserMention: "default",
UserMention: "UserMention", RichUserMention: "UserMention",
ChannelReply: "default", ChannelReply: "default",
MemberListItem: "render", MemberListItem: "render",
UserHook: "render", UserHook: "render",
@ -393,7 +393,7 @@ module.exports = (_ => {
} }
processNameTag (e) { processNameTag (e) {
if (e.instance.props.user && (e.instance.props.className || e.instance.props.usernameClass)) { if (e.returnvalue && e.instance.props.user && (e.instance.props.className || e.instance.props.usernameClass)) {
let change = false, guildId = null; let change = false, guildId = null;
let changeBackground = false; let changeBackground = false;
let tagClass = ""; let tagClass = "";
@ -717,13 +717,14 @@ module.exports = (_ => {
} }
} }
processMention (e) { processUserMention (e) {
if (e.instance.props.userId && settings.changeInMentions && changedUsers[e.instance.props.userId] && this.shouldChangeInChat()) { if (e.instance.props.userId && settings.changeInMentions && changedUsers[e.instance.props.userId] && this.shouldChangeInChat()) {
this.changeMention(e.returnvalue, changedUsers[e.instance.props.userId]); let mention = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"});
if (mention) this.changeMention(mention, changedUsers[e.instance.props.userId]);
} }
} }
processUserMention (e) { processRichUserMention (e) {
if (e.instance.props.id && settings.changeInMentions && changedUsers[e.instance.props.id] && this.shouldChangeInChat()) { if (e.instance.props.id && settings.changeInMentions && changedUsers[e.instance.props.id] && this.shouldChangeInChat()) {
let data = changedUsers[e.instance.props.id]; let data = changedUsers[e.instance.props.id];
let tooltipChildren = BDFDB.ObjectUtils.get(e, "returnvalue.props.text.props.children"); let tooltipChildren = BDFDB.ObjectUtils.get(e, "returnvalue.props.text.props.children");

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "RemoveBlockedMessages", "name": "RemoveBlockedMessages",
"author": "DevilBro", "author": "DevilBro",
"version": "1.2.3", "version": "1.2.4",
"description": "Removes blocked messages/users completely" "description": "Removes blocked messages/users completely"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Update Reactions": "Fixed issue where reaction sometimes wouldn't show up at all, really now" "Mentions": ""
} }
} }
}; };
@ -103,7 +103,8 @@ module.exports = (_ => {
Reactions: "render", Reactions: "render",
MemberListItem: "render", MemberListItem: "render",
VoiceUser: "render", VoiceUser: "render",
Mention: "default" UserMention: "default",
RichUserMention: "UserMention"
} }
}; };
@ -373,9 +374,16 @@ module.exports = (_ => {
if (settings.removeUsers && BDFDB.ArrayUtils.is(e.instance.props.users)) e.instance.props.users = [].concat(e.instance.props.users).filter(n => !n || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.id)); if (settings.removeUsers && BDFDB.ArrayUtils.is(e.instance.props.users)) e.instance.props.users = [].concat(e.instance.props.users).filter(n => !n || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.id));
} }
processMention (e) { processUserMention (e) {
if (settings.removeMentions && e.instance.props.userId && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.userId)) return BDFDB.ReactUtils.createElement("span", { if (e.instance.props.userId && settings.removeMentions && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.userId)) return BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCNS.mention + BDFDB.disCN.mentionwrapper, className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.mention, BDFDB.disCN.mentionwrapper, e.instance.props.className),
children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER]
});
}
processRichUserMention (e) {
if (e.instance.props.id && settings.removeMentions && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.id)) return BDFDB.ReactUtils.createElement("span", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.mention, BDFDB.disCN.mentionwrapper, e.instance.props.className),
children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER] children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER]
}); });
} }

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "RemoveNicknames", "name": "RemoveNicknames",
"author": "DevilBro", "author": "DevilBro",
"version": "1.3.6", "version": "1.3.7",
"description": "Replace all nicknames with the actual accountnames" "description": "Replace all nicknames with the actual accountnames"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Messages": "Works in messages again" "Mentions": ""
} }
} }
}; };
@ -68,10 +68,10 @@ module.exports = (_ => {
onLoad () { onLoad () {
this.defaults = { this.defaults = {
settings: { settings: {
replaceOwn: {value: false, inner: false, description: "Replace your own name: "}, replaceOwn: {value: false, inner: false, description: "Replace your own Name"},
replaceBots: {value: true, inner: false, description: "Replace the nickname of bots: "}, replaceBots: {value: true, inner: false, description: "Replace the Nickname of Bots"},
addNickname: {value: false, inner: false, description: "Add nickname as parentheses: "}, addNickname: {value: false, inner: false, description: "Add Nickname as Parentheses"},
swapPositions: {value: false, inner: false, description: "Swap the position of username and nickname: "}, swapPositions: {value: false, inner: false, description: "Swap the Position of Username and Nickname"},
changeInChatWindow: {value: true, inner: true, description: "Messages"}, changeInChatWindow: {value: true, inner: true, description: "Messages"},
changeInReactions: {value: true, inner: true, description: "Reactions"}, changeInReactions: {value: true, inner: true, description: "Reactions"},
changeInMentions: {value: true, inner: true, description: "Mentions"}, changeInMentions: {value: true, inner: true, description: "Mentions"},
@ -92,8 +92,8 @@ module.exports = (_ => {
after: { after: {
TypingUsers: "render", TypingUsers: "render",
Reaction: "render", Reaction: "render",
Mention: "default", UserMention: "default",
UserMention: "UserMention" RichUserMention: "UserMention"
} }
}; };
} }
@ -197,14 +197,15 @@ module.exports = (_ => {
}); });
} }
processMention (e) { processUserMention (e) {
if (e.instance.props.userId && settings.changeInMentions) { if (e.instance.props.userId && settings.changeInMentions) {
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.userId)); let mention = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"});
if (newName) e.returnvalue.props.children[0] = "@" + newName; let newName = mention && this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.userId));
if (newName) mention.props.children[0] = "@" + newName;
} }
} }
processUserMention (e) { processRichUserMention (e) {
if (e.instance.props.id && settings.changeInMentions && typeof e.returnvalue.props.children == "function") { if (e.instance.props.id && settings.changeInMentions && typeof e.returnvalue.props.children == "function") {
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id)); let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id));
if (newName) { if (newName) {