This commit is contained in:
Mirco Wittrien 2020-02-27 11:53:07 +01:00
parent 5b0fa29077
commit e328d83128
6 changed files with 28 additions and 22 deletions

View File

@ -7,7 +7,7 @@ var BadgesEverywhere = (_ => {
return class BadgesEverywhere {
getName () {return "BadgesEverywhere";}
getVersion () {return "1.5.2";}
getVersion () {return "1.5.3";}
getAuthor () {return "DevilBro";}
@ -245,7 +245,8 @@ var BadgesEverywhere = (_ => {
processMessageHeader (e) {
if (e.instance.props.message && BDFDB.DataUtils.get(this, "settings", "showInChat")) {
this.injectBadges(e.instance, e.returnvalue.props.children[2].props.children, e.instance.props.message.author, "chat");
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue.props.children.slice(1), {name: "Popout"});
if (index > -1) this.injectBadges(e.instance, children, e.instance.props.message.author, "chat");
}
}

View File

@ -222,7 +222,7 @@ var CustomQuoter = (_ => {
let unquotedLines = message.content.split("\n").filter(line => !line.startsWith("> "));
unquotedLines = unquotedLines.slice(unquotedLines.findIndex(line => line.trim().length > 0)).join("\n");
let guild = channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: channel.guild_id, name: "Test Server"}) : {id: "@me", name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
let guild = channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: channel.guild_id, name: "Test Server"}) : {id: BDFDB.DiscordConstants.ME, name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
return BDFDB.StringUtils.insertNRST(customQuote)

View File

@ -4,7 +4,7 @@ var EditUsers = (_ => {
return class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.7.8";}
getVersion () {return "3.7.9";}
getAuthor () {return "DevilBro";}
@ -484,19 +484,21 @@ var EditUsers = (_ => {
processMessageHeader (e) {
if (e.instance.props.message && BDFDB.DataUtils.get(this, "settings", "changeInChatWindow")) {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.message.author.id);
if (data && (data.color1 || data.color2)) {
let usernamePopout = BDFDB.ReactUtils.getValue(e, "returnvalue.props.children.2.props.children.1")
if (usernamePopout && usernamePopout.props && typeof usernamePopout.props.children == "function") {
let renderChildren = usernamePopout.props.children;
usernamePopout.props.children = (...args) => {
let renderedChildren = renderChildren(...args);
this.changeUserColor(renderedChildren, e.instance.props.message.author.id);
return renderedChildren;
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue.props.children.slice(1), {name: "Popout"});
if (index > -1) {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.message.author.id);
if (data && (data.color1 || data.color2)) {
if (children[index] && children[index].props && typeof children[index].props.children == "function") {
let renderChildren = children[index].props.children;
children[index].props.children = (...args) => {
let renderedChildren = renderChildren(...args);
this.changeUserColor(renderedChildren, e.instance.props.message.author.id);
return renderedChildren;
}
}
}
this.injectBadge(children, e.instance.props.message.author.id, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, 2, e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy);
}
this.injectBadge(e.returnvalue.props.children[2].props.children, e.instance.props.message.author.id, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, 2, e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy);
}
}

View File

@ -324,7 +324,7 @@ var MessageUtilities = (_ => {
doCopyLink ({messagediv, message}, action) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel) {
BDFDB.LibraryRequires.electron.clipboard.write({text:`https://discordapp.com/channels/${channel.guild_id || "@me"}/${channel.id}/${message.id}`});
BDFDB.LibraryRequires.electron.clipboard.write({text:`https://discordapp.com/channels/${channel.guild_id || BDFDB.DiscordConstants.ME}/${channel.id}/${message.id}`});
if (BDFDB.DataUtils.get(this, "toasts", action)) BDFDB.NotificationUtils.toast("Messagelink has been copied.", {type:"success"});
}
}

View File

@ -4,7 +4,7 @@ var OwnerTag = (_ => {
return class OwnerTag {
getName () {return "OwnerTag";}
getVersion () {return "1.2.5";}
getVersion () {return "1.2.6";}
getAuthor () {return "DevilBro";}
@ -161,7 +161,10 @@ var OwnerTag = (_ => {
processMessageHeader (e) {
if (e.instance.props.message && BDFDB.DataUtils.get(this, "settings", "addInChatWindow")) {
let usertype = this.getUserType(e.instance.props.message.author);
if (usertype) this.injectOwnerTag(e.returnvalue.props.children[2].props.children, e.instance.props.message.author, usertype, e.instance.props.compact ? 0 : 2, e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy);
if (usertype) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue.props.children.slice(1), {name: "Popout"});
if (index > -1) this.injectOwnerTag(children, e.instance.props.message.author, usertype, e.instance.props.compact ? 0 : 2, e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy);
}
}
}

View File

@ -374,7 +374,7 @@ var PersonalPins = (_ => {
messages = messages.filter(messagedata => messagedata.channel_id == currentchannel.id);
break;
case "server":
messages = messages.filter(messagedata => messagedata.guild_id == (currentchannel.guild_id || "@me"));
messages = messages.filter(messagedata => messagedata.guild_id == (currentchannel.guild_id || BDFDB.DiscordConstants.ME));
break;
case "allservers":
messages = messages;
@ -500,7 +500,7 @@ var PersonalPins = (_ => {
if (!message) return;
let notes = BDFDB.DataUtils.load(this, "notes");
channel = channel || BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
let guild_id = channel.guild_id || "@me";
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
notes[guild_id] = notes[guild_id] || {};
notes[guild_id][channel.id] = notes[guild_id][channel.id] || {}
if (!notes[guild_id][channel.id][message.id]) {
@ -525,7 +525,7 @@ var PersonalPins = (_ => {
getNoteData (message, channel) {
if (!message) return;
channel = channel || BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
let guild_id = channel.guild_id || "@me";
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
let notes = BDFDB.DataUtils.load(this, "notes");
return notes[guild_id] && notes[guild_id][channel.id] && notes[guild_id][channel.id][message.id];
}
@ -534,7 +534,7 @@ var PersonalPins = (_ => {
let message = JSON.parse(note.message);
let channel = JSON.parse(note.channel);
if (!message || !channel) return;
let guild_id = channel.guild_id || "@me";
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
let notes = BDFDB.DataUtils.load(this, "notes");
notes[guild_id][channel.id][note.id].message = JSON.stringify(newmessage);
BDFDB.DataUtils.save(notes, this, "notes");
@ -545,7 +545,7 @@ var PersonalPins = (_ => {
let message = JSON.parse(note.message);
let channel = JSON.parse(note.channel);
if (!message || !channel) return;
let guild_id = channel.guild_id || "@me";
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
let notes = BDFDB.DataUtils.load(this, "notes");
delete notes[guild_id][channel.id][note.id];
if (BDFDB.ObjectUtils.isEmpty(notes[guild_id][channel.id])) {