This commit is contained in:
Mirco Wittrien 2021-03-10 09:11:29 +01:00
parent cad0ac5a52
commit c876a6dec1
3 changed files with 10 additions and 9 deletions

View File

@ -636,7 +636,7 @@ module.exports = (_ => {
processMessageContent (e) { processMessageContent (e) {
if (e.instance.props.message && settings.changeInChatWindow && this.shouldChangeInChat(e.instance.props.message.channel_id)) { if (e.instance.props.message && settings.changeInChatWindow && this.shouldChangeInChat(e.instance.props.message.channel_id)) {
if (!e.returnvalue) { if (!e.returnvalue) {
if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT) { 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)})); 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)}));
let data = changedUsers[e.instance.props.message.author.id]; let data = changedUsers[e.instance.props.message.author.id];
if (data) { if (data) {

View File

@ -2,7 +2,7 @@
* @name MessageUtilities * @name MessageUtilities
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.8.7 * @version 1.8.8
* @description Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.) * @description Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.)
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "MessageUtilities", "name": "MessageUtilities",
"author": "DevilBro", "author": "DevilBro",
"version": "1.8.7", "version": "1.8.8",
"description": "Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.)" "description": "Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.)"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Edit": "Trying to edit a message that is alsready being edited no longer resets the edit" "Replies": "Reply To/Pin now also works on Messages that contain a reply"
} }
} }
}; };
@ -366,9 +366,9 @@ module.exports = (_ => {
doDelete ({messageDiv, message}, action) { doDelete ({messageDiv, message}, action) {
let deleteLink = messageDiv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotoperations + BDFDB.dotCN.anchor); let deleteLink = messageDiv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotoperations + BDFDB.dotCN.anchor);
if (deleteLink) deleteLink.click(); if (deleteLink) deleteLink.click();
else { else if (BDFDB.DiscordConstants.MessageTypesDeletable[message.type]) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id); let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if ((channel && BDFDB.UserUtils.can("MANAGE_MESSAGES")) || message.author.id == BDFDB.UserUtils.me.id && message.type != 1 && message.type != 2 && message.type != 3) { if (channel && (BDFDB.UserUtils.can("MANAGE_MESSAGES") || message.author.id == BDFDB.UserUtils.me.id)) {
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != BDFDB.DiscordConstants.MessageStates.SENT); BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != BDFDB.DiscordConstants.MessageStates.SENT);
if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.GUILD_SETTINGS_FOLLOWER_ANALYTICS_MESSAGE_DELETED), {type: "success"}); if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.GUILD_SETTINGS_FOLLOWER_ANALYTICS_MESSAGE_DELETED), {type: "success"});
} }
@ -393,7 +393,7 @@ module.exports = (_ => {
doPinUnPin ({messageDiv, message}, action) { doPinUnPin ({messageDiv, message}, action) {
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) { if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id); let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT) { if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && (message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || message.type == BDFDB.DiscordConstants.MessageTypes.REPLY)) {
if (message.pinned) { if (message.pinned) {
BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id); BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.MESSAGE_UNPINNED), {type: "danger"}); if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.MESSAGE_UNPINNED), {type: "danger"});
@ -409,7 +409,8 @@ module.exports = (_ => {
doReply ({messageDiv, message}, action) { doReply ({messageDiv, message}, action) {
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) { if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id); let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES")) && message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT) { console.log(message);
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES")) && (message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || message.type == BDFDB.DiscordConstants.MessageTypes.REPLY)) {
BDFDB.LibraryModules.MessageManageUtils.replyToMessage(channel, message); BDFDB.LibraryModules.MessageManageUtils.replyToMessage(channel, message);
if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.NOTIFICATION_REPLY), {type: "success"}); if (toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.NOTIFICATION_REPLY), {type: "success"});
} }

View File

@ -221,7 +221,7 @@ module.exports = (_ => {
} }
let groupId, author; let groupId, author;
for (let i in newStream) { for (let i in newStream) {
if (newStream[i].type == "MESSAGE" && newStream[i].content.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT && groupId != newStream[i].groupId) { if (newStream[i].type == "MESSAGE" && (newStream[i].content.type.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || newStream[i].content.type.type == BDFDB.DiscordConstants.MessageTypes.REPLY) && groupId != newStream[i].groupId) {
if (author && author.id == newStream[i].content.author.id && author.username == newStream[i].content.author.username) newStream[i] = Object.assign({}, newStream[i], {groupId: groupId}); if (author && author.id == newStream[i].content.author.id && author.username == newStream[i].content.author.username) newStream[i] = Object.assign({}, newStream[i], {groupId: groupId});
author = newStream[i].content.author; author = newStream[i].content.author;
} }