Compare commits
3 commits
0d23fdeb41
...
f6d3312244
Author | SHA1 | Date | |
---|---|---|---|
f6d3312244 | |||
89ded967ce | |||
c5a3472c46 |
3 changed files with 226 additions and 0 deletions
152
src/userplugins/FriendshipRanks/index.tsx
Normal file
152
src/userplugins/FriendshipRanks/index.tsx
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import { Margins } from "@utils/margins";
|
||||||
|
import { ModalSize, openModal } from "@utils/modal";
|
||||||
|
import { Modals } from "@utils/modal";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
import { RelationshipStore } from "@webpack/common";
|
||||||
|
import { Flex } from "@webpack/common";
|
||||||
|
import { Forms } from "@webpack/common";
|
||||||
|
|
||||||
|
interface rankInfo {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
requirement: number;
|
||||||
|
assetURL: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function daysSince(dateString: string): number {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
const currentDate = new Date();
|
||||||
|
|
||||||
|
const differenceInMs = currentDate.getTime() - date.getTime();
|
||||||
|
|
||||||
|
const days = differenceInMs / (1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
|
return Math.floor(days);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ranks: rankInfo[] =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
title: "Sprout",
|
||||||
|
description: "Your friendship is just starting",
|
||||||
|
requirement: 0,
|
||||||
|
assetURL: "https://files.catbox.moe/d6gis2.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Blooming",
|
||||||
|
description: "Your friendship is getting there! (1 Month)",
|
||||||
|
requirement: 30,
|
||||||
|
assetURL: "https://files.catbox.moe/z7fxjq.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Burning",
|
||||||
|
description: "Your friendship has reached terminal velocity :o (3 Months)",
|
||||||
|
requirement: 90,
|
||||||
|
assetURL: "https://files.catbox.moe/8oiu0o.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Star",
|
||||||
|
description: "Your friendship has been going on for a WHILE (1 Year)",
|
||||||
|
requirement: 365,
|
||||||
|
assetURL: "https://files.catbox.moe/7bpe7v.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Royal",
|
||||||
|
description: "Your friendship has gone through thick and thin- a whole 2 years!",
|
||||||
|
requirement: 730,
|
||||||
|
assetURL: "https://files.catbox.moe/0yp9mp.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Besties",
|
||||||
|
description: "How do you even manage this??? (5 Years)",
|
||||||
|
assetURL: "https://files.catbox.moe/qojb7d.webp",
|
||||||
|
requirement: 1826.25
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function openRankModal(rank: rankInfo) {
|
||||||
|
openModal(props => (
|
||||||
|
<ErrorBoundary>
|
||||||
|
<Modals.ModalRoot {...props} size={ModalSize.DYNAMIC}>
|
||||||
|
<Modals.ModalHeader>
|
||||||
|
<Flex style={{ width: "100%", justifyContent: "center" }}>
|
||||||
|
<Forms.FormTitle
|
||||||
|
tag="h2"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
textAlign: "center",
|
||||||
|
margin: 0
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Your friendship rank
|
||||||
|
</Forms.FormTitle>
|
||||||
|
</Flex>
|
||||||
|
</Modals.ModalHeader>
|
||||||
|
<Modals.ModalContent>
|
||||||
|
<div style={{ padding: "1em", textAlign: "center" }}>
|
||||||
|
<Forms.FormText className={Margins.bottom20}>
|
||||||
|
{rank.title}
|
||||||
|
</Forms.FormText>
|
||||||
|
<img src={rank.assetURL} style={{ height: "150px" }} />
|
||||||
|
<Forms.FormText className={Margins.top16}>
|
||||||
|
{rank.description}
|
||||||
|
</Forms.FormText>
|
||||||
|
</div>
|
||||||
|
</Modals.ModalContent>
|
||||||
|
</Modals.ModalRoot>
|
||||||
|
</ErrorBoundary >
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBadgesToApply() {
|
||||||
|
|
||||||
|
const badgesToApply: ProfileBadge[] = ranks.map((rank, index, self) => {
|
||||||
|
return (
|
||||||
|
{
|
||||||
|
description: rank.title,
|
||||||
|
image: rank.assetURL,
|
||||||
|
props: {
|
||||||
|
style: {
|
||||||
|
transform: "scale(0.8)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shouldShow: (info: BadgeUserArgs) => {
|
||||||
|
if (!RelationshipStore.isFriend(info.user.id)) { return false; }
|
||||||
|
|
||||||
|
const days = daysSince(RelationshipStore.getSince(info.user.id));
|
||||||
|
|
||||||
|
if (self[index + 1] == null) {
|
||||||
|
return days > rank.requirement;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (days > rank.requirement && days < self[index + 1].requirement);
|
||||||
|
},
|
||||||
|
onClick: () => openRankModal(rank)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return badgesToApply;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "FriendshipRanks",
|
||||||
|
description: "Adds badges showcasing how long you have been friends with a user for",
|
||||||
|
authors: [
|
||||||
|
Devs.Samwich
|
||||||
|
],
|
||||||
|
start() {
|
||||||
|
getBadgesToApply().forEach(thing => Vencord.Api.Badges.addBadge(thing));
|
||||||
|
|
||||||
|
},
|
||||||
|
stop() {
|
||||||
|
getBadgesToApply().forEach(thing => Vencord.Api.Badges.removeBadge(thing));
|
||||||
|
},
|
||||||
|
});
|
44
src/userplugins/ModViewBypass/index.tsx
Normal file
44
src/userplugins/ModViewBypass/index.tsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "ModViewBypass",
|
||||||
|
description: "Open the mod view sidebar in guilds you don't have moderator permissions in, or where the experiment is disabled.",
|
||||||
|
authors: [Devs.Sqaaakoi],
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "canAccessGuildMemberModViewWithExperiment:",
|
||||||
|
replacement: {
|
||||||
|
match: /canAccessGuildMemberModViewWithExperiment:function\(\){return\s\i/,
|
||||||
|
replace: "canAccessGuildMemberModViewWithExperiment:function(){return ()=>true;",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "useCanAccessGuildMemberModView:",
|
||||||
|
replacement: {
|
||||||
|
match: /\i.default.hasAny\(/,
|
||||||
|
replace: "true; (",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "isInGuildMemberModViewExperiment:",
|
||||||
|
replacement: {
|
||||||
|
match: /isInGuildMemberModViewExperiment:function\(\){return\s\i/,
|
||||||
|
replace: "isInGuildMemberModViewExperiment:function(){return ()=>true;",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "useGuildMemberModViewExperiment:",
|
||||||
|
replacement: {
|
||||||
|
match: /useGuildMemberModViewExperiment:function\(\){return\s\i/,
|
||||||
|
replace: "useGuildMemberModViewExperiment:function(){return ()=>true;",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
30
src/userplugins/SelfShopPreview/index.tsx
Normal file
30
src/userplugins/SelfShopPreview/index.tsx
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { UserStore } from "@webpack/common";
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "SelfShopPreview",
|
||||||
|
description: "Adds your own profile picture to the decorations in the shop",
|
||||||
|
|
||||||
|
authors:
|
||||||
|
[
|
||||||
|
Devs.Samwich
|
||||||
|
],
|
||||||
|
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "className:G.avatarContainer,",
|
||||||
|
replacement: {
|
||||||
|
match: /src:er,/,
|
||||||
|
replace: 'src:$self.avatarUrl(),'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
avatarUrl: GetAvatarUrl
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function GetAvatarUrl() {
|
||||||
|
return UserStore.getCurrentUser().getAvatarURL();
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue