Update ChatAliases.plugin.js

This commit is contained in:
Mirco Wittrien 2020-05-15 11:27:13 +02:00
parent 46ca9aaea8
commit ee95510cae
1 changed files with 8 additions and 6 deletions

View File

@ -4,13 +4,17 @@ var ChatAliases = (_ => {
return class ChatAliases { return class ChatAliases {
getName () {return "ChatAliases";} getName () {return "ChatAliases";}
getVersion () {return "2.1.0";} getVersion () {return "2.1.1";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
getDescription () {return "Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.";} getDescription () {return "Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.";}
constructor () { constructor () {
this.changelog = {
"fixed":[["Left over placeholder","Sending a an aliases for a file upload without any other text no longer leaves the message in the textarea"]]
};
this.patchedModules = { this.patchedModules = {
before: { before: {
ChannelAutoComplete: "render", ChannelAutoComplete: "render",
@ -379,11 +383,9 @@ var ChatAliases = (_ => {
if (messageData) { if (messageData) {
if (messageData.text != null) { if (messageData.text != null) {
e2.methodArguments[textIndex] = messageData.text; e2.methodArguments[textIndex] = messageData.text;
if (!messageData.text) { e.instance.state.textValue = "";
e.instance.props.textValue = ""; if (e.instance.state.richValue) e.instance.state.richValue = BDFDB.SlateUtils.copyRichValue("", e.instance.state.richValue);
if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.copyRichValue("", e.instance.props.richValue); BDFDB.ReactUtils.forceUpdate(e.instance);
BDFDB.ReactUtils.forceUpdate(e.instance);
}
} }
if (messageData.files.length > 0 && (BDFDB.DMUtils.isDMChannel(e.instance.props.channel.id) || BDFDB.UserUtils.can("ATTACH_FILES"))) { if (messageData.files.length > 0 && (BDFDB.DMUtils.isDMChannel(e.instance.props.channel.id) || BDFDB.UserUtils.can("ATTACH_FILES"))) {
BDFDB.LibraryModules.UploadUtils.instantBatchUpload(e.instance.props.channel.id, messageData.files); BDFDB.LibraryModules.UploadUtils.instantBatchUpload(e.instance.props.channel.id, messageData.files);