Update MessageUtilities.plugin.js
This commit is contained in:
parent
c73f1cc061
commit
062f7df6fa
|
@ -14,12 +14,16 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "MessageUtilities",
|
||||
"author": "DevilBro",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Offer a number of useful message options. Remap the keybindings in the settings"
|
||||
},
|
||||
"changeLog": {
|
||||
"added": {
|
||||
"Replies": "Added option for replies",
|
||||
"Quotes": "Now requires CustomQuoter plugin since Discord replaces Quotes with Replies",
|
||||
},
|
||||
"fixed": {
|
||||
"Replies": "Works with messages including a reply"
|
||||
"Settings": "Fixed Settings"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -68,10 +72,11 @@ module.exports = (_ => {
|
|||
"Edit_Message": {name: "Edit Message", func: this.doEdit, value: {click: 1, keycombo: []} },
|
||||
"Delete_Message": {name: "Delete Message", func: this.doDelete, value: {click: 0, keycombo: [46]} },
|
||||
"Pin/Unpin_Message": {name: "Pin/Unpin Message", func: this.doPinUnPin, value: {click: 0, keycombo: [17]} },
|
||||
"Reply_to_Message": {name: "Reply to Message", func: this.doReply, value: {click: 0, keycombo: [17,84]} },
|
||||
"React_to_Message": {name: "Open React Menu", func: this.doOpenReact, value: {click: 0, keycombo: [17,83]} },
|
||||
"Copy_Raw": {name: "Copy raw Message", func: this.doCopyRaw, value: {click: 0, keycombo: [17,68]} },
|
||||
"Copy_Link": {name: "Copy Message Link", func: this.doCopyLink, value: {click: 0, keycombo: [17,81]} },
|
||||
"Quote_Message": {name: "Quote Message", func: this.doQuote, value: {click: 0, keycombo: [17,87]} },
|
||||
"__Quote_Message": {name: "Quote Message", func: this.doQuote, value: {click: 0, keycombo: [17,87]}, plugin: "CustomQuoter"},
|
||||
"__Note_Message": {name: "Note Message", func: this.doNote, value: {click: 0, keycombo: [16]}, plugin: "PersonalPins"},
|
||||
"__Translate_Message": {name: "Translate Message", func: this.doTranslate, value: {click: 0, keycombo: [20]}, plugin: "GoogleTranslateOption"},
|
||||
"__Reveal_Spoilers": {name: "Reveal All Spoilers", func: this.doReveal, value: {click: 0, keycombo: [17,74]}, plugin: "RevealAllSpoilersOption"}
|
||||
|
@ -110,7 +115,11 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getSettingsPanel (collapseStates = {}) {
|
||||
let settingsPanel, settingsItems = [];
|
||||
let settingsPanel;
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
|
||||
collapseStates: collapseStates,
|
||||
children: _ => {
|
||||
let settingsItems = [];
|
||||
|
||||
for (let key in settings) if (this.defaults.settings[key].description) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
type: "Switch",
|
||||
|
@ -189,7 +198,9 @@ module.exports = (_ => {
|
|||
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
||||
}));
|
||||
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
||||
return settingsItems;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onSettingsClosed () {
|
||||
|
@ -332,6 +343,16 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
|
||||
doReply ({messageDiv, message}, action) {
|
||||
if (message.state == "SENT") {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && BDFDB.UserUtils.can("SEND_MESSAGES") && message.type == 0) {
|
||||
BDFDB.LibraryModules.MessageManageUtils.replyToMessage(channel, message);
|
||||
if (toasts[action]) BDFDB.NotificationUtils.toast("Added reply to message", {type: "success"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doCopyRaw ({messageDiv, message}, action) {
|
||||
if (message.content) {
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text: message.content});
|
||||
|
@ -348,10 +369,9 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
doQuote ({messageDiv, message}, action) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && BDFDB.LibraryModules.QuoteUtils.canQuote(message, channel)) {
|
||||
BDFDB.LibraryModules.MessageManageUtils.quoteMessage(channel, message);
|
||||
if (toasts[action]) BDFDB.NotificationUtils.toast("Quote has been created", {type: "success"});
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Quote_Message.plugin).quote(channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue