mutural friends

This commit is contained in:
MathMan05
2025-10-01 17:39:01 -05:00
parent 613949a996
commit f4280f6d52
5 changed files with 43 additions and 7 deletions
+2
View File
@@ -341,6 +341,8 @@ export type highMemberJSON = mainuserjson & {
id: string;
nick: null | string;
}[];
//Only reason this is optional is due to the fact that this is really new and I want to make sure the type checker checks this for me :3
mutual_friends?: userjson[];
};
type emojijson = {
name: string;
+1 -1
View File
@@ -441,7 +441,7 @@ class Member extends SnowFlake {
this.info.api +
"/users/" +
this.id +
"/profile?with_mutual_guilds=true&with_mutual_friends_count=true&guild_id=" +
"/profile?with_mutual_guilds=true&with_mutual_friends=true&guild_id=" +
this.guild.id,
{headers: this.guild.headers},
)
+16 -3
View File
@@ -12,6 +12,19 @@ body {
height: 100svh;
background: var(--primary-bg);
}
.mutFriends {
display: flex;
flex-direction: column;
align-items: stretch;
.createdWebhook {
flex-grow: 1;
background: var(--primary-bg);
margin-bottom: 6px;
width: 100%;
box-sizing: border-box;
}
}
.createdWebhook {
display: flex;
align-items: center;
@@ -23,9 +36,9 @@ body {
cursor: pointer;
.pfp {
width: 0.5in;
height: 0.5in;
margin-right: 0.15in;
width: 0.5in !important;
height: 0.5in !important;
margin-right: 0.15in !important;
}
}
.Mplayer {
+22 -2
View File
@@ -493,7 +493,8 @@ class User extends SnowFlake {
}
return pfp;
}
createWidget(guild: Guild) {
createWidget(guild?: Guild) {
guild = this.localuser.guildids.get("@me") as Guild;
const div = document.createElement("div");
div.classList.add("flexltr", "createdWebhook");
//TODO make sure this is something I can actually do here
@@ -508,7 +509,7 @@ class User extends SnowFlake {
if (_) {
name.textContent = _.name;
pfp.src = _.getpfpsrc();
} else {
} else if (guild.id !== "@me") {
const notFound = document.createElement("span");
notFound.textContent = I18n.webhooks.notFound();
nameBox.append(notFound);
@@ -921,6 +922,25 @@ class User extends SnowFlake {
.filter((_) => _ !== undefined),
);
mut.addHTMLArea(mutDiv);
if (high.mutual_friends) {
const friends = buttons.add(I18n.profile.mutFriends());
const div = document.createElement("div");
div.classList.add("mutFriends");
div.append(
...high.mutual_friends
.map((_) => new User(_, this.localuser))
.map((user) => {
const html = user.createWidget(this.localuser.lookingguild);
html.onclick = (e) => {
e.stopImmediatePropagation();
e.preventDefault();
};
return html;
}),
);
friends.addHTMLArea(div);
}
})();
const fhtml = float.generateHTML();
fhtml.style.overflow = "auto";
+2 -1
View File
@@ -185,7 +185,8 @@
"userInfo": "User Info",
"bio": "About me:",
"permInfo": "Permissions",
"mut": "Mutual guilds",
"mut": "Mutual Guilds",
"mutFriends":"Mutual Friends",
"joined":"Account made: $1",
"joinedMember":"Joined $1: $2"
},