feat: add a fuck ton of get functions

This commit is contained in:
Twig 2025-07-18 12:56:33 +02:00
parent 58fe9a2eac
commit 69feff6cf8
No known key found for this signature in database
8 changed files with 81 additions and 0 deletions

21
utils/getFriendsSince.ts Normal file
View file

@ -0,0 +1,21 @@
import type { GuildMemberResponse, UserResponse } from "~/types/interfaces";
const { fetchFriends } = useApi();
export default async (profile: UserResponse | GuildMemberResponse): Promise<Date | null> => {
let user_uuid: string;
if ("username" in profile) {
user_uuid = profile.uuid
} else {
user_uuid = profile.user_uuid
}
const friends = await fetchFriends()
const friend = friends.find(friend => friend.uuid === user_uuid);
if (friend?.friends_since) {
return new Date(friend.friends_since);
}
return null
}