mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
Fix
This commit is contained in:
commit
7b5fce7603
@ -73,6 +73,20 @@ export function GUILD_MEMBER(guildId: Snowflake, userId: Snowflake): string {
|
|||||||
return `/guilds/${guildId}/members/${userId}`;
|
return `/guilds/${guildId}/members/${userId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ListGuildMembers {
|
||||||
|
limit?: number;
|
||||||
|
after?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GUILD_MEMBERS(guildId: Snowflake, options?: ListGuildMembers) {
|
||||||
|
let url = `/guilds/${guildId}/members?`;
|
||||||
|
|
||||||
|
if (options?.limit) url += `limit=${options.limit}`;
|
||||||
|
if (options?.after) url += `&after=${options.after}`;
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
/** used to ban members */
|
/** used to ban members */
|
||||||
export function GUILD_BAN(guildId: Snowflake, userId: Snowflake): string {
|
export function GUILD_BAN(guildId: Snowflake, userId: Snowflake): string {
|
||||||
return `/guilds/${guildId}/bans/${userId}`;
|
return `/guilds/${guildId}/bans/${userId}`;
|
||||||
|
@ -25,6 +25,7 @@ import {
|
|||||||
VideoQualityModes,
|
VideoQualityModes,
|
||||||
GetBans,
|
GetBans,
|
||||||
GetInvite,
|
GetInvite,
|
||||||
|
ListGuildMembers,
|
||||||
} from '@biscuitland/api-types';
|
} from '@biscuitland/api-types';
|
||||||
import type { ImageFormat, ImageSize } from '../utils/util';
|
import type { ImageFormat, ImageSize } from '../utils/util';
|
||||||
import { GuildFeatures, PremiumTiers } from '@biscuitland/api-types';
|
import { GuildFeatures, PremiumTiers } from '@biscuitland/api-types';
|
||||||
@ -45,6 +46,7 @@ import {
|
|||||||
GUILD_PRUNE,
|
GUILD_PRUNE,
|
||||||
GUILD_INVITES,
|
GUILD_INVITES,
|
||||||
GUILD_MEMBER,
|
GUILD_MEMBER,
|
||||||
|
GUILD_MEMBERS,
|
||||||
GUILD_MEMBER_ROLE,
|
GUILD_MEMBER_ROLE,
|
||||||
GUILD_ROLE,
|
GUILD_ROLE,
|
||||||
GUILD_ROLES,
|
GUILD_ROLES,
|
||||||
@ -1218,4 +1220,22 @@ export class Guild extends BaseGuild implements Model {
|
|||||||
|
|
||||||
return ChannelFactory.from(this.session, channel);
|
return ChannelFactory.from(this.session, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** fetches a member */
|
||||||
|
async fetchMember(memberId: Snowflake): Promise<Member> {
|
||||||
|
const member = await this.session.rest.get<DiscordMemberWithUser>(
|
||||||
|
GUILD_MEMBER(this.id, memberId)
|
||||||
|
);
|
||||||
|
|
||||||
|
return new Member(this.session, member, this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** fetches multiple members */
|
||||||
|
async fetchMembers(options?: ListGuildMembers): Promise<Member[]> {
|
||||||
|
const members = await this.session.rest.get<DiscordMemberWithUser[]>(
|
||||||
|
GUILD_MEMBERS(this.id, options)
|
||||||
|
);
|
||||||
|
|
||||||
|
return members.map((member) => new Member(this.session, member, this.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,12 @@ export class Member implements Model {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetch(): Promise<Member> {
|
||||||
|
const member = await Guild.prototype.fetchMember.call({ session: this.session, id: this.guildId }, this.id);
|
||||||
|
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
|
||||||
/** gets the members's guild avatar, not to be confused with Member.user.avatarURL() */
|
/** gets the members's guild avatar, not to be confused with Member.user.avatarURL() */
|
||||||
avatarURL(options: AvatarOptions): string {
|
avatarURL(options: AvatarOptions): string {
|
||||||
let url: string;
|
let url: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user