Update MessageUtilities.plugin.js
This commit is contained in:
parent
c73f1cc061
commit
062f7df6fa
|
@ -14,12 +14,16 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "MessageUtilities",
|
"name": "MessageUtilities",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"description": "Offer a number of useful message options. Remap the keybindings in the settings"
|
"description": "Offer a number of useful message options. Remap the keybindings in the settings"
|
||||||
},
|
},
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
|
"added": {
|
||||||
|
"Replies": "Added option for replies",
|
||||||
|
"Quotes": "Now requires CustomQuoter plugin since Discord replaces Quotes with Replies",
|
||||||
|
},
|
||||||
"fixed": {
|
"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: []} },
|
"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]} },
|
"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]} },
|
"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]} },
|
"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_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]} },
|
"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"},
|
"__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"},
|
"__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"}
|
"__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 = {}) {
|
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, {
|
for (let key in settings) if (this.defaults.settings[key].description) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||||
type: "Switch",
|
type: "Switch",
|
||||||
|
@ -189,7 +198,9 @@ module.exports = (_ => {
|
||||||
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
return settingsItems;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSettingsClosed () {
|
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) {
|
doCopyRaw ({messageDiv, message}, action) {
|
||||||
if (message.content) {
|
if (message.content) {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: message.content});
|
BDFDB.LibraryRequires.electron.clipboard.write({text: message.content});
|
||||||
|
@ -348,10 +369,9 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
doQuote ({messageDiv, message}, action) {
|
doQuote ({messageDiv, message}, action) {
|
||||||
|
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||||
if (channel && BDFDB.LibraryModules.QuoteUtils.canQuote(message, channel)) {
|
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Quote_Message.plugin).quote(channel, message);
|
||||||
BDFDB.LibraryModules.MessageManageUtils.quoteMessage(channel, message);
|
|
||||||
if (toasts[action]) BDFDB.NotificationUtils.toast("Quote has been created", {type: "success"});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue