change from template manifest

This commit is contained in:
winneratwin 2022-08-13 19:05:47 +01:00
parent f87c565aee
commit cdc6d3dc15
Signed by: winneratwin
GPG Key ID: CDBC42F8803D689E
2 changed files with 40 additions and 10 deletions

View File

@ -1,18 +1,48 @@
const { Plugin } = require("powercord/entities");
const { findInReactTree } = require("powercord/util");
const { getModule, React } = require("powercord/webpack");
const { getModule, getAllModules, React } = require("powercord/webpack");
const { inject, uninject } = require("powercord/injector");
const Settings = require("./components/Settings.jsx");
module.exports = class Sample extends Plugin {
async startPlugin() { // Called on load
this.log("Hello World!");
const MemberListItem = getModule(["AVATAR_DECORATION_PADDING"], false);
const d = (m) => {
const def = m.__powercordOriginal_default ?? m.default
return typeof def === 'function' ? def : null
}
const messageheadermodule = getModule((m) => d(m)?.displayName === "MessageHeader", false)
inject("banana", messageheadermodule, "default", ([props], res) => {
const { message: { id, author }, subscribeToGroupId } = props;
if (id !== subscribeToGroupId) {
return res;
}
//children
const children = res.props.username.props.children[1].props.children
if (!children || !Array.isArray(children)) {
return res;
}
const tag = React.createElement(
"h2",
{
style: { "display": "inline-block", "margin-left": "5px" },
key: `ChatUserID-${author.id}`,
},
` ${author.id} `
);
const pos = "beforebeginfalse"
const fn = (child) => child && child.key && child.key.startsWith('ChatUserID');
if (!children.find(fn)) children.splice(pos === 'beforebegin' ? 0 : 2, 0, tag);
inject("banana", MemberListItem.default, "type", ([props], res) => {
console.log(props.user);
return res;
});
}

View File

@ -1,7 +1,7 @@
{
"name": "! Sample Plugin",
"name": "userIdRedux",
"version": "0.0.1",
"description": "Sample tutorial plugin",
"author": "Lil Sizzurp",
"description": "horribly ported version of Arashiryuu's ChatUserIDsRedux",
"author": "winner#5393",
"license": "MIT"
}