mirror of
https://github.com/ryanamay/Vencord.git
synced 2024-09-20 00:50:34 +00:00
Compare commits
3 commits
80da8a08be
...
1f0c9c985f
Author | SHA1 | Date | |
---|---|---|---|
1f0c9c985f | |||
7735d1a07b | |||
af1c5c3c47 |
2 changed files with 30 additions and 17 deletions
|
@ -1,21 +1,21 @@
|
|||
# BetterGifSend
|
||||
|
||||
This plugin enhances your GIF-sharing experience by providing control over how GIFs are inserted or sent and whether the GIF picker remains open or closes after sending a GIF.
|
||||
This plugin adds configuration options regarding the GIF picker visibility/send behavior
|
||||
|
||||
## Configuration
|
||||
## Configuration Options
|
||||
|
||||
### GIF Picker Behavior
|
||||
### GIF picker visibility after selection
|
||||
|
||||
Control the visibility of the GIF picker after sending a GIF:
|
||||
- Close after sending (Default)
|
||||
- Always open
|
||||
- Stay open with SHIFT
|
||||
|
||||
- **Close after sending**: The picker will close immediately after sending a GIF. (Default)
|
||||
- **Always keep open**: The picker will always remain open after selecting a GIF.
|
||||
- **Keep open when SHIFT is held**: Keeps the GIF picker open if the SHIFT key is held down.
|
||||
### GIF selection behavior
|
||||
|
||||
### GIF Send Behavior
|
||||
- Send immediately (Default)
|
||||
- Insert into chatbox (also known as GifPaste)
|
||||
- Insert into chatbox with SHIFT
|
||||
|
||||
Control how GIFs are sent:
|
||||
### Clear Reply Context (Toggle, Enabled by default)
|
||||
|
||||
- **Send immediately**: Sends the GIF directly to the chat. (Default)
|
||||
- **Insert into chatbox**: Inserts the GIF URL into the chatbox, allowing you to add additional text before sending.
|
||||
- **Insert link if SHIFT is held**: Inserts the GIF URL into the chatbox if the SHIFT key is held down.
|
||||
- Clears the reply context after selecting a single GIF
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { insertTextIntoChatInputBox, sendMessage } from "@utils/discord";
|
||||
import { insertTextIntoChatInputBox } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { ExpressionPickerStore, SelectedChannelStore } from "@webpack/common";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { ExpressionPickerStore, FluxDispatcher, MessageActions, SelectedChannelStore } from "@webpack/common";
|
||||
|
||||
interface Gif {
|
||||
url: string;
|
||||
|
@ -29,16 +30,24 @@ const settings = definePluginSettings({
|
|||
sendBehavior: {
|
||||
type: OptionType.SELECT,
|
||||
default: "Send",
|
||||
description: "Choose how GIFs are added to your chats",
|
||||
description: "Choose how GIF selection is handled",
|
||||
restartNeeded: false,
|
||||
options: [
|
||||
{ value: "Send", label: "Send immediately" },
|
||||
{ value: "Insert", label: "Insert into chatbox" },
|
||||
{ value: "Insert", label: "Insert into chatbox (GifPaste behavior)" },
|
||||
{ value: "InsertWithShift", label: "Insert link if SHIFT is held" }
|
||||
]
|
||||
},
|
||||
clearReply: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
description: "Clear the reply context after sending a singular GIF",
|
||||
restartNeeded: false
|
||||
}
|
||||
});
|
||||
|
||||
const PendingReplyStore = findByPropsLazy("getPendingReply");
|
||||
|
||||
let shiftHeld = false;
|
||||
|
||||
function handleShift(event: KeyboardEvent): void {
|
||||
|
@ -78,7 +87,11 @@ export default definePlugin({
|
|||
if (sendBehavior === "Insert" || (sendBehavior === "InsertWithShift" && shiftHeld)) {
|
||||
insertTextIntoChatInputBox(gif.url + " ");
|
||||
} else {
|
||||
sendMessage(channel, { content: gif.url });
|
||||
const reply = PendingReplyStore.getPendingReply(channel);
|
||||
MessageActions.sendMessage(channel, { content: gif.url }, void 0, true, MessageActions.getSendMessageOptionsForReply(reply));
|
||||
if (settings.store.clearReply && reply) {
|
||||
FluxDispatcher.dispatch({ type: "DELETE_PENDING_REPLY", channelId: channel });
|
||||
}
|
||||
}
|
||||
|
||||
if (closeBehavior === "Close" || (closeBehavior === "ShiftOpen" && !shiftHeld)) {
|
||||
|
|
Loading…
Reference in a new issue