MessageClickActions: Misc Fixes (#597)
* MessageClickActions: add optional triple click action for reacting to messages * fix(MessageClickActions): handle API failures gracefully and log errors * fix(MessageClickActions): regex now matches emoji naming requirements * Fix formatting of IDs in constants file * fix(MessageClickActions): remove unnecessary selection clear after triple click action * fix(MessageClickActions): add cleanup, use Constants.Endpoints, and replace console.error with Logger * fix css --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
3172fb5997
commit
038aa10bbf
2 changed files with 11 additions and 5 deletions
|
|
@ -20,10 +20,11 @@ import { isPluginEnabled } from "@api/PluginManager";
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import NoReplyMentionPlugin from "@plugins/noReplyMention";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { ApplicationIntegrationType, MessageFlags } from "@vencord/discord-types/enums";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { AuthenticationStore, FluxDispatcher, MessageTypeSets, PermissionsBits, PermissionStore, RestAPI, WindowStore } from "@webpack/common";
|
||||
import { AuthenticationStore, Constants, FluxDispatcher, MessageTypeSets, PermissionsBits, PermissionStore, RestAPI, WindowStore } from "@webpack/common";
|
||||
|
||||
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
|
||||
const EditStore = findByPropsLazy("isEditing", "isEditingAny");
|
||||
|
|
@ -80,10 +81,10 @@ async function react(channelId: string, messageId: string, emoji: string) {
|
|||
|
||||
try {
|
||||
await RestAPI.put({
|
||||
url: `/channels/${channelId}/messages/${messageId}/reactions/${emojiParam}/@me`
|
||||
url: Constants.Endpoints.REACTIONS(channelId, messageId, emojiParam)
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("[MessageClickActions] Failed to add reaction:", e);
|
||||
new Logger("MessageClickActions").error("Failed to add reaction:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +105,12 @@ export default definePlugin({
|
|||
document.removeEventListener("keydown", keydown);
|
||||
document.removeEventListener("keyup", keyup);
|
||||
WindowStore.removeChangeListener(focusChanged);
|
||||
|
||||
if (doubleClickTimeout) {
|
||||
clearTimeout(doubleClickTimeout);
|
||||
doubleClickTimeout = null;
|
||||
}
|
||||
pendingDoubleClickAction = null;
|
||||
},
|
||||
|
||||
onMessageClick(msg, channel, event) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
#vc-indicators-indicator-items {
|
||||
|
|
@ -73,4 +72,4 @@
|
|||
#vc-guildcount-icon {
|
||||
width: var(--size-14);
|
||||
height: var(--size-14);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue