mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
fix(core): typing in avatars format
This commit is contained in:
parent
10ae21de2a
commit
5569d23edd
@ -1,11 +1,11 @@
|
||||
import type { APIGuildMember, MakeRequired } from '@biscuitland/common';
|
||||
import type { Session, ImageOptions } from '../index';
|
||||
import { formatImageURL } from '../index';
|
||||
import type { APIGuildMember, MakeRequired } from "@biscuitland/common";
|
||||
import type { ImageOptions, Session } from "../index";
|
||||
import { formatImageURL } from "../index";
|
||||
|
||||
export class MemberManager {
|
||||
constructor(private readonly session: Session) {}
|
||||
|
||||
dynamicAvatarURL({ avatar, guild_id, user }: DynamicMember, { size, format }: ImageOptions): string {
|
||||
dynamicAvatarURL({ avatar, guild_id, user }: DynamicMember, { size, format }: ImageOptions = {}): string {
|
||||
if (avatar?.length) {
|
||||
return formatImageURL(this.session.cdn.guilds(guild_id).users(user.id).avatars(avatar).get(), size, format);
|
||||
}
|
||||
@ -14,6 +14,6 @@ export class MemberManager {
|
||||
}
|
||||
}
|
||||
|
||||
export type DynamicMember = MakeRequired<APIGuildMember, 'user'> & {
|
||||
export type DynamicMember = MakeRequired<APIGuildMember, "user"> & {
|
||||
guild_id: string;
|
||||
};
|
||||
|
@ -2,25 +2,25 @@ import type {
|
||||
APIUser,
|
||||
RESTGetAPICurrentUserGuildsQuery,
|
||||
RESTPatchAPICurrentUserJSONBody,
|
||||
RESTPutAPICurrentUserApplicationRoleConnectionJSONBody
|
||||
} from '@biscuitland/common';
|
||||
import type { Session, ImageOptions } from '../index';
|
||||
import { formatImageURL } from '../index';
|
||||
RESTPutAPICurrentUserApplicationRoleConnectionJSONBody,
|
||||
} from "@biscuitland/common";
|
||||
import type { ImageOptions, Session } from "../index";
|
||||
import { formatImageURL } from "../index";
|
||||
|
||||
export class UserManager {
|
||||
readonly session!: Session;
|
||||
constructor(session: Session) {
|
||||
Object.defineProperty(this, 'session', {
|
||||
Object.defineProperty(this, "session", {
|
||||
value: session,
|
||||
writable: false
|
||||
writable: false,
|
||||
});
|
||||
}
|
||||
|
||||
get(userId = '@me') {
|
||||
get(userId = "@me") {
|
||||
return this.session.api.users(userId).get();
|
||||
}
|
||||
|
||||
avatarURL(user: APIUser, { size, format }: ImageOptions) {
|
||||
avatarURL(user: APIUser, { size, format }: ImageOptions = {}) {
|
||||
if (user.avatar?.length) {
|
||||
return formatImageURL(this.session.cdn.avatars(user.id).get(user.avatar), size, format);
|
||||
}
|
||||
@ -29,36 +29,36 @@ export class UserManager {
|
||||
}
|
||||
|
||||
createDM(userId: string) {
|
||||
return this.session.api.users('@me').channels.post({ body: { recipient_id: userId } });
|
||||
return this.session.api.users("@me").channels.post({ body: { recipient_id: userId } });
|
||||
}
|
||||
|
||||
editCurrent(body: RESTPatchAPICurrentUserJSONBody) {
|
||||
return this.session.api.users('@me').patch({
|
||||
body
|
||||
return this.session.api.users("@me").patch({
|
||||
body,
|
||||
});
|
||||
}
|
||||
|
||||
getGuilds(query?: RESTGetAPICurrentUserGuildsQuery) {
|
||||
return this.session.api.users('@me').guilds.get({ query });
|
||||
return this.session.api.users("@me").guilds.get({ query });
|
||||
}
|
||||
|
||||
getGuildMember(guildId: string) {
|
||||
return this.session.api.users('@me').guilds(guildId).member.get();
|
||||
return this.session.api.users("@me").guilds(guildId).member.get();
|
||||
}
|
||||
|
||||
leaveGuild(guildId: string) {
|
||||
return this.session.api.users('@me').guilds(guildId).delete();
|
||||
return this.session.api.users("@me").guilds(guildId).delete();
|
||||
}
|
||||
|
||||
getConnections() {
|
||||
return this.session.api.users('@me').connections.get();
|
||||
return this.session.api.users("@me").connections.get();
|
||||
}
|
||||
|
||||
getRoleConnections(applicationId: string) {
|
||||
return this.session.api.users('@me').applications(applicationId)['role-connection'].get();
|
||||
return this.session.api.users("@me").applications(applicationId)["role-connection"].get();
|
||||
}
|
||||
|
||||
updateRoleConnection(applicationId: string, body: RESTPutAPICurrentUserApplicationRoleConnectionJSONBody) {
|
||||
return this.session.api.users('@me').applications(applicationId)['role-connection'].put({ body });
|
||||
return this.session.api.users("@me").applications(applicationId)["role-connection"].put({ body });
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user