Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ukriu committed Dec 14, 2023
1 parent db45d40 commit 83bf82c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vendetta/HideChatButtons/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "HideChatButtons",
"description": "Hides the gift and thread buttons in the chat input.",
"vendetta": {
"icon": "ThreadIcon"
}
}
19 changes: 19 additions & 0 deletions vendetta/HideChatButtons/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { findByName } from "@vendetta/metro";
import { after } from "@vendetta/patcher";
import { getAssetIDByName } from "@vendetta/ui/assets";
import { findInReactTree } from "@vendetta/utils";

const ChatInput = findByName("ChatInput");

let unpatch: () => boolean;

export default {
onLoad() {
const blockList = ["ic_thread_normal_24px", "ic_gift", "ThreadIcon"].map(n => getAssetIDByName(n));
unpatch = after("render", ChatInput.prototype, (_, ret) => {
const input = findInReactTree(ret, t => "forceAnimateButtons" in t.props && t.props.actions);
input.props.actions = input.props.actions.filter(a => !blockList.includes(a.source));
});
},
onUnload: unpatch
};

0 comments on commit 83bf82c

Please sign in to comment.