Skip to content

Commit

Permalink
Merge pull request #10 from FedeIlLeone/main
Browse files Browse the repository at this point in the history
fix(InvisibleTyping): ChannelTextAreaButtons module being undefined
  • Loading branch information
12944qwerty authored Jan 13, 2025
2 parents 4ac2451 + 6711b6c commit 619ce7c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions plugins/invisible-typing/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Injector, common, settings, webpack } from "replugged";
import { Injector, Logger, common, settings, webpack } from "replugged";
import "./style.css";

import { Icon } from "./Icon";
export { Settings } from "./Settings";

const inject = new Injector();
const logger = Logger.plugin("InvisibleTyping");

const { React, typing } = common;

Expand All @@ -28,9 +29,18 @@ export async function start(): Promise<void> {
}
});

const ChannelTextAreaButtons = await webpack.waitForModule<{
const channelTextAreaButtonsMod = await webpack.waitForModule(
webpack.filters.bySource(/{disabled:\w+,type:\w+},"emoji"/),
);
const ChannelTextAreaButtons = webpack.getExportsForProps<{
type: (args: { type: { analyticsName: string } }) => React.ReactElement | null;
}>(webpack.filters.bySource(/{disabled:\w+,type:\w+},"emoji"/));
}>(channelTextAreaButtonsMod, ["type"]);

if (!ChannelTextAreaButtons) {
logger.error("Couldn't find ChannelTextAreaButtons");
return;
}

inject.after(ChannelTextAreaButtons, "type", ([args], res) => {
if (res) {
res.props.children.splice(1, 0, React.createElement(Icon, { type: args.type }));
Expand Down

0 comments on commit 619ce7c

Please sign in to comment.