-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (35 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { Plugin } = require("powercord/entities");
const {
Webpack: {
FindModule,
CommonModules: { React },
},
Tools: { ReactTools },
} = KLibrary;
const MiniPopover = FindModule.byFilter(
(m) => m.default.displayName === "MiniPopover"
);
const BlockButton = require("./components/BlockButton");
const { findInReactTree } = require("powercord/util");
const { inject, uninject } = require("powercord/injector");
module.exports = class BlockMessages extends Plugin {
async startPlugin() {
this.loadStylesheet("style.scss");
inject("block-messages-button", MiniPopover, "default", (args, res) => {
const props = findInReactTree(res, (r) => r?.message);
if (!props) return res;
res.props.children.unshift(
React.createElement(BlockButton, {
message: props.message,
})
);
return res;
});
MiniPopover.default.displayName = "MiniPopover";
ReactTools.rerenderAllMessages();
}
pluginWillUnload() {
uninject("block-messages-button");
ReactTools.rerenderAllMessages();
}
};