Skip to content

Commit

Permalink
Another start fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bitslayn committed Jun 15, 2024
1 parent da835aa commit 135f233
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 51 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.33.2",
"prettier": "^3.0.3",
"replugged": "^4.7.10",
"replugged": "^4.7.13",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
94 changes: 49 additions & 45 deletions plugins/btw.bitslayn.channelIcons/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,54 +407,58 @@ export function start(): void {
});
}

// eslint-disable-next-line consistent-return
inject.utils.addMenuItem(ContextMenuTypes.ChannelContext, (data: any) => {
const { channel } = data;
// the code below gives a random modern icon uwu ;3 rawr x3 *waggles tail*
const Object = group1Array[randomNumber(group1Array.length)];
let RandomIcon: ComponentType<any>;
// shut up.
// eslint-disable-next-line no-undefined
if (Object.Name !== undefined) {
RandomIcon = webpack.getByProps(Object.Name)?.[Object?.Name];
}
// the code above gives a random modern icon uwu ;3 rawr x3 *waggles tail*
if (channel.type !== 4) {
return (
<MenuItem
id={`customize-channel-${channel.id}`}
label="Personalize Channel"
/* the code below gives discord an icon to display */
icon={RandomIcon}
/* the code above gives discord an icon to display */
action={() => openEditor(data)}
/>
);
}
});
if (ContextMenuTypes.ChannelContext !== undefined) {
// eslint-disable-next-line consistent-return
inject.utils.addMenuItem(ContextMenuTypes.ChannelContext, (data: any) => {
const { channel } = data;
// the code below gives a random modern icon uwu ;3 rawr x3 *waggles tail*
const Object = group1Array[randomNumber(group1Array.length)];
let RandomIcon: ComponentType<any>;
// shut up.
// eslint-disable-next-line no-undefined
if (Object.Name !== undefined) {
RandomIcon = webpack.getByProps(Object.Name)?.[Object?.Name];
}
// the code above gives a random modern icon uwu ;3 rawr x3 *waggles tail*
if (channel.type !== 4) {
return (
<MenuItem
id={`customize-channel-${channel.id}`}
label="Personalize Channel"
/* the code below gives discord an icon to display */
icon={RandomIcon}
/* the code above gives discord an icon to display */
action={() => openEditor(data)}
/>
);
}
});
}

inject.after(ChannelClass, "default", (a: any) => {
const channelInstance: any = a?.[0];
if (channelInstance && config.get("changeChannelNames", [])) {
const channel: any = ChannelStore.getChannel(channelInstance.channel.id);
const oldName: string = channel.name;
if (!isChannelIdExists(channel.id)) {
channel.name = capitalizeWords(oldName, specialCases, lowercaseExceptions);
changedChannelNames.push({ channelid: channel.id, oldName });
if (ChannelClass !== undefined) {
inject.after(ChannelClass, "default", (a: any) => {
const channelInstance: any = a?.[0];
if (channelInstance && config.get("changeChannelNames", [])) {
const channel: any = ChannelStore.getChannel(channelInstance.channel.id);
const oldName: string = channel.name;
if (!isChannelIdExists(channel.id)) {
channel.name = capitalizeWords(oldName, specialCases, lowercaseExceptions);
changedChannelNames.push({ channelid: channel.id, oldName });
}
}
}
if (!config.get("changeChannelNames", [])) {
changedChannelNames.forEach(
({ channelid, oldName }: { channelid: string; oldName: string }) => {
const channel: any = ChannelStore.getChannel(channelid);
if (channel) {
channel.name = oldName;
// changedChannelNames.length -= 1;
if (!config.get("changeChannelNames", [])) {
changedChannelNames.forEach(
({ channelid, oldName }: { channelid: string; oldName: string }) => {
const channel: any = ChannelStore.getChannel(channelid);
if (channel) {
channel.name = oldName;
// changedChannelNames.length -= 1;
}
}
}
);
}
});
);
}
});
}
}

export function getChangedChannelNames(): any[] {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 135f233

Please sign in to comment.